首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

shiro (2) spring结合

2012-11-19 
shiro (二) spring结合??xml version1.0 encodingUTF-8?beans xmlnshttp://www.springframewor

shiro (二) spring结合

?

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

? ? ? ?xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

? ? ? ?xmlns:aop="http://www.springframework.org/schema/aop"

? ? ? ?xmlns:tx="http://www.springframework.org/schema/tx"

? ? ? ?xmlns:util="http://www.springframework.org/schema/util"

? ? ? ?xmlns:context="http://www.springframework.org/schema/context"

? ? ? ?xsi:schemaLocation="

? ? ? ?http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

? ? ? ?http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd

? ? ? ?http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd

? ? ? ?http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd

? ? ? ?http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

?

<description>Shiro Configuration</description>

<!-- <context:property-placeholder location="classpath:*.properties" />-->

<context:component-scan base-package="com.miv.shiro.*.service" />?

<bean id="WebRealm" ref="loginService" />?

<property name="rolesService" ref="rolesService" />?

</bean>

? ? <bean ?id="cacheManager" ref="cacheManager"/>

<!--

Single realm app (realm configured next, below). If you have multiple

realms, use the 'realms' property instead.

-->

<property name="realm" ref="WebRealm" />

<!--

Uncomment this next property if you want heterogenous session access

or clusterable/distributable sessions. The default value is 'http'

which uses the Servlet container's HttpSession as the underlying

Session implementation. <property name="sessionMode" value="native"/>

-->

</bean>

?

<!--

Post processor that automatically invokes init() and destroy() methods

-->

<bean id="lifecycleBeanPostProcessor" />

?

<!--

Define the Shiro Filter here (as a FactoryBean) instead of directly in

web.xml - web.xml uses the DelegatingFilterProxy to access this bean.

This allows us to wire things with more control as well utilize nice

Spring things such as PropertiesPlaceholderConfigurer and abstract

beans or anything else we might need:

-->

<bean id="shiroFilter" ref="securityManager" />

<property name="loginUrl" value="/login/init" />

<property name="successUrl" value="/index" />

<property name="unauthorizedUrl" value="/login/error" />

<property name="filters">

? ? ? ? ? ? <util:map>

? ? ? ? ? ? ? ? <entry key="authc">

? ? ? ? ? ? ? ? ? ? <bean class="org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter"/>

? ? ? ? ? ? ? ? </entry>

? ? ? ? ? ? ? ?<entry key="miv">

? ? ? ? ? ? ? ? ? ? <bean class="com.miv.shiro.common.MIVshiroFilter"/>

? ? ? ? ? ? ? ? </entry>

? ? ? ? ? ? </util:map>

? ? ? ? </property>

<property name="filterChainDefinitions">

<value>?

? ?/login/** = anon

/resources/** = anon

/userPortal/** = miv["user"]

/userportal/** = miv["user"]

/agencyPortal/user/checkUnique = miv["agency","user"]

/agencyPortal/** = ?miv["agency"]

/agencyportal/** = ?miv["agency"]

/callcenterPortal/** = ?miv["callCenter"]

/callcenterportal/** = ?miv["callCenter"]

/** = anon

? ? ? ? ? ? </value>

</property>

</bean>

</beans>

热点排行