你能给我一些链接或解决方案来管理我的问题吗?问题如下。我有一个 LDAP 服务器。如何通过此 LDAP 服务器进行 http 基本授权?
提前谢谢。
您需要设置两个不同的 Spring 安全性特征:
- LDAP 身份验证。此处描述的实际配置。
- HTTP 基本身份验证。此处介绍了此功能。
谢谢。我做了这样的配置:
<security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="/index.jsp" access="isAuthenticated()"/>
<security:http-basic/>
</security:http>
然后,基本身份验证过滤器
<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 身份验证窗口,请求我的用户名和密码。当我将其输入表单并按 Enter 时,什么都没有发生 - 身份验证窗口只是重新加载,仅此而已。
我哪里犯了错误?谢谢。