Interface RecoveryService

  • All Known Implementing Classes:
    RecoveryServiceImpl

    public interface RecoveryService
    Service that manages a user's recovery codes. These codes can be used to unlock an account when two factor authentication is enabled and the user loses his/her phone.
    • Method Detail

      • generateRecoveryCodes

        java.util.stream.Stream<RecoveryCode> generateRecoveryCodes()
        Generates new recovery codes for the current user and deletes the old codes (if any).
        Returns:
        stream of the new RecoveryCodes
      • useRecoveryCode

        void useRecoveryCode​(java.lang.String recoveryCode)
        Checks if a recovery code is valid for the current user and throws an exception if it is not. The code is removed after a successful recovery attempt.
        Parameters:
        recoveryCode - the code to validate
        Throws:
        org.springframework.security.authentication.BadCredentialsException - if the recovery code is incorrect
      • getRecoveryCodes

        java.util.stream.Stream<RecoveryCode> getRecoveryCodes()
        Get the recovery codes (if any) of the current user.
        Returns:
        stream of recovery codes