Class AppianUserDetailsService
java.lang.Object
com.appiancorp.suiteapi.security.auth.AppianUserDetailsService
- All Implemented Interfaces:
org.springframework.security.core.userdetails.UserDetailsService
public class AppianUserDetailsService
extends Object
implements org.springframework.security.core.userdetails.UserDetailsService
Retrieves the user data from
UserProfileService and returns an instance of
AppianUserDetails.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new configured instance by callingAppianUserDetailsService(boolean)and passingtrue.AppianUserDetailsService(boolean applyPasswordManagement) Creates a new configured instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic PasswordStatusCalculates the password status using the Password Management feature configurations and the user metadataUser.isTemporaryPassword()andUser.getPasswordModified().getUserDetails(UserProfile user) Creates a newAppianUserDetailsinstance populated using the given Appian user metadata.getUserDetails(UserProfile user, Set<String> userRoles) Deprecated.getUserDetailsLazy(String username) Creates a newAppianUserDetailsinstance populated using the given username.booleanDeprecated.protected booleanisApplyPasswordManagement(String username) Override this method to dynamically specify whether password management should be applied for a given user.loadUserByUsername(String username) Retrieves the Appian user metadata usingUserProfileServiceand creates a newAppianUserDetailsinstance usinggetUserDetails(UserProfile).
-
Constructor Details
-
AppianUserDetailsService
public AppianUserDetailsService()Creates a new configured instance by callingAppianUserDetailsService(boolean)and passingtrue. -
AppianUserDetailsService
public AppianUserDetailsService(boolean applyPasswordManagement) Creates a new configured instance.- Parameters:
applyPasswordManagement- If set totrue, the password status of theAppianUserDetailsbean returned byloadUserByUsername(String)will be calculated usingcalculatePasswordStatus(UserProfile). If set tofalse, the password status will always be set toPasswordStatus.NORMAL.
-
-
Method Details
-
isApplyPasswordManagement
Deprecated. -
isApplyPasswordManagement
Override this method to dynamically specify whether password management should be applied for a given user. For example, a user could have password management enabled/disabled, depending on their group membership.- Parameters:
username- The user for which to return whether password management should be applied.- Returns:
trueif password management should be applied for the given user.
-
loadUserByUsername
public AppianUserDetails loadUserByUsername(String username) throws org.springframework.security.core.userdetails.UsernameNotFoundException Retrieves the Appian user metadata usingUserProfileServiceand creates a newAppianUserDetailsinstance usinggetUserDetails(UserProfile).- Specified by:
loadUserByUsernamein interfaceorg.springframework.security.core.userdetails.UserDetailsService- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
-
getUserDetails
Creates a newAppianUserDetailsinstance populated using the given Appian user metadata. IfisApplyPasswordManagement()is set totrue, sets thepassword statususingcalculatePasswordStatus(UserProfile). Otherwise, sets the password status toPasswordStatus.NORMAL.- Parameters:
user- The Appian user metadata.- Returns:
- The user details.
-
getUserDetailsLazy
Creates a newAppianUserDetailsinstance populated using the given username. The returned user details bean is "lazy" -- theAppian user metadataand thepassword statusfor the user are not loaded until the first call to these getters. Use this method when you only have a username since retrieving a UserProfile object is comparatively expensive.- Parameters:
username- The username.- Returns:
- The user details.
-
getUserDetails
Deprecated.UsegetUserDetails(UserProfile)instead.Creates a newAppianUserDetailsinstance populated using the given Appian user metadata. IfisApplyPasswordManagement()is set totrue, sets thepassword statususingcalculatePasswordStatus(UserProfile). Otherwise, sets the password status toPasswordStatus.NORMAL.- Parameters:
user- The Appian user metadata.userRoles- The roles of the user.- Returns:
- The user details.
-
calculatePasswordStatus
Calculates the password status using the Password Management feature configurations and the user metadataUser.isTemporaryPassword()andUser.getPasswordModified().- Parameters:
user- The Appian user metadata.- Returns:
- The password status for the given user.
-
getUserDetails(UserProfile)instead.