-
1. Re: Flush security domain cache on sessionInvalidation
starksm64 Nov 26, 2005 7:52 PM (in response to anil.saldhana)The security layer update may also produce a more generic cache flush facility that integrates at a level above the standard session listener level.
-
2. Re: Flush security domain cache on sessionInvalidation
anil.saldhana Dec 22, 2005 5:51 PM (in response to anil.saldhana)Currently the JaasSecurityManagerService holds onto all the cached auth identity for security domains.
Are there any usecases where a generic cache flush will be suitable, over and above a flush at the session invalidation level? -
3. Re: Flush security domain cache on sessionInvalidation
starksm64 Dec 23, 2005 1:37 AM (in response to anil.saldhana)Sure, if there is a change to the user login info independent of a web app session backed by a session there can be a need to flush the cache.
-
4. Re: Flush security domain cache on sessionInvalidation
anil.saldhana Jan 5, 2006 3:52 PM (in response to anil.saldhana)Currently there is an injection of a proxy of type "JaasSecurityManagerMBean" into the tomcat service, which makes its way into the SecurityAssociationValve to provide an ability to flushAuthenticationCache on session validation.
This direct dependence on an MBean interface in the tomcat layer can be generalized to use an objectname such that any security service that can provide flushing, can be used in the tomcat layer.public class SecurityAssociationValve extends ValveBase { /** The service used to flush authentication cache on session invalidation. */ private JaasSecurityManagerServiceMBean secMgrService; }
The tomcat security layer should not be directly tied to a specific MBean interface. -
5. Re: Flush security domain cache on sessionInvalidation
starksm64 Jan 5, 2006 4:03 PM (in response to anil.saldhana)This requires a weakly typed contract between the tomcat layer and the flush service then. If there is not an interface then a weak jmx reflective call that hard codes the jmx method signature into the code is required. Dependence on an interface is better than dependence on a signature in my view.
-
6. Re: Flush security domain cache on sessionInvalidation
anil.saldhana Jan 5, 2006 4:23 PM (in response to anil.saldhana)Yes, a weakly typed reflective call is what I was thinking. We do have this pattern already in place with the LoginContext CallbackHandler needing a "setSecurityInfo" method.
-
7. Re: Flush security domain cache on sessionInvalidation
anil.saldhana Jan 5, 2006 4:28 PM (in response to anil.saldhana)The Valve already has a reference to the mbean server via the "mserver" attribute.
SecurityAssociationValve:: //private JaasSecurityManagerServiceMBean secMgrService; private ObjectName secMgrService; private void flushAuthenticationCache(String securityDomain, Principal authPrincipal) { try { mserver.invoke(secMgrService,"flushAuthenticationCache", new Object[] {securityDomain, authPrincipal}, new String[]{"java.lang.String", "java.security.Principal"}); } catch(JMException e) { log.debug("Error while flushingAuthenticationCache::" + e.getLocalizedMessage()); } }
-
8. Re: Flush security domain cache on sessionInvalidation
starksm64 Jan 5, 2006 4:32 PM (in response to anil.saldhana)The bigger problem is that this does not work reliably as background expiration of the session does not result in the cache getting flushed. Only if the session is invalidated during the request will it be flushed. The synchronization of the session and cache needs to be handled another way.
-
9. Re: Flush security domain cache on sessionInvalidation
anil.saldhana Jan 5, 2006 4:47 PM (in response to anil.saldhana)I was just pointing out the dependence of the tomcat layer on an MBean interface.
The session invalidation cache flush should be handled atleast by a sessionlistener instead of the valve as this JIRA issue suggests.
Regarding providing an higher level cache flushing facility, won't an externalized authentication manager service with flush capability suffice? Whether the flush happens at session invalidation or midway is external to the authentication service that maintains the cache. Or am I missing the picture? -
10. Re: Flush security domain cache on sessionInvalidation
starksm64 Jan 5, 2006 7:37 PM (in response to anil.saldhana)Yes, I'm inclined to incorporate the cache notion into the auth interfaces at least in terms of being able to flush all or a single instance.
-
11. Re: Flush security domain cache on sessionInvalidation
anil.saldhana Jan 12, 2006 3:08 PM (in response to anil.saldhana)When the session is destroyed, my sessionlistener can capture the event. It has information on the securitydomain via the webmetadata.
The question is should we flush the authenticationcache for the security domain? or for the last known authenticated principal? -
12. Re: Flush security domain cache on sessionInvalidation
starksm64 Jan 12, 2006 3:15 PM (in response to anil.saldhana)The flush can only be for the principal associated with the session.
-
13. Re: Flush security domain cache on sessionInvalidation
anil.saldhana Jan 13, 2006 3:33 PM (in response to anil.saldhana)Is it right to say that if the Jacc subject is available from the SubjectContextPolicyHandler, consider it before you think about the Active Subject from the security manager service?
Scott says: YES
-
14. Re: Flush security domain cache on sessionInvalidation
starksm64 Jan 13, 2006 3:55 PM (in response to anil.saldhana)Its should be as this is the only public api for accessing this info. The SecurityAssociation is documented as a non-public api so the SubjectContextPolicyHandler needs to be the stable api. Its not what it needs to be currently as seen in http://jira.jboss.com/jira/browse/JBAS-2551 so this is what I'm working on.