-
1. Re: Wildfly SSO, does it support session timeout and logout?
cweiler Jun 16, 2014 11:17 AM (in response to tmescic)1 of 1 people found this helpfulQuestion 2
A Request.logout should do this, or at least Session.invalidate followed by Request.logout
see
-
2. Re: Wildfly SSO, does it support session timeout and logout?
pferraro Jun 16, 2014 11:31 AM (in response to tmescic)Question 1:
Is there a way to set a session timeout on the SSO session? Right now, when the session timeout occurs on one of my servlets
the user is still logged in (it has a valid JESESSIONIDSSO, and the SSO module just creates a new session automatically).
SSO is an authentication mechanism, not a session. A web session will have an associated SSO which associates the user with other application on that host. That SSO is not invalidated until there are no sessions associated with that SSO.
Question 2:
Is there a way to invalidate the SSO session programatically? The same way you can invalidate a regular session by invoking
session.invalidate().
To logout programmatically, use HttpServletRequest.logout().
jboss-web.xml:
- <context-root>/one_of_my_wars</context-root>
- <security-domain>MyDomain</security-domain>
- <valve>
- <class-name>org.apache.catalina.authenticator.SingleSignOn</class-name>
- </valve>
This <valve/> configuration is obsolete. Single sign-on is configured per host in the undertow subsystem (not per-application).
-
3. Re: Wildfly SSO, does it support session timeout and logout?
tmescic Jun 16, 2014 11:44 AM (in response to pferraro)So basically, it would be enough to set a session-timeout in web.xml of all of my web apps, and after they all timeout, SSO will be invalidated
(user will need to authenticate again). If this works, that's great, but I've already tried it, and it didn't work. I'll try again...
Regarding the programmatic logout, you mean that I need to keep track of all sessions and call HttpServletRequest.logout() on each one
individually? Isn't there a way to do it in one place only?
-
4. Re: Wildfly SSO, does it support session timeout and logout?
ctomc Jun 16, 2014 4:00 PM (in response to cweiler)AS7-5728 has noting to do with current implementation in WildFly...
said that, behavior should exactly the same.
-
5. Re: Wildfly SSO, does it support session timeout and logout?
pferraro Jun 16, 2014 6:56 PM (in response to tmescic)Regarding the programmatic logout, you mean that I need to keep track of all sessions and call HttpServletRequest.logout() on each one
individually? Isn't there a way to do it in one place only?
In same way that HttpServletRequest.login(...) will authenticate a user across applications, HttpServletRequest.logout() will log the user out across applications.
-
6. Re: Wildfly SSO, does it support session timeout and logout?
pferraro Jun 16, 2014 7:05 PM (in response to tmescic)So basically, it would be enough to set a session-timeout in web.xml of all of my web apps, and after they all timeout, SSO will be invalidated
(user will need to authenticate again). If this works, that's great, but I've already tried it, and it didn't work. I'll try again...
I misspoke - the SSO is revoked after a session is explicitly invalidated (i.e. via HttpSession.invalidate()). So, session timeout does not trigger this.
-
7. Re: Wildfly SSO, does it support session timeout and logout?
tmescic Jun 17, 2014 4:41 AM (in response to pferraro)Well, that seems wrong to me - if you enable SSO, your sessions will never expire due to inactivity of the user... Could this be a bug?
Any workarounds?
-
8. Re: Wildfly SSO, does it support session timeout and logout?
pferraro Jun 17, 2014 3:05 PM (in response to tmescic)You are confusing authentication with session state. These are distinct concerns. The user's HttpSession will still expire due to inactivity. However, any JSESSIONIDSSO cookie might till be valid. This is no different from other authentication mechanisms.
-
9. Re: Wildfly SSO, does it support session timeout and logout?
cweiler Jun 18, 2014 11:20 AM (in response to pferraro)So, to answer Question 1, what we need is a way to define the max lifetime of a granted ticket, where, after that, a re-authentication is required.
There is such configuration available?
-
10. Re: Wildfly SSO, does it support session timeout and logout?
pferraro Jun 22, 2014 9:24 AM (in response to cweiler)1 of 1 people found this helpfulThe SSO should be automatically removed either when any associated session is invalidated - or when the last associated session times out. The latter is not happening correctly.
[UNDERTOW-269] SSO not destroyed when the last associated session times out. - JBoss Issue Tracker
-
11. Re: Wildfly SSO, does it support session timeout and logout?
tmescic Jul 2, 2014 7:38 AM (in response to pferraro)I think I found another issue, this time the programmatic logout does not work as expected. I have a JAX-RS (RestEasy) service
with two paths (methods):
- http://server/security/login
- http://server/security/logout
The first one receives a username and a password and performs HttpServletRequest.login(username, password). This works OK,
SSO is created successfully and a valid JSESSIONIDSSO cookie is created. I can access my other webapps without the need
to authenticate again.
The logout method just performs HttpServletRequest.logout(). The problem is, the SSO is not destroyed after I call this method,
it is destroyed after this method is called by the client for the second time. I have also tried calling Session.invalidate() method
before the logout() method, and also calling the logout method two times in a row - it's still not working.
Could this also be a bug, or am I doing something wrong?
-
12. Re: Wildfly SSO, does it support session timeout and logout?
pferraro Jul 2, 2014 9:37 AM (in response to tmescic)The fix for that issue is here:
https://github.com/undertow-io/undertow/commit/edf51dc824c64a6ff4e9111e654f62fb7364a7eb
The original implementation of the logout authentication callback was not implemented correctly.
-
13. Re: Wildfly SSO, does it support session timeout and logout?
tmescic Jul 2, 2014 10:03 AM (in response to pferraro)Thanks Paul. Do you know when could the fixes (the one for session timeout and this one for logout)
become available as part of a WildFly final release? WildFly 8.2.0.Final maybe?
P.S.
I took a quick look at the fix above and it seems to me that manager.removeSingleSignOn(ssoID) is called
in both the old and the fixed version (when a EventType.LOGGED_OUT event occurs) so I'm not sure how
the fix actually helps...
-
14. Re: Wildfly SSO, does it support session timeout and logout?
ctomc Jul 2, 2014 10:59 AM (in response to tmescic)No reason why this shouldn't make it into 8.2.
Fix just needs to be backported to undertow 1.0.x branch (are you up for it?)
As 8.2 when released will just include latest Undertow from 1.0.x branch.