[jboss-jira] [JBoss JIRA] Commented: (JBAS-6449) InvokerAdaptorService overwrites existing SecurityContext and clears it after invocation

Richard Kennard (JIRA) jira-events at lists.jboss.org
Sun Jun 21 21:32:57 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBAS-6449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12473173#action_12473173 ] 

Richard Kennard commented on JBAS-6449:
---------------------------------------

Confirming this bug still in 5.1.0.GA. It's very bad, as it makes it next to impossible to, say, check the depth of a queue...

RMIAdaptor server = (RMIAdaptor) new InitialContext().lookup( EjbUtils.lookupEnv( "core/jmx-connection" ) );
ObjectName objectName = new ObjectName( "jboss.messaging.destination:service=Queue,name=" + queue );
int queueDepth = 0;(Integer) server.getAttribute( objectName, "MessageCount" );

...this code works, but subsequent calls to EJBs all fail because the last line (server.getAttribute) clears the security context.

Is there a workaround?

> InvokerAdaptorService overwrites existing SecurityContext and clears it after invocation
> ----------------------------------------------------------------------------------------
>
>                 Key: JBAS-6449
>                 URL: https://jira.jboss.org/jira/browse/JBAS-6449
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: JBossAS-5.0.0.GA
>         Environment: Windows Vista, JBoss 5.0.0 GA
>            Reporter: Michael Gronau
>
> The InvokerAdaptorService always creates a new SecurityContext even if there is already one created by components called earlier in invocation stack. After invoking the desired MBean method the SecurityContext will be cleared with a call to: SecurityActions.clearSecurityContext();
> This leads to several problems:
> In our project we have a secured EJB (annotated with @SecurityDomain) which is calling an MBean Service and a local (secured) EJB. After the invocation of the mbean there is no security context anymore which leads to an IllegalStateException "Security Context has not been set" thrown by RoleBasedAuthorizationInterceptorv2) when we try to call the local EJB.
> Following steps are possible to fix the problem:
> 1. call to SecurityActions.getSecurityContext();
> 2. if there is currently no SecurityContext create a new one and set it.
> 3. if there already is a SecurityContext set, do nothing.
> 4. call the mbean method.
> 5. only if we created the SecurityContext, we should clear it with SecurityActions.clearSecurityContext(), otherwise, do nothing.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list