Class PrincipalManagerImpl
java.lang.Object
ch.tocco.nice2.userbase.impl.auth.PrincipalManagerImpl
- All Implemented Interfaces:
PrincipalManager,PrincipalDetailService,PrincipalManagerService,PrincipalService
-
Constructor Summary
ConstructorsConstructorDescriptionPrincipalManagerImpl(org.slf4j.Logger log, CommandExecutor executor, PersistenceService persistenceService, ImpliedRolesProvider impliedRolesProvider, BusinessUnitManager businessUnitManager, SecurityManager securityManager, QueryBuilderFactory queryBuilderFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateUniqueUsernames(List<Entity> users) Creates a uniqueusername.getPrincipal(long key, boolean withRoles) Returns the principal from the underlying store.getPrincipal(String name, boolean withRoles) Returns the principal from the underlying store.@Nullable PrincipalDetailsgetPrincipalDetails(String username, Object credentials) Return details of the user specified by username.getPrincipalEntity(String username) getRolesFor(String principal) Creates a query to retrieve all roles for a principal according to the business unit currently on the thread.getUserEntity(String username) voidloginNewlyCreatedUser(Entity userEntity) Logs in a (newly created) user.voidLogs in a user by username.voidresetPrincipalFields(Entity principal, PrincipalFields... fields) voidresetPrincipalFields(String username, PrincipalFields... fields) voidresetTemporaryPassword(String username) Invalidates the state of the temporary password request mechanism, resettingtemporary_passwordtonulland setting the flag requiring a new password after login tofalse.voidsetNewPassword(String username, String newPassword, boolean resetRequired) Sets new password and required-flag.voidsetTemporaryPassword(String username, String newPassword) Sets thetemporary_passwordfor the given principal, which will be valid for login as well until it expires based on thelast_password_dispatch.voidupdatePrincipalFields(Entity principal, PrincipalFields... fields) voidupdatePrincipalFields(String username, PrincipalFields... fields) voidupdateTwoFactorData(String username, String secret)
-
Constructor Details
-
PrincipalManagerImpl
public PrincipalManagerImpl(org.slf4j.Logger log, CommandExecutor executor, PersistenceService persistenceService, ImpliedRolesProvider impliedRolesProvider, BusinessUnitManager businessUnitManager, SecurityManager securityManager, QueryBuilderFactory queryBuilderFactory)
-
-
Method Details
-
getAnonymousPrincipal
- Specified by:
getAnonymousPrincipalin interfacePrincipalManager
-
getPrincipal
Description copied from interface:PrincipalManagerReturns the principal from the underlying store. ThewithRolesargument specifies whether the principal's roles should also be loaded.- Specified by:
getPrincipalin interfacePrincipalManager
-
getPrincipal
Description copied from interface:PrincipalManagerReturns the principal from the underlying store. ThewithRolesargument specifies whether the principal's roles should also be loaded.- Specified by:
getPrincipalin interfacePrincipalManager
-
getRole
- Specified by:
getRolein interfacePrincipalManager
-
getAllRoles
- Specified by:
getAllRolesin interfacePrincipalManager
-
getRolesFor
Creates a query to retrieve all roles for a principal according to the business unit currently on the thread. Roles assigned to a principal with a login role having no related business unit are loaded regardless of the current business unit.- Specified by:
getRolesForin interfacePrincipalManager
-
setNewPassword
Description copied from interface:PrincipalServiceSets new password and required-flag.- Specified by:
setNewPasswordin interfacePrincipalService- Parameters:
username- the name of the principal to set new password tonewPassword- the new password to setresetRequired- value of require-new-password flag
-
setTemporaryPassword
Description copied from interface:PrincipalServiceSets thetemporary_passwordfor the given principal, which will be valid for login as well until it expires based on thelast_password_dispatch.- Specified by:
setTemporaryPasswordin interfacePrincipalService- Parameters:
username- the name of the principalnewPassword- thetemporary_password
-
resetTemporaryPassword
Description copied from interface:PrincipalServiceInvalidates the state of the temporary password request mechanism, resettingtemporary_passwordtonulland setting the flag requiring a new password after login tofalse.- Specified by:
resetTemporaryPasswordin interfacePrincipalService- Parameters:
username- the name of the principal to modify
-
updatePrincipalFields
- Specified by:
updatePrincipalFieldsin interfacePrincipalService
-
resetPrincipalFields
- Specified by:
resetPrincipalFieldsin interfacePrincipalService
-
updatePrincipalFields
- Specified by:
updatePrincipalFieldsin interfacePrincipalService
-
resetPrincipalFields
- Specified by:
resetPrincipalFieldsin interfacePrincipalService
-
getPrincipalDetails
@Nullable public @Nullable PrincipalDetails getPrincipalDetails(String username, Object credentials) Description copied from interface:PrincipalDetailServiceReturn details of the user specified by username.- Specified by:
getPrincipalDetailsin interfacePrincipalDetailService
-
getCurrentPrincipal
- Specified by:
getCurrentPrincipalin interfacePrincipalService
-
getCurrentUser
- Specified by:
getCurrentUserin interfacePrincipalService
-
getPrincipalEntity
- Specified by:
getPrincipalEntityin interfacePrincipalService
-
getUserEntity
- Specified by:
getUserEntityin interfacePrincipalService
-
loginNewlyCreatedUser
Description copied from interface:PrincipalServiceLogs in a (newly created) user. Takes the related principal (only supported with one principal!). For example used in flows where new users (and thus logins) are created. Use with care!- Specified by:
loginNewlyCreatedUserin interfacePrincipalService
-
loginUser
Description copied from interface:PrincipalServiceLogs in a user by username. Use with care!- Specified by:
loginUserin interfacePrincipalService
-
createUniqueUsernames
Description copied from interface:PrincipalServiceCreates a uniqueusername. Based on theUser's email or firstname and lastname.- Specified by:
createUniqueUsernamesin interfacePrincipalService
-
updateTwoFactorData
- Specified by:
updateTwoFactorDatain interfacePrincipalManager
-