Class AccountStatusUserDetailsService

java.lang.Object
com.irurueta.authserver.authorization.api.web.passkeys.AccountStatusUserDetailsService
All Implemented Interfaces:
org.springframework.security.core.userdetails.UserDetailsService

public class AccountStatusUserDetailsService extends Object implements org.springframework.security.core.userdetails.UserDetailsService
A UserDetailsService that refuses a disabled, locked or expired account.

Spring's WebAuthn provider loads the user a verified passkey belongs to and trusts it: unlike the password provider (see PasswordAuthenticationConfiguration) it never checks the status of the account. Handing it this decorator makes the passkey sign-in refuse the accounts the password sign-in refuses. The provider turns any exception into a bad-credentials failure, so the page shows the generic message.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.springframework.security.core.userdetails.UserDetailsChecker
    Checker of the status of the account.
    private final org.springframework.security.core.userdetails.UserDetailsService
    Service that loads the account.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.security.core.userdetails.UserDetails
    Loads an account that may sign in.

    Methods inherited from class java.lang.Object

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

    • delegate

      private final org.springframework.security.core.userdetails.UserDetailsService delegate
      Service that loads the account.
    • checker

      private final org.springframework.security.core.userdetails.UserDetailsChecker checker
      Checker of the status of the account.
  • Constructor Details

    • AccountStatusUserDetailsService

      public AccountStatusUserDetailsService()
  • Method Details

    • loadUserByUsername

      public org.springframework.security.core.userdetails.UserDetails loadUserByUsername(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException
      Loads an account that may sign in.
      Specified by:
      loadUserByUsername in interface org.springframework.security.core.userdetails.UserDetailsService
      Parameters:
      username - name of the user.
      Returns:
      the account.
      Throws:
      org.springframework.security.core.userdetails.UsernameNotFoundException - if there is no such account.
      org.springframework.security.authentication.AccountStatusException - if the account is disabled, locked or expired.