Interface PersistentTokenRepository
- All Known Implementing Classes:
InMemoryTokenRepositoryImpl, JdbcTokenRepository
-
Method Summary
Modifier and TypeMethodDescriptionvoidStores a new series.getTokenForSeries(String series) The stored token ofseries, or null.default List<PersistentRememberMeToken> getTokensForUser(String username) Every series a user holds, for a "signed-in devices" page: one per browser or device that signed in with remember-me and has not signed out.voidremoveToken(String series) Forgets one series: one browser.default booleanremoveUserToken(String username, String series) Revokes one series of a user, such as a device chosen on a "signed-in devices" page.voidremoveUserTokens(String username) Forgets every series of a user: every browser they were remembered in.booleanupdateToken(String series, String expectedTokenHash, String newTokenHash, long lastUsed) Replaces the token ofseries, if it is stillexpectedTokenHash.
-
Method Details
-
createNewToken
Stores a new series. -
updateToken
Replaces the token of
series, if it is stillexpectedTokenHash.The test and the change are one step: of two requests presenting the same cookie at the same moment, one replaces the token and the other is told it did not. Store
expectedTokenHashas the previous hash of the replacement token, so concurrent requests can recognize the rotation for a bounded grace period.- Returns:
- whether this call replaced it
-
getTokenForSeries
The stored token ofseries, or null. -
removeToken
Forgets one series: one browser. -
removeUserTokens
Forgets every series of a user: every browser they were remembered in. -
getTokensForUser
Every series a user holds, for a "signed-in devices" page: one per browser or device that signed in with remember-me and has not signed out. A repository that cannot list throws
UnsupportedOperationException.Parameters
username: the user, matched ignoring case as sign-in does
-
removeUserToken
Revokes one series of a user, such as a device chosen on a "signed-in devices" page. A series of another user is left alone, so a series taken from a request cannot revoke someone else's sign-in.
Returns
whether the series belonged to the user and was removed
-