U
- is the generic type of the UserDetails
implementation used to bridge with spring-security.P
- is the generic type of the Principal
for internal user representation to bridge with
PrincipalAccessControlProvider
.public abstract class AbstractAccessControlBasedAuthenticationProvider<U extends org.springframework.security.core.userdetails.UserDetails,P extends Principal>
extends org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
AbstractUserDetailsAuthenticationProvider
based on
PrincipalAccessControlProvider
and AccessControlProvider
.Modifier and Type | Field and Description |
---|---|
private AccessControlProvider |
accessControlProvider |
private static org.slf4j.Logger |
LOG
The
Logger instance. |
private PrincipalAccessControlProvider<P> |
principalAccessControlProvider |
Constructor and Description |
---|
AbstractAccessControlBasedAuthenticationProvider()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
additionalAuthenticationChecks(org.springframework.security.core.userdetails.UserDetails userDetails,
org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication)
Here the actual authentication has to be implemented.
|
protected abstract U |
createUser(String username,
String password,
P principal,
Set<org.springframework.security.core.GrantedAuthority> authorities)
Creates an instance of
UserDetails that represent the user with the given username . |
protected abstract P |
retrievePrincipal(String username,
org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication)
Retrieves the internal
Principal object representing the user. |
protected org.springframework.security.core.userdetails.UserDetails |
retrieveUser(String username,
org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication) |
void |
setAccessControlProvider(AccessControlProvider accessControlProvider) |
void |
setPrincipalAccessControlProvider(PrincipalAccessControlProvider<P> principalAccessControlProvider) |
afterPropertiesSet, authenticate, createSuccessAuthentication, doAfterPropertiesSet, getPostAuthenticationChecks, getPreAuthenticationChecks, getUserCache, isForcePrincipalAsString, isHideUserNotFoundExceptions, setAuthoritiesMapper, setForcePrincipalAsString, setHideUserNotFoundExceptions, setMessageSource, setPostAuthenticationChecks, setPreAuthenticationChecks, setUserCache, supports
private static final org.slf4j.Logger LOG
Logger
instance.private PrincipalAccessControlProvider<P extends Principal> principalAccessControlProvider
private AccessControlProvider accessControlProvider
public AbstractAccessControlBasedAuthenticationProvider()
@Inject public void setPrincipalAccessControlProvider(PrincipalAccessControlProvider<P> principalAccessControlProvider)
principalAccessControlProvider
- the PrincipalAccessControlProvider
to Inject
.@Inject public void setAccessControlProvider(AccessControlProvider accessControlProvider)
accessControlProvider
- the AccessControlProvider
to Inject
.protected void additionalAuthenticationChecks(org.springframework.security.core.userdetails.UserDetails userDetails, org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication) throws org.springframework.security.core.AuthenticationException
additionalAuthenticationChecks
in class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
org.springframework.security.core.AuthenticationException
protected abstract U createUser(String username, String password, P principal, Set<org.springframework.security.core.GrantedAuthority> authorities)
UserDetails
that represent the user with the given username
.username
- is the login of the user to create.password
- the password of the user.principal
- is the internal Principal
that has been provided by
retrievePrincipal(String, UsernamePasswordAuthenticationToken)
.authorities
- are the granted authorities
or in other words the permissions of the
user.protected abstract P retrievePrincipal(String username, org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication)
Principal
object representing the user. This can be any object implementing
Principal
and can contain additional user details such as profile data. This object is used to
retrieve
the (top-level)
AccessControl
s that have been granted to the user.username
- is the login of the user.authentication
- is the UsernamePasswordAuthenticationToken
.Principal
.protected org.springframework.security.core.userdetails.UserDetails retrieveUser(String username, org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication) throws org.springframework.security.core.AuthenticationException
retrieveUser
in class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
org.springframework.security.core.AuthenticationException
Copyright © 2014–2016 OASP-Team. All rights reserved.