java.lang.Object
com.irurueta.authserver.authorization.api.web.mfa.FactorGrantor

@Component public class FactorGrantor extends Object
Adds the authority of a verified factor to an authentication. Authentications are immutable, so a new one is built that keeps the principal and the authorities of the original and carries the new factor, stamped with the current time (which is what auth_time and max_age are measured with).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Clock
    Source of the current time.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.core.Authentication
    grant(org.springframework.security.core.Authentication authentication, String authority)
    Grants a factor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • clock

      private final Clock clock
      Source of the current time.
  • Constructor Details

    • FactorGrantor

      public FactorGrantor()
  • Method Details

    • grant

      public org.springframework.security.core.Authentication grant(org.springframework.security.core.Authentication authentication, String authority)
      Grants a factor.
      Parameters:
      authentication - the authentication to start from.
      authority - authority of the factor (FACTOR_ prefix included).
      Returns:
      a new authentication with the factor added; the same one when it already holds it.