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 Details

    • ORDER

      public static final int ORDER
      Order of the contributor: after the built-in claims and the default contributors.
      See Also:
    • MULTI_FACTOR_AMR_VALUE

      public static final String MULTI_FACTOR_AMR_VALUE
      RFC 8176 amr value that tells that more than one factor was used.
      See Also:
    • factorTimeline

      private final FactorTimeline 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: JwtClaimsContributor
      Adds claims to the token being issued.
      Specified by:
      contribute in interface JwtClaimsContributor
      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.