as I think "right way" to configure ehcache
extend DefaultWebSecurityManager like this:
public class SecurityManager extends
org.apache.shiro.web.DefaultWebSecurityManager{
public SecurityManager(){
super();
}
public void setActiveSessionsCacheName(String activeSessionsCacheName) {
SessionManager sessionManager = this.getSessionManager();
((CachingSessionDAO)((DefaultSessionManager)sessionManager).getSessionDAO()).setActiveSessionsCacheName(activeSessionsCacheName);
}
}
init ehcache manager
<bean id="cacheManager"
class="org.apache.shiro.cache.ehcache.EhCacheManager">
<property name="cacheManagerConfigFile"
value="file:${webapp.root}/WEB-INF/ehcache.xml"/>
</bean>
and make security manager and "realm" use your preconfigured ehcache
<bean id="jdbcRealm" class="com.springbook.MyWebRealm">
<property name="cacheManager" ref="cacheManager"/>
<property name="authorizationCacheName" value="realmsCache"/>
<property name="dataSource" ref="dataSource"/>
<property name="credentialsMatcher">
<!-- The 'bootstrapDataPopulator' Sha256 hashes the password
(using the username as the salt) then base64 encodes it:
-->
<bean
class="org.apache.shiro.authc.credential.Sha256CredentialsMatcher">
<!-- true means hex encoded, false means base64 encoded -->
<property name="storedCredentialsHexEncoded" value="false"/>
<!-- We salt the password using the username, the most
common practice: -->
<property name="hashSalted" value="true"/>
</bean>
</property>
</bean>
<bean id="securityManager" class="com.springbook.shiro.SecurityManager">
<property name="cacheManager" ref="cacheManager" />
<!-- Single realm app. If you have multiple realms, use the
'realms' property instead. -->
<property name="realm" ref="jdbcRealm" />
<property name="sessionMode" value="native" />
<!--property name="sessionMode" value="http"/-->
<property name="activeSessionsCacheName" value="activeDataCache" />
</bean>
--
View this message in context:
http://n2.nabble.com/Web-Spring-EhCache-how-to-change-default-cache-name-tp4063126p4096087.html
Sent from the Shiro User mailing list archive at Nabble.com.