安全框架Spring Security 的配置文件 spring-security.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
<!-- 配置 favicon.ico不进行安全拦截-->
<http pattern="/favicon.ico" security="none"/>
<!-- 以下页面不被拦截 -->
<http pattern="/shoplogin.html" security="none"/>
<http pattern="/register.html" security="none"/>
<http pattern="/css/**" security="none"/>
<http pattern="/img/**" security="none"/>
<http pattern="/js/**" security="none"/>
<http pattern="/plugins/**" security="none"/>
<http pattern="/seller/add.do" security="none"/>

<!-- 页面拦截规则 -->
<http use-expressions="false">
<!--access 配置拥有访问权限用户 角色名称 :ROLE_****-->
<intercept-url pattern="/**" access="ROLE_SELLER"/>
<!--认访问页面 跳转页面 一直使用跳转页错误页面-->
<form-login login-page="/shoplogin.html"
default-target-url="/admin/index.html"
always-use-default-target="true"
authentication-failure-url="/shoplogin.html"/>
<!--csrf 开启防止跨站请求伪造-->
<csrf disabled="true"/>
<headers>
<!--frame页面只能为同源根目录下-->
<frame-options policy="SAMEORIGIN"/>
</headers>
<!--自动生成注销后的地址-->
<logout/>


</http>
<!--认证管理器-->
<authentication-manager>
<authentication-provider user-service-ref="UserDetailService">

</authentication-provider>
</authentication-manager>

<!--引用dubbo服务-->
<dubbo:application name="youlexuan-shop-web"/>
<dubbo:registry address="zookeeper://192.168.30.128:2181"/>
<dubbo:reference interface="com.offcn.sellergoods.service.SellerService" id="sellerService"/>

<!--加载自定义认证类-->
<beans:bean id="UserDetailService" class="com.offcn.service.UserDetailServiceImpl">
<beans:property name="sellerService" ref="sellerService"/>
</beans:bean>

</beans:beans>

相关文章

在网络请求时,总会有各种异常情况出现,我们需要提前处理这...
作者:宇曾背景软件技术的发展历史,从单体的应用,逐渐演进...
hello,大家好呀,我是小楼。最近一个技术群有同学at我,问我...
 一个软件开发人员,工作到了一定的年限(一般是3、4年左右...
当一个服务调用另一个远程服务出现错误时的外观Dubbo提供了多...
最近在看阿里开源RPC框架Dubbo的源码,顺带梳理了一下其中用...