Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close session when client is closed #111

Open
mario-s opened this issue Nov 22, 2024 · 0 comments
Open

Close session when client is closed #111

mario-s opened this issue Nov 22, 2024 · 0 comments

Comments

@mario-s
Copy link

mario-s commented Nov 22, 2024

Description

When I use the admin client in a Quarkus application, like in this tutorial and call the endpoint of the REST resource several times, the number of sessions increase with every request. This also happens when using the client in a try-with-resources block.

But the session is properly closed when executing tokenManager().logout();.

Note that there is already an issue in the Keycloak repository.

Discussion

No response

Motivation

Automatically cleanup every session when the close method of the client is used.

Details

I could provide a PR in the Keycloak repository for this issue. The change is small:

@Override
public void close() {
  if (this.tokenManager != null) {
    this.tokenManager.logout();
  }
  closed = true;
  client.close();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant