之前那篇文章介绍了普通web项目中单点登录cas与权限管理框架shiro集成方式,这里说下spring项目中的集成方式,首先还是配置一个filter
[html]
然后就是shiro的spring bean配置,其实就是把之前的shiro.ini的东西配成spring的bean,shiro-config.xml文件如下:
[html]
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd"
default-lazy-init="true">
/shiro-cas = casFilter
/admin/** = roles[ROLE_USER]
/** = anon
摘自laigood12345的专栏