Package com.irurueta.authserver.authorization.api.web.mfa


package com.irurueta.authserver.authorization.api.web.mfa
Multi-factor authentication orchestration. Filled by the MFA issue.
  • Class
    Description
    Registry of the authentication factors this server knows.
    The account an API request is made on behalf of: the owner of the bearer token.
    Resolves the account of the request being handled.
    Adds the authority of a verified factor to an authentication.
    Reads, from the FactorGrantedAuthority instances of an authentication, the factors that prove something about it and when they were presented.
    Thrown by StepUpGuard when the bearer token of an API call does not show a recent enough multi-factor sign-in for the operation.
    Decides whether an authentication has presented enough factors for the request being served: when the client or the user requires multi-factor authentication, the factors must satisfy the MfaPolicy; otherwise any authentication does.
    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).
    Wires multi-factor authentication: Spring Security's multi-factor support (it enables the entry points for a missing factor authority; the factors are not required globally, because the MfaAuthorizationManager requires them only when the client or the user asks for it), the registry of AuthenticationFactor beans, the policy manager, and its application to the login chain and to /oauth2/authorize.
    Translates the failures of the authenticator app, recovery code and trusted device endpoints to RFC 9457 problem details, answered as application/problem+json.
    Applies the multi-factor policy to the login/UI chain: the consent page needs the factors the policy asks for, and a user who lacks a registered second factor is sent to the second-factor page instead of getting a 403.
    Applies the multi-factor policy to /oauth2/authorize: a user whose client or account requires a second factor and has not presented one is sent to the second-factor page, with the authorize request saved, before any code is issued.
    Registers the password as an authentication factor: a primary one, which needs a second factor to satisfy the policy.
    Forces a new sign-in: it discards the stale authentication of the session (the security context of the thread and the one stored by the repository), saves the request being served (typically /oauth2/authorize?...) so it resumes once the user has signed in again, and redirects to the login page.
    Raised when an authorization request asks (through max_age) for a more recent authentication than the session has.
    Serves the second-factor page, as the contract apis/auth-server/web-pages/auth-server-pages-v1.yaml describes it through the generated SecondFactorPageApi, supplying the ordered fragments of the second factors, the model attributes each of them contributes for the signed-in user and the outcome of the last attempt to the template.
    Error handler of the authorization endpoint: a SecondFactorRequiredException goes to the entry point of the second-factor page, a ReauthenticationRequiredException to the one that forces a new sign-in, and any other error is answered as Spring Authorization Server's own handler does (a redirect to the client's redirect URI carrying the error, or a 400 when there is none).
    Extension point that lets a second factor contribute a Thymeleaf fragment to the second-factor page.
    Sends a user who has presented a primary factor but not yet the second one to the second-factor page, after saving the request being served (typically /oauth2/authorize?...) so the sign-in resumes where it left off once the second factor is verified.
    Raised while an authorization request is validated when the user must present a second factor first.
    Resolves the identifier of the account of a signed-in user.
    Records the authentications of users as security events: a success as SecurityEventType.LOGIN_SUCCESS and a failure as SecurityEventType.LOGIN_FAILURE.
    Applies the OpenID Connect step-up parameters of an authorization request to the authentication of the session.
    Guards the API operations that remove or reset a second factor (disabling the authenticator app, generating new recovery codes, revoking a trusted device): a stolen token, or a session left open, must not be enough to weaken the account.
    Applies step-up authentication (acr_values and max_age) to /oauth2/authorize.
    Lists and revokes the trusted devices of the authenticated account.
    Writes the cookie that identifies a trusted device.
    Maps the trusted devices of the domain onto the DTO generated from the contract, so a domain model is never returned from TrustedDeviceController.
    Registers the trusted device as an authentication factor of strength FactorStrength.REMEMBERED: together with the password it satisfies the sign-in policy, so a trusted browser is not asked for the code again, but it is never reported in amr, acr or auth_time and never satisfies a step-up request (acr_values asking for the multi-factor class, max_age), which still needs a real second factor.
    Lets a browser that was trusted earlier skip the second factor of a sign-in.
    Thrown when an account has no trusted device with the requested identifier.