spring验证文件(spring-security.xml)

本文介绍了一个 Spring MVC 项目的配置文件示例,详细展示了如何使用权限拦截器来控制对特定 URL 的访问,并列举了不需要权限验证的路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

    <mvc:interceptors>
        <!-- 权限拦截器 -->
        <mvc:interceptor>
            <mvc:mapping path="/**" />
            <bean class="com.xu.interceptors.SecurityInterceptor">
                <!-- 不需要权限验证的地址 -->
                <property name="noAuthURL">
                    <list>
                        <value>/user/rolePage</value><!-- 获取自己的角色 -->
                        <value>/user/permissionsPage</value><!-- 获取自己的权限 -->
                        <value>/user/getMenus</value><!-- 获取自己的菜单 -->
                        <value>/dic/comBoxData</value><!-- 获取下拉框信息 -->
                        
                    </list>
                </property>
                <property name="noSessionURL">
                    <list>
                        <value>/user/login</value><!-- 用户登录 -->
                        <value>/user/logout</value><!-- 注销登录 -->
                    </list>
                </property>
            </bean>
        </mvc:interceptor>
        
        <!-- 配置Token拦截器,防止用户重复提交数据 -->
        <!-- <mvc:interceptor>
            <mvc:mapping path="/**"/>
            <bean class="com.xu.util.TokenInterceptor"/>
        </mvc:interceptor> -->
    </mvc:interceptors>
</beans>
PS F:\workdata\115_project> mvn dependency:tree | findstr "security" [INFO] +- org.springframework.boot:spring-boot-starter-security:jar:3.3.5:compile [INFO] | +- org.springframework.security:spring-security-config:jar:6.3.4:compile [INFO] | | \- org.springframework.security:spring-security-core:jar:6.3.4:compile [INFO] | | \- org.springframework.security:spring-security-crypto:jar:6.3.4:compile [INFO] | \- org.springframework.security:spring-security-web:jar:6.3.4:compile [INFO] | +- org.springframework.boot:spring-boot-starter-security:jar:3.3.5:compile [INFO] | | +- org.springframework.security:spring-security-config:jar:6.3.4:compile [INFO] | | | \- org.springframework.security:spring-security-core:jar:6.3.4:compile [INFO] | | | \- org.springframework.security:spring-security-crypto:jar:6.3.4:compile [INFO] | | \- org.springframework.security:spring-security-web:jar:6.3.4:compile [INFO] | +- org.springframework.boot:spring-boot-starter-security:jar:3.3.5:compile [INFO] | | +- org.springframework.security:spring-security-config:jar:6.3.4:compile [INFO] | | | \- org.springframework.security:spring-security-crypto:jar:6.3.4:compile [INFO] | | \- org.springframework.security:spring-security-web:jar:6.3.4:compile Downloading from public: https://maven.aliyun.com/repository/public/org/eclipse/jetty/jetty-security/12.0.14/jetty-security-12.0.14.pom Downloaded from public: https://maven.aliyun.com/repository/public/org/eclipse/jetty/jetty-security/12.0.14/jetty-security-12.0.14.pom (5.2 kB at 26 kB/s) [INFO] | +- org.springframework.boot:spring-boot-starter-security:jar:3.3.5:compile [INFO] | | +- org.springframework.security:spring-security-config:jar:6.3.4:compile [INFO] | | \- org.springframework.security:spring-security-web:jar:6.3.4:compile [INFO] | | +- org.springframework.security:spring-security-core:jar:6.3.4:compile [INFO] | +- org.eclipse.jetty:jetty-security:jar:12.0.14:compile [INFO] | | +- org.springframework.boot:spring-boot-starter-security:jar:3.3.5:compile [INFO] | | | +- org.springframework.security:spring-security-config:jar:6.3.4:compile [INFO] | | | \- org.springframework.security:spring-security-web:jar:6.3.4:compile [INFO] | | +- org.springframework.security:spring-security-core:jar:6.3.4:compile [INFO] | +- org.eclipse.jetty:jetty-security:jar:12.0.14:compile PS F:\workdata\115_project>
最新发布
07-26
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值