I found how to do it. but I think this not the best one. I added this code to
org.apache.shiro.mgt.SessionsSecurityManager class
public void setActiveSessionsCacheName(String activeSessionsCacheName) {
((CachingSessionDAO)((DefaultSessionManager)this.sessionManager).getSessionDAO()).setActiveSessionsCacheName(activeSessionsCacheName);
}
it makes possible to set this property in "securityManager" bean. like this
<bean id="securityManager"
class="org.apache.shiro.web.DefaultWebSecurityManager">
<property name="cacheManager" ref="cacheManager"/>
<property name="realm" ref="jdbcRealm"/>
<property name="sessionMode" value="native"/>
<property name="activeSessionsCacheName" value="activeDataCache"/>
</bean>
((CachingSessionDAO)((DefaultSessionManager)this.sessionManager).getSessionDAO()).setActiveSessionsCacheName(activeSessionsCacheName)
- can it be done in spring xml configuration? witout code modifing?
Narcom wrote:
>
> I was able to configure Shiro+Spring+Ehcache+SpringRemoting. everything is
> working fine. But I have problem with forcing Shiro to read ehcahe config
> from file with custom cache name. below my Spring app contex config
> example
>
> <bean id="securityManager"
> class="org.apache.shiro.web.DefaultWebSecurityManager">
> <property name="cacheManager" ref="cacheManager"/>
> <property name="realm" ref="jdbcRealm"/>
> <property name="sessionMode" value="native"/>
> </bean>
>
> <bean id="cacheManager"
> class="org.apache.shiro.cache.ehcache.EhCacheManager">
> <property name="cacheManagerConfigFile"
> value="file:${webapp.root}/WEB-INF/ehcache.xml"/>
> </bean>
>
> <bean id="jdbcRealm" class="com.springbook.MyWebRealm">
> <property name="authorizationCacheName" value="realmsCache"/>
> <property name="dataSource" ref="dataSource"/>
> <property name="credentialsMatcher">
> <bean
> class="org.apache.shiro.authc.credential.Sha256CredentialsMatcher">
> <property name="storedCredentialsHexEncoded"
> value="false"/>
> <property name="hashSalted" value="true"/>
> </bean>
> </property>
> </bean>
>
> I was able to force to read custom cache for "jdbcRealm" (see:
> authorizationCacheName property)
>
> but how I can do it for "securityManager". by deafault it create cache
> with some predefined way and setting. But I'd like to cutomise it behavior
>
--
View this message in context:
http://n2.nabble.com/Web-Spring-EhCache-how-to-change-default-cache-name-tp4063126p4068793.html
Sent from the Shiro User mailing list archive at Nabble.com.