是否可以使用名称空间配置在 Spring security 中提及基于表单的身份验证和基本身份验证,而不覆盖其他身份验证?这样应用程序就可以为基于浏览器的请求和远程客户端提供服务。
The @grimesjm 的回应是对的。但是,如果您使用 Spring 3.x,则必须将类名称调整为:
<bean id="basicProcessingFilter" class="org.springframework.security.web.authentication.www.BasicAuthenticationFilter">
<property name="authenticationManager">
<ref bean="authenticationManager" />
</property>
<property name="authenticationEntryPoint">
<ref bean="authenticationEntryPoint" />
</property>
</bean>
<bean id="authenticationEntryPoint"
class="org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint">
<property name="realmName" value="Your realm here" />
</bean>
And
<sec:http auto-config="true">
... your intercept-url here
<sec:custom-filter before="SECURITY_CONTEXT_FILTER" ref="basicProcessingFilter" />
<sec:form-login ... />
....
</sec:http>
不知道之前是否加了滤镜SECURITY_CONTEXT_FILTER
是最好的选择还是不是。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)