Class OttCodeAuthenticationToken
java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
com.irurueta.authserver.authorization.api.web.ott.OttCodeAuthenticationToken
- All Implemented Interfaces:
Serializable,Principal,org.springframework.security.core.Authentication,org.springframework.security.core.CredentialsContainer
public class OttCodeAuthenticationToken
extends org.springframework.security.authentication.AbstractAuthenticationToken
Request to sign in with a numeric one-time code: the code the user typed, the identifier it was requested for and the
binding id of the session that requested it. It is never authenticated itself;
OttCodeAuthenticationProvider
answers with the authentication of the user.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
org.springframework.security.authentication.AbstractAuthenticationToken.AbstractAuthenticationBuilder<B extends org.springframework.security.authentication.AbstractAuthenticationToken.AbstractAuthenticationBuilder<B>>Nested classes/interfaces inherited from interface org.springframework.security.core.Authentication
org.springframework.security.core.Authentication.Builder<B extends org.springframework.security.core.Authentication.Builder<B>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final StringBinding id of the session that requested the code.private final StringThe code as typed.(package private) static final intLongest numeric code accepted, so a token value of digits is never mistaken for a code by length alone.private static final longSerialization version.private final StringThe identifier the code was requested for. -
Constructor Summary
ConstructorsConstructorDescriptionOttCodeAuthenticationToken(String username, String code, String bindingId) Creates the request. -
Method Summary
Modifier and TypeMethodDescriptionGets the binding id of the session that requested the code.Gets the code.Gets the identifier the code was requested for.static booleanTells whether a submitted value is a numeric code rather than the token of a magic link (which is a UUID).Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.security.core.Authentication
toBuilder
-
Field Details
-
MAX_CODE_LENGTH
static final int MAX_CODE_LENGTHLongest numeric code accepted, so a token value of digits is never mistaken for a code by length alone.- See Also:
-
serialVersionUID
private static final long serialVersionUIDSerialization version.- See Also:
-
username
The identifier the code was requested for. -
code
The code as typed. -
bindingId
Binding id of the session that requested the code.
-
-
Constructor Details
-
OttCodeAuthenticationToken
Creates the request.- Parameters:
username- the identifier the code was requested for, empty when the session requested none.code- the code as typed.bindingId- binding id of the session that requested the code, empty when it requested none.
-
-
Method Details
-
isCode
Tells whether a submitted value is a numeric code rather than the token of a magic link (which is a UUID).- Parameters:
value- the value of thetokenfield.- Returns:
truefor one to 12 ASCII digits.
-
getCredentials
Gets the code.- Returns:
- the code as typed.
-
getPrincipal
Gets the identifier the code was requested for.- Returns:
- the identifier.
-
bindingId
Gets the binding id of the session that requested the code.- Returns:
- the binding id.
-