Uploaded image for project: 'JBoss Enterprise Application Platform 6'
  1. JBoss Enterprise Application Platform 6
  2. JBPAPP6-1713

JBossSecurityContextUtil.getUserPrincipal() returns SimplePrincipal on remote calls from standalone client

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Migrated to another ITS
    • Affects Version/s: EAP 6.0.0
    • Fix Version/s: None
    • Component/s: EJB, Security
    • Labels:
      None
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Use a standard API like:-

      @LocalBean
      @Stateless
      @SecurityDomain("MySecurityDomain")
      public class HelloBean implements HelloBeanRemote {
      
          @Resource
          private SessionContext sessionContext;
      
          @Override
          public CustomPrincipal getPrincipal() {
                  return (CustomPrincipal) sessionContext.getCallerPrincipal();
          }
      }
      
      Show
      Use a standard API like:- @LocalBean @Stateless @SecurityDomain( "MySecurityDomain" ) public class HelloBean implements HelloBeanRemote { @Resource private SessionContext sessionContext; @Override public CustomPrincipal getPrincipal() { return (CustomPrincipal) sessionContext.getCallerPrincipal(); } }
    • Docs QE Status:
      NEW

      Description

      My secured EJB has following method:-

              public CustomPrincipal getCustomPrincipal() {
      		SecurityContext securityContext = SecurityContextAssociation.getSecurityContext();
      		if (securityContext == null) {
      			return null;
      		}
      		else {
      			return new JBossSecurityContextUtil(securityContext).getUserPrincipal()
      		}
      	}
      

      And, JAAS module is configured to use CustomPrincipal:-

          <module-option name="principalClass" value="test.CustomPrincipal"/>
      

      It returns CustomPrincipal invoking from servlet, but returns SimplePrincipal invoking from a standalone client.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jaikiran Jaikiran Pai
                Reporter:
                hisanobu.okuda Hisanobu Okuda
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: