Keycloak session last access is not updated - OIDC Java EE

Hello, I am working on configuring the OIDC protocol for our Java EE application. I am using Keycloak 21.1.2 version. The first impression is really possitive but now I am struggeling with one thing. I thought that Keycloak session and token will be updated by the adapter after updating the HttpSession but it does not happen. My solution for it is updating/refreshing the session/token by REST API and then “Last Access” of the session is updated but I feel it is not the best solution.

Maybe I missed something in configuration (refreshing tokens is enabled). Any suggestions?

Regards,
Adrian

okay, solved by replacing the REST API call with this code:

RefreshableKeycloakSecurityContext refreshableKeycloakSecurityContext = (RefreshableKeycloakSecurityContext) ((KeycloakPrincipal) request.getUserPrincipal()).getKeycloakSecurityContext();
refreshableKeycloakSecurityContext.refreshExpiredToken(false);