Package org.jboss.security

Examples of org.jboss.security.RunAsIdentity


   }

   public void testPermit_Deny_Permit() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("Permit-Deny-Permit");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted Deny", TrustDecision.Deny, itm.isTrusted(sc));
   }
View Full Code Here


   }

   public void testDeny_Permit_Permit() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("Deny-Permit-Permit");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted Deny", TrustDecision.Deny, itm.isTrusted(sc));
   }
View Full Code Here

   }

   public void testPermit_Permit_NotApplicable() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("Permit-Permit-NotApplicable");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted", TrustDecision.Permit, itm.isTrusted(sc));
   }
View Full Code Here

   }

   public void testNotApplicable_Permit_Permit() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("NotApplicable-Permit-Permit");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted", TrustDecision.Permit, itm.isTrusted(sc));
   }
View Full Code Here

   }

   public void testNotApplicable_Required__Permit_Optional() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("NotApplicable_Required-Permit_Optional");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted not applicable", TrustDecision.NotApplicable, itm.isTrusted(sc));
   }
View Full Code Here

   }

   public void testPermit_Required__Deny_Optional() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("Permit_Required-Deny_Optional");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted", TrustDecision.Permit, itm.isTrusted(sc));
   }
View Full Code Here

   }

   public void testNotApplicable_Required__Deny_Optional() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("NotApplicable_Required-Deny_Optional");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted false", TrustDecision.NotApplicable, itm.isTrusted(sc));
   }
View Full Code Here

   }

   public void testPermit_Sufficient__Deny_Optional() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("Permit_Sufficient-Deny_Optional");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted", TrustDecision.Permit, itm.isTrusted(sc));
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   public void testJavaEERunAsIdentity() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("conf-javaee");
      sc.setIncomingRunAs(new RunAsIdentity("theduke", "jduke"));
      assertNotNull("SecurityContext is not null", sc);
      IdentityTrustManager itm = sc.getIdentityTrustManager();
      assertNotNull("IdentityTrustManager is not null", itm);
      assertEquals("Is Trusted", TrustDecision.Permit, itm.isTrusted(sc));
View Full Code Here

            AssemblyDescriptorMetaData assemblyDescriptor = applicationMetaData.getAssemblyDescriptor();
            String roleName = ejbTimeoutIdentity.getRunAsRoleName();
            String principalName = ejbTimeoutIdentity.getRunAsPrincipalName();
            // the run-as principal might have extra roles mapped in the assembly-descriptor
            Set extraRoleNames = assemblyDescriptor.getSecurityRoleNamesByPrincipal(principalName);
            RunAs runAsIdentity = new RunAsIdentity(roleName, principalName, extraRoleNames);
            SecurityActions.pushRunAsIdentity(runAsIdentity);
            pushedRunAs = true;
         }
         container.invoke(inv);
      }
View Full Code Here

TOP

Related Classes of org.jboss.security.RunAsIdentity

Copyright © 2018 www.massapicom. 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.