xml Spring Security xml配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Spring Security xml配置相关的知识,希望对你有一定的参考价值。
<b:beans xmlns="http://www.springframework.org/schema/security"
xmlns:b="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
<http />
<b:bean id="passwordEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder" factory-method="getInstance"/>
<user-service>
<user name="user" password="password" authorities="ROLE_USER"/>
</user-service>
</b:beans>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/root-context.xml
/WEB-INF/security-context.xml
</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
以上是关于xml Spring Security xml配置的主要内容,如果未能解决你的问题,请参考以下文章
Spring Boot,Spring Security - 基于 XML 的配置
Java 配置中的 Spring Security XML 配置和 Spring SAML
Spring Security XML 配置与 Java 配置
如何通过 XML 配置仅针对特定 URL 模式在 Spring Security 4 中禁用 CSRF?
安全框架配置文件(spring-security.xml)
OpenID Connect 的 Spring Security 5 XML 配置