RTR Configuration on Eureka
Overview
There are several settings related to tokens, session timeouts, etc. in keycloak. These need to be set appropriately in order for RTR to work as expected on Eureka.
Prerequisites
Access to the Keycloak admin console
These settings can be made via API, but that’s outside the scope of this document for now.
Tenant Id(s)
Credentials for at least one user in each tenant (for testing purposes)
Configuration
Log into the admin console for the target cluster. Typically the URL is something like:
https://keycloak-<clusterId>.int.aws.folio.org
.Select the target tenant from the realm drop-down in the top left corner.
Select “Realm Settings” in the left hand nav pane, then the “Token” tab
Under “Refresh tokens”:
Enable “Revoke Refresh Tokens”
Set “Refresh Token Max Reuse” to 0. This is key to the “rotation” part of Refresh Token Rotation (RTR).
Under “Access Tokens”:
Set “Access Token Lifespan” to 10 minutes - this can be adjusted based on customer requirements.
Click “Save”.
Change to the “Sessions” tab
For these next 4 settings, there’s somewhat complicated logic around determining what the RT TTL is, but keeping the values the same for all 4 settings makes it easy to figure out.
These settings can be adjusted per customer requirements, but it’s easiest if a single value is used for all 4.
These values must be > the “Access Token Lifespan” specified in step 5.
For an explanation of the logic, see https://stackoverflow.com/a/67624190 for details on the logic.
Under “SSO Session Settings”:
Set “SSO Session Idle” to 1 hour
Set “SSO Session Max” to 1 hour
Under “Client Session Settings”:
Set “Client Session Idle” to 1 hour
Set “Client Session Max” to 1 hour
Click “Save”.
Test the changes
In a new browser window/tab, goto your tenant-specific URL
Open your browser’s network tools (e.g. F12 on PC)
Enter a valid username and password
In the network tools, find and select the “token” API call, and look at the response. You should see the access token and refresh token expirations. Verify that they look right based on your configuration.
Tip: It may be helpful to note the “Date” header in the response, then use that to compare to the expirations returned in the response body. (See screenshots below).
Stripes Configuration
There are several configuration options in stripes (stripes-config.js) which control things like when warning dialogs are shown, etc.
See https://folio-org.atlassian.net/wiki/spaces/DEV/pages/46858271 for details.
Screenshots
Keywords
idle session timeout, fixed length session, RTR, refresh token rotation, Keycloak, Access Token, Refresh Token, AT, RT, TTL, Token TTL