Class ReverseProxyAuthenticationProvider
java.lang.Object
org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
org.jenkinsci.plugins.reverse_proxy_auth.auth.ReverseProxyAuthenticationProvider
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.MessageSourceAware
,org.springframework.security.authentication.AuthenticationProvider
public class ReverseProxyAuthenticationProvider
extends org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
- Author:
- Wilder Rodrigues (wrodrigues@schubergphilis.com)
-
Field Summary
Fields inherited from class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
hideUserNotFoundExceptions, messages
-
Constructor Summary
ConstructorsConstructorDescriptionReverseProxyAuthenticationProvider
(ReverseProxyAuthenticator authenticator) Creates an instance with the supplied authenticator and a null authorities populator.ReverseProxyAuthenticationProvider
(ReverseProxyAuthenticator authenticator, ReverseProxyAuthoritiesPopulator authoritiesPopulator) Create an instance with the supplied authenticator and authorities populator implementations. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
additionalAuthenticationChecks
(org.springframework.security.core.userdetails.UserDetails userDetails, org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication) protected org.springframework.security.core.userdetails.UserDetails
createUserDetails
(ReverseProxyUserDetails user, String username, String password) Creates the finalUserDetails
object that will be returned by the provider once the user has been authenticated.protected ReverseProxyAuthoritiesPopulator
boolean
protected org.springframework.security.core.userdetails.UserDetails
retrieveUser
(String username, org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication) void
setIncludeDetailsObject
(boolean includeDetailsObject) Methods inherited from class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
afterPropertiesSet, authenticate, createSuccessAuthentication, doAfterPropertiesSet, getPostAuthenticationChecks, getPreAuthenticationChecks, getUserCache, isForcePrincipalAsString, isHideUserNotFoundExceptions, setAuthoritiesMapper, setForcePrincipalAsString, setHideUserNotFoundExceptions, setMessageSource, setPostAuthenticationChecks, setPreAuthenticationChecks, setUserCache, supports
-
Constructor Details
-
ReverseProxyAuthenticationProvider
public ReverseProxyAuthenticationProvider(ReverseProxyAuthenticator authenticator, ReverseProxyAuthoritiesPopulator authoritiesPopulator) Create an instance with the supplied authenticator and authorities populator implementations.- Parameters:
authenticator
- the authentication strategy (bind, password comparison, etc) to be used by this provider for authenticating users.authoritiesPopulator
- the strategy for obtaining the authorities for a given user after they've been authenticated.
-
ReverseProxyAuthenticationProvider
Creates an instance with the supplied authenticator and a null authorities populator. In this case, the authorities must be mapped from the user context.- Parameters:
authenticator
- the authenticator strategy.
-
-
Method Details
-
getAuthoritiesPopulator
-
additionalAuthenticationChecks
protected void additionalAuthenticationChecks(org.springframework.security.core.userdetails.UserDetails userDetails, org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication) throws org.springframework.security.core.AuthenticationException - Specified by:
additionalAuthenticationChecks
in classorg.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
- Throws:
org.springframework.security.core.AuthenticationException
-
createUserDetails
protected org.springframework.security.core.userdetails.UserDetails createUserDetails(ReverseProxyUserDetails user, String username, String password) Creates the finalUserDetails
object that will be returned by the provider once the user has been authenticated.The
ReverseProxyAuthoritiesPopulator
will be used to create the granted authorites for the user.Can be overridden to customize the creation of the final UserDetails instance. The default will merge any additional authorities retrieved from the populator with the propertis of original
ldapUser
object and set the values of the username and password.- Parameters:
user
- The intermediate LdapUserDetails instance returned by the authenticator.username
- the username submitted to the providerpassword
- the password submitted to the provider- Returns:
- The UserDetails for the successfully authenticated user.
-
retrieveUser
protected org.springframework.security.core.userdetails.UserDetails retrieveUser(String username, org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication) throws org.springframework.security.core.AuthenticationException - Specified by:
retrieveUser
in classorg.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
- Throws:
org.springframework.security.core.AuthenticationException
-
isIncludeDetailsObject
public boolean isIncludeDetailsObject() -
setIncludeDetailsObject
public void setIncludeDetailsObject(boolean includeDetailsObject)
-