【发布时间】:2013-01-13 01:16:34
【问题描述】:
我有这样的配置:
<security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="/index.jsp" access="isAuthenticated()"/>
<security:http-basic/>
</security:http>
然后,BasicAuthenticationFilter
<bean id="basicAuthenticationFilter"
class="org.springframework.security.web.authentication.www.BasicAuthenticationFilter">
<property name="authenticationEntryPoint" ref="BauthenticationEntryPoint"/>
<property name="authenticationManager" ref="BauthenticationManager"/>
</bean>
入口点和经理是这样描述的:
<bean id="BauthenticationEntryPoint" class="org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint">
<property name="realmName" value="Name Of Your Realm"/>
</bean>
<bean id="BauthenticationManager" class="org.springframework.security.authentication.ProviderManager">
<property name="providers">
<list>
<ref local="ldapAuthProvider"/>
</list>
</property>
</bean>
最后
<bean id="ldapAuthProvider"
class="org.springframework.security.ldap.authentication.LdapAuthenticationProvider">
<constructor-arg>
<bean class="org.springframework.security.ldap.authentication.BindAuthenticator">
<constructor-arg ref="contextSource"/>
<property name="userDnPatterns">
<list>
<value>sAMAccountName={0}</value>
</list>
</property>
</bean>
</constructor-arg>
<constructor-arg>
<bean
class="org.springframework.security.ldap.userdetails.DefaultLdapAuthoritiesPopulator">
<constructor-arg ref="contextSource"/>
<constructor-arg value=""/>
</bean>
</constructor-arg>
</bean>
当我尝试访问 /index.jsp 时,我显示了一个 stadart http auth 窗口,该窗口要求我输入用户名和密码。当我将其输入表单并按 Enter 时,什么也没有发生 - 身份验证窗口只是重新加载,仅此而已。
我在哪里做错了? 谢谢。
【问题讨论】:
-
为 org.springframework.security 包启用调试日志并显示异常。
-
在认证过程本身似乎没有异常。也许我没有启用调试日志记录?我该怎么做?谢谢
-
如果我在身份验证窗口中点击取消按钮,当然会显示消息“错误 401: No AuthenticationProvider found for org.springframework.security.authentication.UsernamePasswordAuthenticationToken”
-
我添加
现在我得到一个错误 401: Bad credentials跨度> -
表示您的登录名/密码组合错误
标签: spring-security ldap basic-authentication