Package com.atlassian.crowd.model.sso
Class SAMLTrustEntityDaoSecretsWrapper
java.lang.Object
com.atlassian.crowd.model.sso.SAMLTrustEntityDaoSecretsWrapper
Wrapper for SAMLTrustEntityDao that handles secrets encryption and decryption.
- Since:
- 6.3
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindAll(Supplier<List<SAMLTrustEntity>> findAllFunction) Find all entities securely, restoring the sensitive data from secure storage before returning the entities.findById(long trustEntityId, Function<Long, Optional<SAMLTrustEntity>> findFunction) Find the entity by id securely, restoring the sensitive data from secure storage before returning the entity.booleanCheck if the secrets service is enabled.voidreEncrypt(Supplier<List<SAMLTrustEntity>> findAllFunction, Consumer<SAMLTrustEntity> updateFunction) Re-encrypt all entities.saveSecurely(SAMLTrustEntity samlTrustEntity, Consumer<SAMLTrustEntity> saveFunction) Save the entity securely by replacing its sensitive fields with a marker and storing their effective values in secure storage.
-
Constructor Details
-
SAMLTrustEntityDaoSecretsWrapper
-
-
Method Details
-
isEnabled
public boolean isEnabled()Check if the secrets service is enabled.- Returns:
- true if the secrets service is enabled, false otherwise
-
saveSecurely
public SAMLTrustEntity saveSecurely(SAMLTrustEntity samlTrustEntity, Consumer<SAMLTrustEntity> saveFunction) Save the entity securely by replacing its sensitive fields with a marker and storing their effective values in secure storage.- Parameters:
samlTrustEntity- the entity to savesaveFunction- the DAO function that executes saving- Returns:
- the stored SAMLTrustEntity with decrypted sensitive field values
-
findById
public Optional<SAMLTrustEntity> findById(long trustEntityId, Function<Long, Optional<SAMLTrustEntity>> findFunction) Find the entity by id securely, restoring the sensitive data from secure storage before returning the entity.- Parameters:
trustEntityId- the id of the entity to findfindFunction- the DAO function that executes finding- Returns:
- the entity with the sensitive data repopulated
-
findAll
Find all entities securely, restoring the sensitive data from secure storage before returning the entities.- Parameters:
findAllFunction- the DAO function that executes finding all entities- Returns:
- the list of entities with the sensitive data repopulated
-
reEncrypt
public void reEncrypt(Supplier<List<SAMLTrustEntity>> findAllFunction, Consumer<SAMLTrustEntity> updateFunction) Re-encrypt all entities. The sensitive data is moved to secure storage and the entity is sanitized. If the entities were not secure storage before, the method should store the secrets and replace the sensitive data with a marker. If the entities were previously securely stored, the effective secret storage values will be updated without changing the marker.- Parameters:
findAllFunction- the DAO function that executes finding all entities. Note: if the entities were stored in secure storage before, the function should include them.updateFunction- the DAO function that executes updating the entity
-