Class PasswordHistoryService

java.lang.Object
io.gravitee.am.service.impl.PasswordHistoryService

@Component public class PasswordHistoryService extends Object
Service providing password history.
  • Constructor Details

  • Method Details

    • addPasswordToHistory

      public io.reactivex.rxjava3.core.Maybe<PasswordHistory> addPasswordToHistory(ReferenceType referenceType, String referenceId, User user, String rawPassword, User principal, PasswordSettings passwordSettings)
      Checks that a password has not already been used in the allotted history and adds it if it has not. Returns a PasswordHistory instance on completion.
      Parameters:
      referenceType - the reference type (DOMAIN, APPLICATION)
      referenceId - id of the reference
      user - id of user for this password
      rawPassword - unencrypted password provided by the user. Passed separate from the user object as its password is nulled after creation to avoid leakage.
      principal - user performing this action
      passwordSettings - domain/application password settings
      Returns:
      Single containing PasswordHistory or an error if the password was already in the history.
    • passwordAlreadyUsed

      public io.reactivex.rxjava3.core.Single<Boolean> passwordAlreadyUsed(ReferenceType referenceType, String referenceId, String userId, String password, PasswordSettings passwordSettings)
      Checks if a password is already in the history.
      Parameters:
      referenceType - the reference type (DOMAIN, APPLICATION)
      referenceId - id of the reference
      userId - id of user for this password
      password - the password to add
      passwordSettings - domain/application password settings
      Returns:
      Single containing a Boolean true if the password is already present the allotted number of previous passwords.
    • findUserHistory

      public io.reactivex.rxjava3.core.Flowable<PasswordHistory> findUserHistory(ReferenceType referenceType, String referenceId, String userId)
      Returns a user's password history.
      Parameters:
      referenceType - the reference type (DOMAIN, APPLICATION)
      referenceId - id of the reference
      userId - id of user for this password
      Returns:
      Flowable containing the user's password history.
    • findByReference

      public io.reactivex.rxjava3.core.Flowable<PasswordHistory> findByReference(ReferenceType referenceType, String referenceId)
      Find all password history for an application or domain.
      Parameters:
      referenceType - type of reference (e.g. DOMAIN, APPLICATION)
      referenceId - ID of the reference
      Returns:
      Flowable containing password histories, if any, for the referenced entity.
    • deleteByReference

      public io.reactivex.rxjava3.core.Completable deleteByReference(ReferenceType referenceType, String referenceId)
      Delete all password history for an application or domain.
      Parameters:
      referenceType - type of reference (e.g. DOMAIN, APPLICATION)
      referenceId - ID of the reference
      Returns:
      Completable that indicates a successful delete operation.
    • deleteByUser

      public io.reactivex.rxjava3.core.Completable deleteByUser(String userId)
      Delete all password history for a user.
      Parameters:
      userId - unique ID of the user
      Returns:
      Completable that indicates a successful delete operation.