admin管理员组

文章数量:1431911

I want to remove all the users sessions only for the specify client in Keycloak but I am not finding a way. What I did until now is as below:

List<UserSessionModel> userSessions = session.sessions()
                                             .getUserSessionsStream(realm,client)
                                             .collect(Collectors.toList())
for (UserSessionModel userSession : userSessions) {
    AuthenticatedClientSessionModel clientSession = userSession.getAuthenticatedClientSessionByClient(client.getId());
    userSession.removeAuthenticatedClientSessions(Collections.singleton(client.getId()));

}

How can I fix this?

I am trying to find a solution for this.

本文标签: javaKeycloak Client Remove UserSessionStack Overflow