-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Describe the bug
Hi,
I noticed in 26.0.5 we have the following commit:
57ad090#diff-4af001d12faa275e01ea6aedd4f1c592cd7f3d962edc25e5b17fe294dc9fc7f3R177-R183
with the following code change in Keycloak.java
public void close() {Add commentMore actions
closed = true;
if (tokenManager != null) {
try {
tokenManager.logout();
} catch (RuntimeException e) {
// do our best closing the session but logout can fail because multiple reasons:
// shared jakarta client closed, realm removed or disabled, client removed or disabled,...
}
}
client.close();
}
In our code, we use a try with resources on a Keycloak instance for obtaining access and refresh tokens using password grant flow.
Since Keycloak is an AutoCloseable, because of try with resources the close() method is called after the tokens are obtained, therefore the logout occurs, therefore the refresh token is no longer valid (no session).
Can you explain why you've introduced this logout bevahiour on close(), please?
Version
admin client 26.0.5 (Keycloak core 26.2.5, Keycloak 26.2.5)
Expected behavior
Maybe the the session should not be logged out on close().
Actual behavior
In our code, we use a try with resources on a Keycloak instance for obtaining access and refresh tokens using password grant flow.
Since Keycloak is an AutoCloseable, because of try with resources the close() method is called after the tokens are obtained, therefore the logout occurs, therefore the refresh token is no longer valid (no session).
How to Reproduce?
No response
Anything else?
No response