java.lang.Object
org.springframework.security.authentication.AbstractAuthenticationToken
com.irurueta.authserver.authorization.api.web.totp.TotpAuthenticationToken
All Implemented Interfaces:
Serializable , Principal , org.springframework.security.core.Authentication, org.springframework.security.core.CredentialsContainer
public class TotpAuthenticationToken
extends org.springframework.security.authentication.AbstractAuthenticationToken
Request to verify a second factor: the authentication the user already holds (the primary factor) and the code the
user typed, and what kind of code it is. It is never authenticated itself;
TotpAuthenticationProvider answers
with the primary authentication enriched with the TOTP authority and, when the code confirmed an enrolment, hands the
new recovery codes back to the filter through
issueRecoveryCodes(List).
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
Fields
Recovery codes generated while the request was verified (an enrolment), to be shown once; never serialized, as
they only travel from the provider back to the filter of the same request.
private final org.springframework.security.core.Authentication
The authentication the user already holds.
private static final long
Constructor Summary
Constructors
Method Summary
All Methods Instance Methods Concrete Methods
Gets the recovery codes generated while the request was verified.
void
Hands back the recovery codes generated while the request was verified.
Tells what kind of code it is.
org.springframework.security.core.Authentication
Gets the authentication the user already holds.
Methods inherited from class org.springframework.security.authentication.AbstractAuthenticationToken
equals, eraseCredentials, getAuthorities, getDetails, getName, hashCode, isAuthenticated, setAuthenticated, setDetails, toString
Methods inherited from interface org.springframework.security.core.Authentication
toBuilder
Field Details
serialVersionUID
private static final long serialVersionUID
Serialization version.
See Also:
primary
private final org.springframework.security.core.Authentication primary
The authentication the user already holds.
kind
What kind of code it is.
issuedRecoveryCodes
private transient List <String > issuedRecoveryCodes
Recovery codes generated while the request was verified (an enrolment), to be shown once; never serialized, as
they only travel from the provider back to the filter of the same request.
Constructor Details
TotpAuthenticationToken
public TotpAuthenticationToken (org.springframework.security.core.Authentication primary,
String code,
TotpCodeKind kind)
Creates the request.
Parameters:
primary - the authentication the user already holds.
code - the code as typed.
kind - what kind of code it is.
Method Details
getCredentials
public String getCredentials ()
Gets the code.
Returns:
the code as typed.
getPrincipal
Gets the principal.
Returns:
the principal of the primary authentication.
primary
public org.springframework.security.core.Authentication primary ()
Gets the authentication the user already holds.
Returns:
the primary authentication.
kind
Tells what kind of code it is.
Returns:
the kind of code.
issuedRecoveryCodes
Gets the recovery codes generated while the request was verified.
Returns:
the codes; empty unless the code confirmed an enrolment.
issueRecoveryCodes
public void issueRecoveryCodes (List <String > codes)
Hands back the recovery codes generated while the request was verified.
Parameters:
codes - the codes in clear text.