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

    Constructors
    Constructor
    Description
    Creates an instance with the supplied authenticator and a null authorities populator.
    Create an instance with the supplied authenticator and authorities populator implementations.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    additionalAuthenticationChecks(org.springframework.security.core.userdetails.UserDetails userDetails, org.springframework.security.authentication.UsernamePasswordAuthenticationToken authentication)
     
    protected org.springframework.security.core.userdetails.UserDetails
    Creates the final UserDetails object that will be returned by the provider once the user has been authenticated.
     
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      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 Details

    • getAuthoritiesPopulator

      protected ReverseProxyAuthoritiesPopulator 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 class org.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 final UserDetails 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 provider
      password - 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 class org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider
      Throws:
      org.springframework.security.core.AuthenticationException
    • isIncludeDetailsObject

      public boolean isIncludeDetailsObject()
    • setIncludeDetailsObject

      public void setIncludeDetailsObject(boolean includeDetailsObject)