Package io.gravitee.am.service.impl
Class PasswordHistoryService
java.lang.Object
io.gravitee.am.service.impl.PasswordHistoryService
Service providing password history.
-
Constructor Summary
ConstructorsConstructorDescriptionPasswordHistoryService(PasswordHistoryRepository repository, AuditService auditService, PasswordEncoder passwordEncoder) -
Method Summary
Modifier and TypeMethodDescriptionio.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.io.reactivex.rxjava3.core.CompletabledeleteByReference(ReferenceType referenceType, String referenceId) Delete all password history for an application or domain.io.reactivex.rxjava3.core.CompletabledeleteByUser(String userId) Delete all password history for a user.io.reactivex.rxjava3.core.Flowable<PasswordHistory>findByReference(ReferenceType referenceType, String referenceId) Find all password history for an application or domain.io.reactivex.rxjava3.core.Flowable<PasswordHistory>findUserHistory(ReferenceType referenceType, String referenceId, String userId) Returns a user's password history.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.
-
Constructor Details
-
PasswordHistoryService
@Autowired public PasswordHistoryService(@Lazy PasswordHistoryRepository repository, AuditService auditService, @Named("argon2IdEncoder") PasswordEncoder passwordEncoder)
-
-
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 aPasswordHistoryinstance on completion.- Parameters:
referenceType- the reference type (DOMAIN, APPLICATION)referenceId- id of the referenceuser- id of user for this passwordrawPassword- 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 actionpasswordSettings- domain/application password settings- Returns:
- Single containing
PasswordHistoryor 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 referenceuserId- id of user for this passwordpassword- the password to addpasswordSettings- domain/application password settings- Returns:
- Single containing a
Booleantrueif 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 referenceuserId- 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
Delete all password history for a user.- Parameters:
userId- unique ID of the user- Returns:
- Completable that indicates a successful delete operation.
-