Class ReverseProxyAuthenticationProvider
- java.lang.Object
-
- org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider
-
- org.jenkinsci.plugins.reverse_proxy_auth.auth.ReverseProxyAuthenticationProvider
-
- All Implemented Interfaces:
AuthenticationProvider
public class ReverseProxyAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider
- Author:
- Wilder Rodrigues (wrodrigues@schubergphilis.com)
-
-
Constructor Summary
Constructors Constructor Description ReverseProxyAuthenticationProvider(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication)
protected 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
getAuthoritiesPopulator()
boolean
isIncludeDetailsObject()
protected UserDetails
retrieveUser(String username, UsernamePasswordAuthenticationToken authentication)
void
setIncludeDetailsObject(boolean includeDetailsObject)
-
Methods inherited from class org.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider
authenticate, supports
-
-
-
-
Constructor Detail
-
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
public ReverseProxyAuthenticationProvider(ReverseProxyAuthenticator authenticator)
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 Detail
-
getAuthoritiesPopulator
protected ReverseProxyAuthoritiesPopulator getAuthoritiesPopulator()
-
additionalAuthenticationChecks
protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException
- Specified by:
additionalAuthenticationChecks
in classAbstractUserDetailsAuthenticationProvider
- Throws:
AuthenticationException
-
createUserDetails
protected 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 UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException
- Specified by:
retrieveUser
in classAbstractUserDetailsAuthenticationProvider
- Throws:
AuthenticationException
-
isIncludeDetailsObject
public boolean isIncludeDetailsObject()
-
setIncludeDetailsObject
public void setIncludeDetailsObject(boolean includeDetailsObject)
-
-