Examples of SecurityIdentityMetaData


Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

      assertEquals("/webservicesContextRoot", mergedData.getWebservices().getContextRoot());

      // Validate the proxy view
      JBossEnterpriseBeanMetaData InterMediateBean = mergedData.getEnterpriseBean("InterMediateBean");
      assertNotNull(InterMediateBean);
      SecurityIdentityMetaData runAs = InterMediateBean.getSecurityIdentity();
      assertEquals("InternalUser", runAs.getRunAs().getRoleName());

      ResourceEnvironmentReferencesMetaData resRefs = InterMediateBean.getResourceEnvironmentReferences();
      assertNotNull(resRefs);
      ResourceEnvironmentReferenceMetaData ref = resRefs.get("sessionContext");
      assertNotNull(ref);
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

   public void testSecurityIdentity() throws Exception
   {
      JBossSessionBeanMetaData original = new JBossSessionBeanMetaData();
      original.setEjbName("session");

      SecurityIdentityMetaData secId = new SecurityIdentityMetaData();
      RunAsMetaData runAs = new RunAsMetaData();
      runAs.setRoleName("originalRole");
      secId.setRunAs(runAs);
      secId.setRunAsPrincipal("originalPrincipal");
      secId.setUseCallerIdentity(new EmptyMetaData());
      original.setSecurityIdentity(secId);
     
      // override
      JBossSessionBeanMetaData override = new JBossSessionBeanMetaData();
      override.setEjbName("session");

      //runAs = new RunAsMetaData();
      //runAs.setRoleName("overrideRole");
      //secId.setRunAs(runAs);
      secId.setRunAsPrincipal("overridePrincipal");
      override.setSecurityIdentity(secId);
     
      // merged
      JBossSessionBeanMetaData merged = new JBossSessionBeanMetaData();
      merged.merge(override, original);

      secId = merged.getSecurityIdentity();
      assertNotNull(secId);
      runAs = secId.getRunAs();
      assertNotNull(runAs);
      assertEquals("originalRole", runAs.getRoleName());
      assertEquals("overridePrincipal", secId.getRunAsPrincipal());
      assertNotNull(secId.getUseCallerIdentity()); // is this right?
   }
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

    @Override
    protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit,
                                              final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass,
                                              final EJBComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
        if (componentConfiguration.getDescriptorData() != null) {
            final SecurityIdentityMetaData identity = componentConfiguration.getDescriptorData().getSecurityIdentity();

            if (identity != null) {
                final RunAsMetaData runAs = identity.getRunAs();
                if (runAs != null) {
                    final String role = runAs.getRoleName();
                    if (role != null && !role.trim().isEmpty()) {
                        componentConfiguration.setRunAs(role.trim());
                    }
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

    @Override
    protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit,
                                              final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass,
                                              final EJBComponentDescription componentConfiguration) throws DeploymentUnitProcessingException {
        if (componentConfiguration.getDescriptorData() != null) {
            final SecurityIdentityMetaData identity = componentConfiguration.getDescriptorData().getSecurityIdentity();

            if (identity != null) {
                final RunAsMetaData runAs = identity.getRunAs();
                if (runAs != null) {
                    final String role = runAs.getRoleName();
                    if (role != null && !role.trim().isEmpty()) {
                        componentConfiguration.setRunAs(role.trim());
                    }
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

      String runAsPrincipal = runAs.value();
     
      JBossEnterpriseBeanMetaData jbEnterpriseBeanMetaData = container.getXml();
      if(jbEnterpriseBeanMetaData != null)
      {
         SecurityIdentityMetaData securityIdentity = jbEnterpriseBeanMetaData.getSecurityIdentity();
         if(securityIdentity.isUseCallerId())
            return null; //Overriden in xml
         runAsPrincipal = securityIdentity.getRunAsPrincipal();
      }
     
      Set<String> extraRoles = new HashSet<String>();
     
      JBossAssemblyDescriptorMetaData ad = container.getAssemblyDescriptor();
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

      Set<String> extraRoles = new HashSet<String>();
     
      JBossEnterpriseBeanMetaData jbEnterpriseBeanMetaData = container.getXml();
      if(jbEnterpriseBeanMetaData != null)
      {
         SecurityIdentityMetaData securityIdentity = jbEnterpriseBeanMetaData.getSecurityIdentity();
         if(securityIdentity.isUseCallerId())
            return null; //Overriden in xml
         String s = securityIdentity.getRunAsPrincipal();
         if(s != null && s.length() != 0)
            runAsPrincipal = s; 
      }
      if(runAsPrincipal != null)
      {
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

            }
         }
      }
     
      // Fixup the security identity
      SecurityIdentityMetaData jbossSecurityIdentity = null;
      if (override != null && override.getSecurityIdentity() != null)
         jbossSecurityIdentity = override.getSecurityIdentity();
      SecurityIdentityMetaData originalSecurityIdentity = null;
      if(original != null)
         originalSecurityIdentity = original.getSecurityIdentity();
      if(jbossSecurityIdentity != null || originalSecurityIdentity != null)
      {
         if(securityIdentity == null)
            securityIdentity = new SecurityIdentityMetaData();
         securityIdentity.merge(jbossSecurityIdentity, originalSecurityIdentity);
      }
   }
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

        return EnterpriseBeanMetaData.class;
    }

    @Override
    protected void processBeanMetaData(EnterpriseBeanMetaData beanMetaData, DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
        final SecurityIdentityMetaData securityIdentity = beanMetaData.getSecurityIdentity();
        if (securityIdentity == null) {
            return;
        }
        final RunAsMetaData runAs = securityIdentity.getRunAs();
        if (runAs == null) {
            return;
        }
        final String runAsRole = runAs.getRoleName();
        if (runAsRole != null && !runAsRole.trim().isEmpty()) {
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */     InvokerBindingMetaData invokerBinding;
/* 1508 */     SecurityIdentityMetaData jbossSecurityIdentity = null;
/* 1509 */     if ((override != null) && (override.getSecurityIdentity() != null))
/* 1510 */       jbossSecurityIdentity = override.getSecurityIdentity();
/* 1511 */     SecurityIdentityMetaData originalSecurityIdentity = null;
/* 1512 */     if (original != null)
/* 1513 */       originalSecurityIdentity = original.getSecurityIdentity();
/* 1514 */     if ((jbossSecurityIdentity != null) || (originalSecurityIdentity != null))
/*      */     {
/* 1516 */       if (this.securityIdentity == null)
/* 1517 */         this.securityIdentity = new SecurityIdentityMetaData();
/* 1518 */       this.securityIdentity.merge(jbossSecurityIdentity, originalSecurityIdentity);
/*      */     }
/*      */   }
View Full Code Here

Examples of org.jboss.metadata.ejb.spec.SecurityIdentityMetaData

/* 605 */       JBossEnterpriseBeanMetaData ejb = getEnterpriseBean(ejbName);
/* 606 */       if (ejb != null)
/*     */       {
/* 609 */         synchronized (this.runAsIdentity)
/*     */         {
/* 611 */           SecurityIdentityMetaData si = ejb.getSecurityIdentity();
/* 612 */           if (si != null)
/*     */           {
/* 614 */             RunAsMetaData runAs = si.getRunAs();
/* 615 */             if (runAs != null)
/*     */             {
/* 617 */               String roleName = runAs.getRoleName();
/* 618 */               identity = new RunAsIdentityMetaData(roleName, null);
/* 619 */               this.runAsIdentity.put(ejbName, identity);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.