You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Nariman (JIRA)" <ji...@apache.org> on 2010/04/24 23:19:50 UTC

[jira] Issue Comment Edited: (SHIRO-95) Specifying my own Cache in ShiroFilter not working

    [ https://issues.apache.org/jira/browse/SHIRO-95?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12860568#action_12860568 ] 

Nariman edited comment on SHIRO-95 at 4/24/10 5:19 PM:
-------------------------------------------------------

my solution to set cache name for securityManager is

<bean id="securityManager" class="my.pakage.SecurityManager">
        <!-- 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="enterpriseCacheSessionDAO" ref="enterpriseCacheSessionDAO"/>
        <property name="sessionListener">
            <bean class="com.azercell.servicecheck.security.ShiroSessionListener"/>
        </property>
    </bean>

    <bean id="enterpriseCacheSessionDAO" class="org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO">
         <property name="activeSessionsCacheName" value="activeDataCache"/>
    </bean>

and source file 

/**
 *
 * @author Nariman
 */
public class SecurityManager extends org.apache.shiro.web.DefaultWebSecurityManager{

    public SecurityManager(){
        super();
    }

    public void setEnterpriseCacheSessionDAO(EnterpriseCacheSessionDAO enterpriseCacheSessionDAO) {
        SessionManager sessionManager = this.getSessionManager();
        ((DefaultSessionManager)sessionManager).setSessionDAO(enterpriseCacheSessionDAO);
        }

    public void setSessionListener(SessionListener sessionListener){
        SessionManager sessionManager = this.getSessionManager();
        Collection<SessionListener> sessionListeners = new HashSet<SessionListener>();
        sessionListeners.add(sessionListener);
        ((DefaultSessionManager)sessionManager).setSessionListeners(sessionListeners);
    }

}

      was (Author: nariman):
    my solution to set cache name for securityManager is
 
/**
 *
 * @author Nariman
 */
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);
    }

}
  
> Specifying my own Cache in ShiroFilter not working
> --------------------------------------------------
>
>                 Key: SHIRO-95
>                 URL: https://issues.apache.org/jira/browse/SHIRO-95
>             Project: Shiro
>          Issue Type: Bug
>          Components: Configuration
>    Affects Versions: 1.0.0
>            Reporter: Andy Tripp
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> When I specify my own CacheManager and Cache object in my ShiroFilter, the default Cache manager is being used anyway. See thread "need help pluggin in my own session cache" in August and September 2009 archives of the Shiro mailing list for details.
> This is another order-of-operations issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.