Keycloack and Wildfly, connection closed after access token lifespan

  Kiến thức lập trình

I created a web application with Wildfly 30 (Jakarta EE10). Authentication works with Keycloak.
I use the annotation:

@OpenIdAuthenticationMechanismDefinition(
        providerURI = "${openIdConfig.providerUrl}",
        clientId = "${openIdConfig.clientId}",
        clientSecret = "${openIdConfig.clientSecret}",
        redirectURI = "${openIdConfig.redirectUrl}",
        claimsDefinition = @ClaimsDefinition(callerGroupsClaim = "roles"),
        logout = @LogoutDefinition(redirectURI = "/logout.html", notifyProvider = true)
)

This works fine, but after the lifetime of the ‘Access Token Lifespan’ in Keycloak (5 minutes default) the session is closed and the user has to log in again. This happens even if the user is constantly requesting new pages.

How can I keep the user logged in until the session expires (30 minutes default).

LEAVE A COMMENT