Class MfaClaimsContributor
java.lang.Object
com.irurueta.authserver.authorization.api.web.mfa.MfaClaimsContributor
- All Implemented Interfaces:
JwtClaimsContributor
@Component
@Order(100)
public class MfaClaimsContributor
extends Object
implements JwtClaimsContributor
Adds to the access and ID tokens how the user authenticated:
amr (the RFC 8176 values of the factors really
presented, plus mfa when there are at least two), acr (the class of the authentication, see
AuthenticationContextClass) and auth_time (the epoch second the primary factor was presented, a
number per OIDC; access tokens only, because the framework sets it on ID tokens). Every value comes from the
FactorTimeline, which reads the FactorGrantedAuthority
instances of the principal: authorities of an unknown factor and of a remembered (trusted) device are ignored, so a
browser that skipped the second factor gets amr [pwd] and the password class. A token with no counted factor
(for example of the client credentials grant) gets none of the claims.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FactorTimelineReads the counted factors of the principal and their instants.static final StringRFC 8176amrvalue that tells that more than one factor was used.static final intOrder of the contributor: after the built-in claims and the default contributors. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontribute(org.springframework.security.oauth2.server.authorization.token.OAuth2TokenContext context, Map<String, Object> claims) Adds claims to the token being issued.
-
Field Details
-
ORDER
public static final int ORDEROrder of the contributor: after the built-in claims and the default contributors.- See Also:
-
MULTI_FACTOR_AMR_VALUE
RFC 8176amrvalue that tells that more than one factor was used.- See Also:
-
factorTimeline
Reads the counted factors of the principal and their instants.
-
-
Constructor Details
-
MfaClaimsContributor
public MfaClaimsContributor()
-
-
Method Details
-
contribute
public void contribute(org.springframework.security.oauth2.server.authorization.token.OAuth2TokenContext context, Map<String, Object> claims) Description copied from interface:JwtClaimsContributorAdds claims to the token being issued.- Specified by:
contributein interfaceJwtClaimsContributor- Parameters:
context- the token context, with the token type, the principal, the client and the grant type.claims- the mutable claims of the token being built.
-