public class SiteminderAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider
AuthenticationProvider
implementation that retrieves user details from an UserDetailsService
.hideUserNotFoundExceptions, messages
Constructor and Description |
---|
SiteminderAuthenticationProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
additionalAuthenticationChecks(UserDetails user,
UsernamePasswordAuthenticationToken authentication)
Allows subclasses to perform any additional checks of a returned (or cached)
UserDetails
for a given authentication request. |
protected void |
doAfterPropertiesSet() |
UserDetailsService |
getUserDetailsService()
Return the user details service.
|
protected UserDetails |
retrieveUser(String username,
UsernamePasswordAuthenticationToken authentication)
Allows subclasses to actually retrieve the
UserDetails from an implementation-specific
location, with the option of throwing an AuthenticationException immediately if the presented
credentials are incorrect (this is especially useful if it is necessary to bind to a resource as the user in
order to obtain or generate a UserDetails ). |
void |
setUserDetailsService(UserDetailsService userDetailsService)
Sets the user details service.
|
afterPropertiesSet, authenticate, createSuccessAuthentication, getPostAuthenticationChecks, getPreAuthenticationChecks, getUserCache, isForcePrincipalAsString, isHideUserNotFoundExceptions, setForcePrincipalAsString, setHideUserNotFoundExceptions, setMessageSource, setPostAuthenticationChecks, setPreAuthenticationChecks, setUserCache, supports
protected void additionalAuthenticationChecks(UserDetails user, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException
AbstractUserDetailsAuthenticationProvider
UserDetails
for a given authentication request. Generally a subclass will at least compare the Authentication.getCredentials()
with a UserDetails.getPassword()
. If custom logic is needed to compare
additional properties of UserDetails
and/or UsernamePasswordAuthenticationToken
,
these should also appear in this method.additionalAuthenticationChecks
in class AbstractUserDetailsAuthenticationProvider
user
- as retrieved from the AbstractUserDetailsAuthenticationProvider.retrieveUser(String, UsernamePasswordAuthenticationToken)
or
UserCache
authentication
- the current request that needs to be authenticatedAuthenticationException
- AuthenticationException if the credentials could not be validated (generally a
BadCredentialsException
, an AuthenticationServiceException
)AbstractUserDetailsAuthenticationProvider.additionalAuthenticationChecks(org.acegisecurity.userdetails.UserDetails, org.acegisecurity.providers.UsernamePasswordAuthenticationToken)
protected void doAfterPropertiesSet() throws Exception
doAfterPropertiesSet
in class AbstractUserDetailsAuthenticationProvider
Exception
AbstractUserDetailsAuthenticationProvider.doAfterPropertiesSet()
public UserDetailsService getUserDetailsService()
protected final UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException
AbstractUserDetailsAuthenticationProvider
UserDetails
from an implementation-specific
location, with the option of throwing an AuthenticationException
immediately if the presented
credentials are incorrect (this is especially useful if it is necessary to bind to a resource as the user in
order to obtain or generate a UserDetails
).Subclasses are not required to perform any
caching, as the AbstractUserDetailsAuthenticationProvider
will by default cache the
UserDetails
. The caching of UserDetails
does present additional complexity as this
means subsequent requests that rely on the cache will need to still have their credentials validated, even if
the correctness of credentials was assured by subclasses adopting a binding-based strategy in this method.
Accordingly it is important that subclasses either disable caching (if they want to ensure that this method is
the only method that is capable of authenticating a request, as no UserDetails
will ever be
cached) or ensure subclasses implement AbstractUserDetailsAuthenticationProvider.additionalAuthenticationChecks(UserDetails,
UsernamePasswordAuthenticationToken)
to compare the credentials of a cached UserDetails
with
subsequent authentication requests.
Most of the time subclasses will not perform credentials inspection in this method, instead
performing it in AbstractUserDetailsAuthenticationProvider.additionalAuthenticationChecks(UserDetails, UsernamePasswordAuthenticationToken)
so
that code related to credentials validation need not be duplicated across two methods.
retrieveUser
in class AbstractUserDetailsAuthenticationProvider
username
- The username to retrieveauthentication
- The authentication request, which subclasses may need to perform a binding-based
retrieval of the UserDetails
null
- instead an exception should the thrown)AuthenticationException
- if the credentials could not be validated (generally a
BadCredentialsException
, an AuthenticationServiceException
or
UsernameNotFoundException
)AbstractUserDetailsAuthenticationProvider.retrieveUser(java.lang.String, org.acegisecurity.providers.UsernamePasswordAuthenticationToken)
public void setUserDetailsService(UserDetailsService userDetailsService)
userDetailsService
- The user details service.Copyright © 2016. All rights reserved.