Spring Security 2.0.6 使用 Active Directory 进行身份验证
我尝试使用 Ldap-Active Directory 和 Spring Security 2.0.6 进行身份验证。但不知道为什么认证没有通过...
在这里可以看到控制台:
> INFO [Server] JBoss (MX MicroKernel)
> [4.2.3.GA (build:
> SVNTag=JBoss_4_2_3_GA
> date=200807181439)] Started in
> 30s:118ms
>
> INFO [STDOUT] [WARN] Authentication
> event
> AuthenticationFailureBadCredentialsEvent:
> secretariauno1; details:
> org.springframework.security.ui.WebAuthenticationDetails@255f8:
> RemoteIpAddress: 127.0.0.1; SessionId:
> 1D1DEAD28D4AE44AF67277654889D73E;
> exception: User secretariauno1 not
> found in directory.
>
> INFO [STDOUT] [WARN] Authentication
> event
> AuthenticationFailureBadCredentialsEvent:
> secretariauno; details:
> org.springframework.security.ui.WebAuthenticationDetails@255f8:
> RemoteIpAddress: 127.0.0.1; SessionId:
> 1D1DEAD28D4AE44AF67277654889D73E;
> exception: Bad credentials; nested
> exception is
> org.springframework.ldap.AuthenticationException:
> [LDAP: error code 49 - 80090308:
> LdapErr: DSID-0C0903A9, comment:
> AcceptSecurityContext error, data 52e,
> v1db0
>
> INFO [STDOUT] [INFO] The
> returnObjFlag of supplied
> SearchControls is not set but a
> ContextMapper is used - setting flag
> to true
>
> INFO [STDOUT] [WARN] Authentication
> event
> AuthenticationFailureServiceExceptionEvent:
> secretariauno; details:
> org.springframework.security.ui.WebAuthenticationDetails@255f8:
> RemoteIpAddress: 127.0.0.1; SessionId:
> 1D1DEAD28D4AE44AF67277654889D73E;
> exception: Unprocessed Continuation
> Reference(s); nested exception is
> javax.naming.PartialResultException:
> Unprocessed Continuation Reference(s);
> remaining name ''; nested exception is
> org.springframework.ldap.PartialResultException:
> Unprocessed Continuation Reference(s);
> nested exception is
> javax.naming.PartialResultException:
> Unprocessed Continuation Reference(s);
> remaining name ''
有三个[WARN]
,第一个secretariauno1不在LDAP中。第二,密码错误。但第三个,很好,但没有通过。它返回到日志页面。我一直在寻找“returnObjFlag”和关于“剩余名称”而没有目标...
请,如果有人可以帮助我...,谢谢!
在这里你可以看到 applicationContext-security.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.xsd">
<bean id="loggerListener"
class="org.springframework.security.event.authentication.LoggerListener" />
<security:http>
<security:intercept-url pattern="/**" access="ROLE_USUARIO_AUTENTICADO" />
<security:intercept-url pattern="/login.jsp" filters="none"/>
<security:intercept-url pattern="/css/*" filters="none"/>
<security:form-login
login-processing-url="/j_security_check"
login-page="/login.jsp"
default-target-url="/index.jsp"
always-use-default-target="true"
authentication-failure-url="/login.jsp" />
<security:anonymous/>
<security:http-basic/>
<security:logout/>
</security:http>
<security:ldap-server id="ldapServer"
url="ldap://bibredc05.preadm.com:389/dc=preadm,dc=com"
manager-dn="cn=desLector,ou=Users,dc=preminjus,dc=es"
manager-password="pwd123"/>
<security:ldap-authentication-provider user-search-filter="(sAMAccountName={0})"
user-search-base="ou=Users"/>
<security:ldap-user-service server-ref="ldapServer"
user-search-filter="sAMAccountName={0}"
user-search-base="ou=Users"/>
</beans>
I have tried to put de authentication with Ldap-Active Directory and Spring Security 2.0.6. But I don't know why the authentication don't pass...
Here you can see the console:
> INFO [Server] JBoss (MX MicroKernel)
> [4.2.3.GA (build:
> SVNTag=JBoss_4_2_3_GA
> date=200807181439)] Started in
> 30s:118ms
>
> INFO [STDOUT] [WARN] Authentication
> event
> AuthenticationFailureBadCredentialsEvent:
> secretariauno1; details:
> org.springframework.security.ui.WebAuthenticationDetails@255f8:
> RemoteIpAddress: 127.0.0.1; SessionId:
> 1D1DEAD28D4AE44AF67277654889D73E;
> exception: User secretariauno1 not
> found in directory.
>
> INFO [STDOUT] [WARN] Authentication
> event
> AuthenticationFailureBadCredentialsEvent:
> secretariauno; details:
> org.springframework.security.ui.WebAuthenticationDetails@255f8:
> RemoteIpAddress: 127.0.0.1; SessionId:
> 1D1DEAD28D4AE44AF67277654889D73E;
> exception: Bad credentials; nested
> exception is
> org.springframework.ldap.AuthenticationException:
> [LDAP: error code 49 - 80090308:
> LdapErr: DSID-0C0903A9, comment:
> AcceptSecurityContext error, data 52e,
> v1db0
>
> INFO [STDOUT] [INFO] The
> returnObjFlag of supplied
> SearchControls is not set but a
> ContextMapper is used - setting flag
> to true
>
> INFO [STDOUT] [WARN] Authentication
> event
> AuthenticationFailureServiceExceptionEvent:
> secretariauno; details:
> org.springframework.security.ui.WebAuthenticationDetails@255f8:
> RemoteIpAddress: 127.0.0.1; SessionId:
> 1D1DEAD28D4AE44AF67277654889D73E;
> exception: Unprocessed Continuation
> Reference(s); nested exception is
> javax.naming.PartialResultException:
> Unprocessed Continuation Reference(s);
> remaining name ''; nested exception is
> org.springframework.ldap.PartialResultException:
> Unprocessed Continuation Reference(s);
> nested exception is
> javax.naming.PartialResultException:
> Unprocessed Continuation Reference(s);
> remaining name ''
There are three [WARN]
, the first secretariauno1 is not in LDAP. The second, the password is bad. But the thirds, is good and it don't pass. It return to loging page. I have looked for "returnObjFlag" and about "remaining name" without goals...
Please, if anyone can help me..., THANK YOU!!!
Here you can see tha applicationContext-security.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.xsd">
<bean id="loggerListener"
class="org.springframework.security.event.authentication.LoggerListener" />
<security:http>
<security:intercept-url pattern="/**" access="ROLE_USUARIO_AUTENTICADO" />
<security:intercept-url pattern="/login.jsp" filters="none"/>
<security:intercept-url pattern="/css/*" filters="none"/>
<security:form-login
login-processing-url="/j_security_check"
login-page="/login.jsp"
default-target-url="/index.jsp"
always-use-default-target="true"
authentication-failure-url="/login.jsp" />
<security:anonymous/>
<security:http-basic/>
<security:logout/>
</security:http>
<security:ldap-server id="ldapServer"
url="ldap://bibredc05.preadm.com:389/dc=preadm,dc=com"
manager-dn="cn=desLector,ou=Users,dc=preminjus,dc=es"
manager-password="pwd123"/>
<security:ldap-authentication-provider user-search-filter="(sAMAccountName={0})"
user-search-base="ou=Users"/>
<security:ldap-user-service server-ref="ldapServer"
user-search-filter="sAMAccountName={0}"
user-search-base="ou=Users"/>
</beans>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决了
好吧,最后我已经迁移到 Spring Security 3.0.4。问题是您必须使用 bean 定义,因为 Active Directory 需要 Populator bean。
Resolved
Well, finally I have migrated to Spring Security 3.0.4. The problem was that you have to use the beans definition because Active Directory need the Populator bean.
也许此链接可以帮助您。这个问题有一个可能的原因。
这可能是由于需要遵循推荐搜索。
此链接 还与配置引用的一种方法相关。
Perhaps this link could help you. There is a possible reason for the problem.
It is probably due to a need to follow referral searches.
This link is also related on one way to configure referral.