[keycloak-user] How to get online users

Jason Rodis jasrodis at gmail.com
Mon Oct 6 05:40:57 EDT 2014


Good morning,

I am trying to set up an application that uses:

1. Spring 3.2.x

I used to have spring security for the authentication of the users, and I could get all the online users by a bean called SpringRegistryImpl. Here is an example how I could get all the logged in users:

In the controller class I had:

@Autowired
private SessionRegistryImpl sessionRegistry;

and then:

            List<Object> principals = sessionRegistry.getAllPrincipals();

            for (Object principal : principals) {
                if (principal instanceof UserDetails) {
           		//Add user to the list with the logged in users (in session).
                }
            }


Now, I have configured my application’s authentication with keycloak and removed spring-security.

How can I retrieve all the users in session with keycloak?

Thanks in advance,
Jason


More information about the keycloak-user mailing list