public class OtpService
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_CACHE_SOFT_LIMIT |
Constructor and Description |
---|
OtpService()
Creates a new OtpService with an expiration of 5 minutes.
|
OtpService(int duration,
java.util.concurrent.TimeUnit units)
Creates a new OtpService.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
generateDownloadToken(OtpAuthenticationToken authenticationToken)
Generates a download token for the specified authentication.
|
java.lang.String |
generateUiExtensionToken(OtpAuthenticationToken authenticationToken)
Generates a UI extension token for the specified authentication.
|
java.lang.String |
getAuthenticationFromDownloadToken(java.lang.String token)
Gets the authenticated identity from the specified one time use download token.
|
java.lang.String |
getAuthenticationFromUiExtensionToken(java.lang.String token)
Gets the authenticated identity from the specified one time use UI extension token.
|
protected static final int MAX_CACHE_SOFT_LIMIT
public OtpService()
public OtpService(int duration, java.util.concurrent.TimeUnit units)
duration
- The expiration durationunits
- The expiration unitsjava.lang.NullPointerException
- If units is nulljava.lang.IllegalArgumentException
- If duration is negativepublic java.lang.String generateDownloadToken(OtpAuthenticationToken authenticationToken)
authenticationToken
- The authenticationpublic java.lang.String getAuthenticationFromDownloadToken(java.lang.String token) throws OtpAuthenticationException
token
- The one time use download tokenOtpAuthenticationException
- When the specified token does not correspond to an authenticated identitypublic java.lang.String generateUiExtensionToken(OtpAuthenticationToken authenticationToken)
authenticationToken
- The authenticationpublic java.lang.String getAuthenticationFromUiExtensionToken(java.lang.String token) throws OtpAuthenticationException
token
- The one time use UI extension tokenOtpAuthenticationException
- When the specified token does not correspond to an authenticated identity