Announcement Announcement Module
Collapse
No announcement yet.
Authentication ActiveDirectory Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Authentication ActiveDirectory

    Hi,

    I am loging to Microsoft Active Directory 2003 and Im using Spring Security 3.0.0.RELEASE.

    My spring-security-context.xml is:

    Code:
    <beans:bean id="myLdapContextSource" class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">
            <beans:constructor-arg value="ldap://10.168.1.122:389/dc=ssa,dc=com"/>
            <property name="userDn" value="cn=Administrator,cn=Users,dc=ssa,dc=com"/>
            <property name="password" value="mainview"/>
        </beans:bean>
    
    
         <beans:bean id="ldapUserSearch" class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch">
          <beans:constructor-arg index="0" value="cn=Users"/>
          <beans:constructor-arg index="1" value="(sAMAccountName={0})"/>
          <beans:constructor-arg index="2" ref="myLdapContextSource" />
          <property name="searchSubtree" value="false"/>
        </beans:bean> 
        
         <beans:bean class="com.packtpub.springsecurity.security.SimpleRoleGrantingLdapAuthoritiesPopulator" id="ldapAuthoritiesPopulator"/>
        
        <beans:bean id="userDetailsService" class="org.springframework.security.ldap.userdetails.LdapUserDetailsService">
            <beans:constructor-arg index="0" ref="ldapUserSearch" />
            <beans:constructor-arg index="1" ref="ldapAuthoritiesPopulator" />
        </beans:bean>
        
        <authentication-manager alias="authenticationManager" >
        <authentication-provider  user-service-ref='userDetailsService' >
        
            
        </authentication-provider>
        </authentication-manager>
    UserDn login is Ok, but when I login other users show exception BadCredentialsException (class DaoAuthenticationProvider ):
    Code:
    if (!passwordEncoder.isPasswordValid(userDetails.getPassword(), presentedPassword, salt)) {
                throw new BadCredentialsException(messages.getMessage(
                        "AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"),
                        includeDetailsObject ? userDetails : null);
            }
    Because when I debuged app and I noticed that userDetails.getPassword() is null!!
    The credentials from user is not null. From java application user login is OK.

    Any ideas please?

    Thanks.

  • #2
    Please do a search of the forum before posting. For example this thread explains that you can't read passwords from AD. So what you have won't work.

    You should also be using the latest version to make sure you have the latest bug fixes, and because 3.0.0 has a reported security vulnerability.

    Comment

    Working...
    X