Skip to content

Instantly share code, notes, and snippets.

@mente
Created September 7, 2011 08:40
Show Gist options
  • Save mente/1200071 to your computer and use it in GitHub Desktop.
Save mente/1200071 to your computer and use it in GitHub Desktop.
web application definition
<?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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"
p:securityManager-ref="webSecurityManager"
p:loginUrl="/login"
p:successUrl="/accounts/profile">
<property name="filterChainDefinitions">
<value>
/accounts/profile = authc
#/upload = authcBasic
/login = authc
</value>
</property>
</bean>
<bean id="webRealm" parent="onyxRealm"
p:name="web">
<property name="credentialsMatcher">
<bean class="org.apache.shiro.authc.credential.HashedCredentialsMatcher"
p:hashAlgorithmName="MD5" />
</property>
</bean>
<bean id="webSecurityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager" parent="securityManager"
p:sessionMode="native"
p:realm-ref="webRealm">
<property name="sessionManager">
<bean class="org.apache.shiro.web.session.mgt.DefaultWebSessionManager"
p:sessionDAO-ref="coreSessionDAO" />
</property>
</bean>
<bean id="webLifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="org.apache.shiro.SecurityUtils.setSecurityManager"/>
<property name="arguments" ref="webSecurityManager"/>
</bean>
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment