码迷,mamicode.com
首页 > 编程语言 > 详细

安全框架配置文件(spring-security.xml)

时间:2019-09-03 09:42:10      阅读:82      评论:0      收藏:0      [点我收藏+]

标签:java   sch   form   ssi   exp   utf-8   user   可以登录   get   

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:security="http://www.springframework.org/schema/security"
       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">
    <!--对登录和失败页面放行-->
    <security:http pattern="/login.jsp" security="none"></security:http>
    <security:http pattern="/error.jsp" security="none"></security:http>
    <security:http pattern="/favicon.ico" security="none"></security:http>
    <security:http pattern="/css/**" security="none"></security:http>
    <security:http pattern="/img/**" security="none"></security:http>
    <security:http pattern="/plugins/**" security="none"></security:http>

    <security:http auto-config="true" use-expressions="false">
        <security:intercept-url pattern="/**" access="ROLE_USER"/>

        <!--页面的具体跳转-->
        <security:form-login login-page="/login.jsp"
                             login-processing-url="/login"
                             default-target-url="/index.jsp"
            ></security:form-login>

        <security:csrf disabled="true"/>
        <!--退出-->
        <security:logout invalidate-session="true" logout-url="/logout" logout-success-url="/login.jsp"/>
    </security:http>
    <!--配置默认可以登录的账户密码-->
    <security:authentication-manager>
        <security:authentication-provider>
            <security:user-service>
                <security:user name="ding" password="{noop}ding" authorities="ROLE_USER" />
            </security:user-service>
        </security:authentication-provider>
    </security:authentication-manager>
</beans>

  

安全框架配置文件(spring-security.xml)

标签:java   sch   form   ssi   exp   utf-8   user   可以登录   get   

原文地址:https://www.cnblogs.com/Hubert-dzl/p/11450927.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!