我在测试的项目上引进了spring security 基于名称空间配置的安全架构,遇到一个问题,请指教下!
配置代码如下:
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd">
<global-method-security secured-annotations="enabled">
</global-method-security>
<http access-denied-page="/error.jsp" session-fixation-protection="newSession" auto-config="true" path-type="ant" ><!--session-fixation-protection属性可以防止session固定攻击 -->
<!-- 权限入口的顺序十分重要,注意必须把特殊的URL权限写在一般的URL权限之前。 -->
<intercept-url pattern="/acegiTest.do" access="ROLE_SUPERVISOR"/>
<intercept-url pattern="/index.jsp" access="IS_AUTHENTICATED_REMEMBERED" />
<intercept-url pattern="/role1.jsp" access="ROLE_USER_1"/>
<intercept-url pattern="/role2.jsp" access="ROLE_USER_2"/>
<intercept-url pattern="/role3.jsp" access="ROLE_USER_3"/>
<intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<!--
x509认证
<x509 />
-->
<!-- All of this is unnecessary if auto-config="true"
<form-login />
<anonymous />
<http-basic />
<logout />
<remember-me /> -->
<form-login login-page="/login.jsp" default-target-url="/index.jsp" authentication-failure-url="/login.jsp?login_error=1" />
<anonymous key="cookie_key" username="ananoymous" granted-authority="IS_AUTHENTICATED_ANONYMOUSLY"/>
<logout invalidate-session="true" />
<!-- session并发控制
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="true"/>
-->
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="false" /><!-- exception-if-maximum-exceeded="true" 第二次登入失效 -->
</http>
<authentication-provider >
<password-encoder hash="md5"/><!-- 密码md5加密 -->
<jdbc-user-service data-source-ref="f3CenterDS"
users-by-username-query="select name as 'username',password,'true' from users where name = ?"
authorities-by-username-query="select name as 'username',authorities as 'authority' from authentication where name =?"
/>
</authentication-provider>
</beans:beans>
在代码中
authorities-by-username-query="select name as 'username',authorities as 'authority' from authentication where name =?"
,如果数据库里分配多个权限给用户的话,用户登入系统就不能正常使用(不能访问),倘若只分配一个权限则可以正常访问,还请指教一二!!!
分享到:
相关推荐
电大职业技能实训版计算机网络技术网络管理方向专业网站美工设计基础形成性考核答案.doc
计算机等级考试一级练习题解析.doc
机械设备电气控制(含PLC)(B)答案.doc
利用综合测评板以及若干电阻、电容元件设计制作电路,以产生以下四路信号: 幅度不小于3.2V,频率在19kHz到21kHz范围内连续可调的方波脉冲信号。 与方波脉冲信号同频率的正弦波信号,要求其输出电压失真度不超过5%,峰峰值(VPP)不低于1V。 与方波脉冲信号同频率且占空比在5%到15%之间连续可调的窄脉冲信号,幅度不小于3.2V。 与正弦波信号相交的余弦波信号,相位误差不超过5°,输出电压峰峰值(VPP)不小于1V。 所有信号的输出端均需连接1kΩ负载电阻(RL),并将各路信号输出连接至测评板的指定位置。同时,需在引线处贴上对应输出信号的标签,以便于后续测试。
【目标检测】榴莲叶片病害数据集1410张YOLO-VOC格式.docx
火力发电厂机组级检修项目管理标准分析.doc
自考电子商务法概论模拟试卷.doc
数据集介绍 本数据集旨在根据品牌商家的历史订单数据,构建一个预测模型,预估用户人群在规定时间内产生购买行为的概率。
电子商务管理课程实验指导书.doc
湘潭大学移动通信实验报告实验6GSM及GPRS移动台短消息发送及接收实验.docx
网络规划与组建实训指导.doc
网络服务平台电商服务平台合作协议书.doc
【目标检测】4种铁轨表面缺陷检测数据集4020张YOLO+VOC格式.docx
罗克韦尔自动化能源管理系统概述.docx
【目标检测】空中小目标无人机检测数据集840张YOLO+VOC.docx
计算机信息系统集成资质等级评定条件(修定版).doc
自考计算机应用管理信息系统开发.doc
【目标检测】80种手语检测数据集9648张YOLO+VOC.docx
电大计算机应用基础操作题解题步骤.docx
硕士软件工程重点单项选择和判断题答案.doc