2012-09-06 2 views
2

내가 LDAP에 인증하고 데이터베이스에 대해 인증 된 사용자에게 권한을 설정하는 Spring Security 프로젝트를 가질 수 있습니까?Spring Security에서 LDAP 인증과 데이터베이스 인증을하는 방법

감사합니다.

+0

스택 오버플로에 오신 것을 환영합니다! [귀하의 질문을 연구하십시오] (http://stackoverflow.com/questions/how-to-ask). [이미 시도한 것] (http://whathaveyoutried.com/)이 있으면 질문에 추가하십시오. 아니라면 질문을 먼저 연구하고 시도한 다음 다시 방문하십시오. –

답변

0

예, LdapBindAuthenticator 및 DAO 기반 AuthoritiesPopulator이 필요합니다. 나는 이것에 대한 해결책을 달성 한

1

는 대답은 위의 cames : 클래스 MyLDAPAuthorities에

<authentication-manager > 
    <authentication-provider ref="ldapAuthProvider" />    
</authentication-manager> 


<beans:bean id="contextSource" 
    class="org.springframework.security.ldap.DefaultSpringSecurityContextSource">   
<beans:constructor-arg value="ldap://IP:port/...."/> 

</beans:bean> 

<beans:bean id="ldapAuthProvider" 
    class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider"> 
    <beans:constructor-arg> 
    <beans:bean class="org.springframework.security.ldap.authentication.BindAuthenticator"> 
    <beans:constructor-arg ref="contextSource"/> 
    <beans:property name="userSearch" ref="ldapUserSearch" /> 
    </beans:bean> 
    </beans:constructor-arg> 
    <beans:constructor-arg> 
    <beans:bean 
    class="prpa.athos.security.listener.MyLDAPAuthorities"> 
    </beans:bean> 
    </beans:constructor-arg> 
    </beans:bean> 
    <beans:bean id="authenticationSuccessListener" 
    class="prpa.athos.security.listener.AuthenticationSuccessListener"> 
    </beans:bean>   
    <beans:bean id="ldapUserSearch" 
    class="org.springframework.security.ldap.search.FilterBasedLdapUserSearch"> 
    <beans:constructor-arg index="0" value=""/> 
    <beans:constructor-arg index="1" value="(uid={0})"/> 
    <beans:constructor-arg index="2" ref="contextSource" /> 
    </beans:bean> 

나는 당국이 데이터베이스를 형성 점점 클라쎄 LdapAuthoritiesPopulator을 구현합니다.

관련 문제