[keycloak-dev] Offline tokens

Marek Posolda mposolda at redhat.com
Fri Aug 21 07:30:16 EDT 2015


Some thoughts around offline tokens impl:

- Client has switch "Allow offline tokens" . Offline token can be 
requested just if the switch is enabled

- Offline token can be requested if parameter "scope=offline" is sent. 
Offline token is sent alone, no IDToken or refreshToken is sent together 
with it.
Question: Should be offline tokens available just for 
ResourceOwnerPasswordCredentials and ServiceAccounts or also for classic 
web based authorization code flow?

- There are methods on UserModel to track which offline tokens were 
issued for particular user. Like:

List<String> getOfflineTokens();
void addOfflineToken(String offlineToken);
void removeOfflineToken(String offlineToken);

- Offline token will never expire. Or should we eventually add another 
timeout for offline token (With some big default value like 1 month or so)?

- Offline token is not refreshable.

- Offline token can be validated by current OIDC endpoint for token 
validation. Offline token is not valid if UserModel doesn't have token 
anymore on it. But offline token is still valid even if corresponding 
UserSession doesn't exist. So we can still have offline tokens valid for 
1 year even if SsoSessionMaxLifespan is just 10 hours.

- Offline token can be logged out. Logout will remove offline token from 
corresponding UserModel.

- In Account management applications page can user see list of offline 
tokens issued for individual clients and he can revoke them. Not sure if 
put another "Revoke offline token" or use current "Revoke grant" action, 
which will revoke both consents and offline tokens?

- Admin can see the offline tokens for user in admin console and can 
revoke them too . Current button "Logout All" in sessions tab will 
revoke offline tokens from all users . For performance reasons, we may 
need method on UserProvider, so it's possible to clean whole DB table 
"OFFLINE_TOKEN" (similarly for mongo) instead of iterating through all 
users.

- For adapters, we should likely have an option, so the REST endpoint 
adapter has possibility to validate offline token by always sending 
validation request to KC server. We didn't need it for access tokens, 
which are valid just for 1 minute or so, but offline tokens are long 
lived so adapter should have this possibility IMO.

WDYT?

Marek


More information about the keycloak-dev mailing list