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
ConstructorDescriptionCreates a new configured instance by callingAppianUserDetailsService(boolean)
and passingtrue
.AppianUserDetailsService
(boolean applyPasswordManagement) Creates a new configured instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic PasswordStatus
Calculates the password status using the Password Management feature configurations and the user metadataUser.isTemporaryPassword()
andUser.getPasswordModified()
.getUserDetails
(UserProfile user) Creates a newAppianUserDetails
instance populated using the given Appian user metadata.getUserDetails
(UserProfile user, Set<String> userRoles) Deprecated.getUserDetailsLazy
(String username) Creates a newAppianUserDetails
instance populated using the given username.boolean
Deprecated.protected boolean
isApplyPasswordManagement
(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 usingUserProfileService
and creates a newAppianUserDetails
instance 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 theAppianUserDetails
bean 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:
true
if 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 usingUserProfileService
and creates a newAppianUserDetails
instance usinggetUserDetails(UserProfile)
.- Specified by:
loadUserByUsername
in interfaceorg.springframework.security.core.userdetails.UserDetailsService
- Throws:
org.springframework.security.core.userdetails.UsernameNotFoundException
-
getUserDetails
Creates a newAppianUserDetails
instance populated using the given Appian user metadata. IfisApplyPasswordManagement()
is set totrue
, sets thepassword status
usingcalculatePasswordStatus(UserProfile)
. Otherwise, sets the password status toPasswordStatus.NORMAL
.- Parameters:
user
- The Appian user metadata.- Returns:
- The user details.
-
getUserDetailsLazy
Creates a newAppianUserDetails
instance populated using the given username. The returned user details bean is "lazy" -- theAppian user metadata
and thepassword status
for 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 newAppianUserDetails
instance populated using the given Appian user metadata. IfisApplyPasswordManagement()
is set totrue
, sets thepassword status
usingcalculatePasswordStatus(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.