Class KerberosLdapContextSource

java.lang.Object
org.springframework.ldap.core.support.AbstractContextSource
org.springframework.ldap.core.support.LdapContextSource
org.springframework.security.ldap.DefaultSpringSecurityContextSource
org.springframework.security.kerberos.client.ldap.KerberosLdapContextSource
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.ldap.core.ContextSource, org.springframework.ldap.core.support.BaseLdapPathContextSource, org.springframework.ldap.core.support.BaseLdapPathSource

public class KerberosLdapContextSource extends org.springframework.security.ldap.DefaultSpringSecurityContextSource implements org.springframework.beans.factory.InitializingBean
Implementation of an LdapContextSource that authenticates with the ldap server using Kerberos. Example usage:
  <bean id="authorizationContextSource" class="org.springframework.security.kerberos.ldap.KerberosLdapContextSource">
      <constructor-arg value="${authentication.ldap.ldapUrl}" />
      <property name="referral" value="ignore" />

       <property name="loginConfig">
           <bean class="org.springframework.security.kerberos.client.config.SunJaasKrb5LoginConfig">
               <property name="servicePrincipal" value="${authentication.ldap.servicePrincipal}" />
               <property name="useTicketCache" value="true" />
               <property name="isInitiator" value="true" />
               <property name="debug" value="false" />
           </bean>
       </property>
   </bean>

   <sec:ldap-user-service id="ldapUserService" server-ref="authorizationContextSource" user-search-filter="(| (userPrincipalName={0}) (sAMAccountName={0}))"
       group-search-filter="(member={0})" group-role-attribute="cn" role-prefix="none" />
 
See Also:
  • Field Summary

    Fields inherited from class org.springframework.security.ldap.DefaultSpringSecurityContextSource

    logger

    Fields inherited from class org.springframework.ldap.core.support.AbstractContextSource

    password, SUN_LDAP_POOLING_FLAG, userDn
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new kerberos ldap context source.
    Instantiates a new kerberos ldap context source.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected DirContext
     
    void
    The login configuration to get the serviceSubject from LoginContext

    Methods inherited from class org.springframework.ldap.core.support.AbstractContextSource

    assembleProviderUrlString, createContext, getAnonymousEnv, getAuthenticatedEnv, getAuthenticationSource, getBaseLdapName, getBaseLdapPath, getBaseLdapPathAsString, getContext, getContextFactory, getDirObjectFactory, getPassword, getReadOnlyContext, getReadWriteContext, getUrls, getUserDn, isAnonymousReadOnly, isPooled, setAnonymousReadOnly, setAuthenticationSource, setAuthenticationStrategy, setBase, setBaseEnvironmentProperties, setCacheEnvironmentProperties, setContextFactory, setDirObjectFactory, setPassword, setPooled, setReferral, setupAuthenticatedEnvironment, setUrl, setUrls, setUserDn

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • KerberosLdapContextSource

      public KerberosLdapContextSource(String url)
      Instantiates a new kerberos ldap context source.
      Parameters:
      url - the url
    • KerberosLdapContextSource

      public KerberosLdapContextSource(List<String> urls, String baseDn)
      Instantiates a new kerberos ldap context source.
      Parameters:
      urls - the urls
      baseDn - the base dn
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class org.springframework.ldap.core.support.AbstractContextSource
    • getDirContextInstance

      protected DirContext getDirContextInstance(Hashtable environment) throws NamingException
      Overrides:
      getDirContextInstance in class org.springframework.ldap.core.support.LdapContextSource
      Throws:
      NamingException
    • setLoginConfig

      public void setLoginConfig(Configuration loginConfig)
      The login configuration to get the serviceSubject from LoginContext
      Parameters:
      loginConfig - the login config