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 Summary
Constructors - 
Method Summary
Modifier 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
- 
InMemoryOneTimeTokenService
public InMemoryOneTimeTokenService() 
 - 
 - 
Method Details
- 
generate
Description copied from interface:OneTimeTokenServiceGenerates a one-time token based on the provided generate request.- Specified by:
 generatein interfaceOneTimeTokenService- Parameters:
 request- the generate request containing the necessary information to generate the token- Returns:
 - the generated 
OneTimeToken, nevernull. 
 - 
consume
Description copied from interface:OneTimeTokenServiceConsumes a one-time token based on the provided authentication token.- Specified by:
 consumein interfaceOneTimeTokenService- Parameters:
 authenticationToken- the authentication token containing the one-time token value to be consumed- Returns:
 - the consumed 
OneTimeTokenornullif the token is invalid 
 - 
setClock
Sets theClockused when generating one-time token and checking token expiry.- Parameters:
 clock- the clock
 
 -