7

I have a Shiro session (id=11111) and a http session (id=22222).

When I try to invalidate the HttpSession, the wrong id is used.

Code:

public void logout() {
      SecurityUtils.getSubject().logout();

// exception is thrown in this line
FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
    }

Exception:

java.lang.IllegalStateException:
 org.apache.shiro.session.UnknownSessionException:
 There is no session with id [22222]

How can I invalidate the HttpSession or rather set the correct id?

sinclair
  • 2,812
  • 4
  • 24
  • 53

2 Answers2

1

The problem was solved by implementing a HttpSessionBindingListener and create a mapping of Shiro sessions to http sessions.

sinclair
  • 2,812
  • 4
  • 24
  • 53
0

SecurityUtils.getSubject().logout() stop and invalidate the session from DefaultSecurityManager.logout(Subject subject). So the session could not be invalidated after logout() call.

jpl
  • 347
  • 3
  • 11