Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-2311

getUserRoles via JaasSecurityManagerService didn't work (was OK in 4.0.1)

XMLWordPrintable

      A call to the JaasSecurityManagerService and calling the
      getUserRoles(...) method of the org.jboss.security.plugins.JaasSecurityManager
      will return null instead of the Set of roles.

      ((RMIAdaptor) ctx.lookup("/jmx/rmi/RMIAdaptor")).invoke(
      new ObjectName("jboss.security:service=JaasSecurityManager"), "getUserRoles", args, types);

      This was OK in JBoss 4.0.1

      The reason was in the org.jboss.jmx.connector.invoker.InvokerAdaptorService
      at the statement

      // Associate the method
      SecurityActions.pushSubjectContext(principal, credential, null);

      which pushes null as the ActiveSubject.

      With following code change i have fixed the problem temporary.

      java.security.PrivilegedAction pa = new java.security.PrivilegedAction() {
      public Object run()

      { Subject subject = org.jboss.security.SecurityAssociation.getSubject(); return subject; }

      };

      javax.security.auth.Subject subj = (javax.security.auth.Subject) java.security.AccessController.doPrivileged(pa);
      // Associate the method
      SecurityActions.pushSubjectContext(principal, credential, subj);

              starksm64 Scott Stark (Inactive)
              mardinator martin walla (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 1 day
                  1d
                  Remaining:
                  Remaining Estimate - 1 day
                  1d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified