Class InMemoryOneTimeTokenService
java.lang.Object
org.springframework.security.authentication.ott.InMemoryOneTimeTokenService
- All Implemented Interfaces:
- OneTimeTokenService
Provides an in-memory implementation of the 
OneTimeTokenService interface that
 uses a ConcurrentHashMap to store the generated OneTimeToken. A random
 UUID is used as the token value. A clean-up of the expired tokens is made if
 there is more or equal than 100 tokens stored in the map.- Since:
- 6.4
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionconsume(OneTimeTokenAuthenticationToken authenticationToken) Consumes a one-time token based on the provided authentication token.generate(GenerateOneTimeTokenRequest request) Generates a one-time token based on the provided generate request.voidSets theClockused when generating one-time token and checking token expiry.
- 
Constructor Details- 
InMemoryOneTimeTokenServicepublic InMemoryOneTimeTokenService()
 
- 
- 
Method Details- 
generateDescription copied from interface:OneTimeTokenServiceGenerates a one-time token based on the provided generate request.- Specified by:
- generatein interface- OneTimeTokenService
- Parameters:
- request- the generate request containing the necessary information to generate the token
- Returns:
- the generated OneTimeToken, nevernull.
 
- 
consumeDescription copied from interface:OneTimeTokenServiceConsumes a one-time token based on the provided authentication token.- Specified by:
- consumein interface- OneTimeTokenService
- Parameters:
- authenticationToken- the authentication token containing the one-time token value to be consumed
- Returns:
- the consumed OneTimeTokenornullif the token is invalid
 
- 
setClockSets theClockused when generating one-time token and checking token expiry.- Parameters:
- clock- the clock
 
 
-