gpt4 book ai didi

spring-security - Spring security - 如何同时提及基于表单的身份验证和基本身份验证

转载 作者:行者123 更新时间:2023-12-04 04:10:55 26 4
gpt4 key购买 nike

是否可以使用命名空间配置在 Spring 安全性中提及基于表单和基本身份验证而不覆盖其他?这样应用程序可以为基于浏览器的请求和远程客户端提供服务。

最佳答案

response by @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>

并且
<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是不是最好的选择。

关于spring-security - Spring security - 如何同时提及基于表单的身份验证和基本身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1297243/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com