[keycloak-dev] Improve "Logout all" for the realm?

Marek Posolda mposolda at redhat.com
Tue Jun 5 16:13:23 EDT 2018


Hi,

when you click on tab "Sessions", you can see the screen with the:
- counts of Active Sessions
- counts of Offline Sessions
- Button "Logout All"

See the screenshot how the screen currently looks like: 
https://pasteboard.co/HowNZ2I.png

We have the JIRA https://issues.jboss.org/browse/KEYCLOAK-7055 and the 
PR with the discussion https://github.com/keycloak/keycloak/pull/5126 . 
In shortcut, JIRA and PR points few issues:
1) There is no way to logout all active sessions only (Keep the offline 
sessions)

2) There is no way to logout all offline sessions only (Keep the active 
sessions)

3) When you click on the button, there is no confirmation dialog. It 
seems that "Logout all" is quite an important step and confirmation 
should be there.

4) When you click on the button, it will do something between. All 
active sessions are cleared from infinispan, but offline sessions are 
NOT cleared. There is just realm notBefore policy updated, which 
indirectly invalidates the offline sessions, but they are still kept in 
infinispan and DB, which itself is a bug IMO.

So how to address all the issues? I can see something like this:
- Instead of 1 button, have 3 buttons (Logout all active sessions, 
Logout all offline sessions, Logout all)

- All the buttons will display confirmation dialog

- The "Logout all" will also update notBefore policy like it's done now. 
It will clear all the "Active" and "Offline" sessions from infinispan. 
This will be displayed in the confirmation dialog. So confirmation for 
"Logout all" will be like: "Do you want to logout all active sessions 
and offline sessions and update realm notBefore policy?" The other 2 
buttons won't update not-before policy (we can't do that unless we have 
separate not-before for active sessions and for offline sessions, but I 
vote to not do that considering the required complexity of this).

- The message for "Logout all" will be sent to all the clients with 
adminUrl (which is already done).

One related issue is, that currently we don't have a way to notify 
client applications that offline sessions were invalidated. I was 
thinking if we could have a way to register some listener for various  
adapter events (Logout all, logout all active/offline sessions, logout 
single active/offline session)? Client application can listen to the 
events and do something (EG. remove saved offline token from it's DB).

WDYT?
Marek



More information about the keycloak-dev mailing list