修改过的applicationContext-security.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:s="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-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"
default-lazy-init="true">

<description>SpringSecurity安全配置</description>

<!-- 方法安全配置 -->
<s:global-method-security secured-annotations="enabled"
jsr250-annotations="enabled" pre-post-annotations="enabled">
</s:global-method-security>
<!-- 方法安全配置结束 -->

<!-- http安全配置 -->
<!-- access-denied-page="" -->
<s:http auto-config="true" use-expressions="true">

<!-- login.action自动回去找login.jsp的-->
<!-- login-page登录页面 default-target-url登录成功以后跳转页面 authentication-failure-url认证失败的页面
<access-denied-handler>errorPage 提示没有权限的页面
springside不足1:
always-use-default-target = "true" 不写的话不能正常的跳转到default-target-url
-->
<s:form-login login-page="/manager/login.jsp"
default-target-url="/swp/mainPage" always-use-default-target="true"
authentication-failure-url="/manager/login.jsp?error=true" />
<s:logout logout-success-url="/" />

<!-- springside 不足2-->
<!-- session管理配置 -->
<s:session-management invalid-session-url="/common/timeout.jsp">
</s:session-management>
<!-- session管理配置结束 -->

<!-- 进行WEB安全配置 -->
<s:intercept-url pattern="/css/**" filters="none" />
<s:intercept-url pattern="/img/**" filters="none" />
<s:intercept-url pattern="/js/**" filters="none" />
<s:intercept-url pattern="/manager/login.jsp" filters="none" />
<s:intercept-url pattern="/manager/register.jsp" filters="none" />

<s:intercept-url pattern="/login"
access="hasAnyRole('ROLE_ADMIN')" />
<s:intercept-url pattern="/swp/*"
access="hasAnyRole('ROLE_ADMIN','ROLE_USER')" />
<s:intercept-url pattern="/manager/*"
access="hasAnyRole('ROLE_ADMIN')" />

<s:intercept-url pattern="/page"
access="hasAnyRole('ROLE_ADMIN')" />
<s:intercept-url pattern="/page/*"
access="hasAnyRole('ROLE_ADMIN')" />
<s:intercept-url pattern="/mod" access="hasAnyRole('ROLE_ADMIN')" />
<!-- WEB安全配置结束 -->
</s:http>

<!-- 认证配置, 使用userDetailsService提供的用户信息 -->
<s:authentication-manager alias="authenticationManager">
<s:authentication-provider
user-service-ref="userDetailsService">
<s:password-encoder hash="plaintext" />
</s:authentication-provider>
</s:authentication-manager>

<!-- 项目实现的用户查询服务 -->
<bean id="userDetailsService"
class="com.snda.swp.account.service.UserDetailsServiceImpl" />
</beans>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值