Package org.jboss.security

Examples of org.jboss.security.RunAsIdentity


   }

   static RunAsIdentity peekRunAsIdentity(int depth)
   {
      PrivilegedAction action = new PeekRunAsRoleAction(depth);
      RunAsIdentity principal = (RunAsIdentity) AccessController.doPrivileged(action);
      return principal;
   }
View Full Code Here


      return (RunAsIdentity)AccessController.doPrivileged(new PrivilegedAction()
      {
         public Object run()
         {
            SecurityContext sc = getSecurityContext();
            RunAsIdentity ra = (RunAsIdentity) sc.getOutgoingRunAs();
            sc.setOutgoingRunAs(null);
            return ra;
         }
      });
   }
View Full Code Here

         this.depth = depth;
      }

      public Object run()
      {
         RunAsIdentity principal = SecurityAssociation.peekRunAsIdentity(depth);
         return principal;
      }
View Full Code Here

      if(ad != null && runAsPrincipal != null)
      {
         extraRoles.addAll(ad.getSecurityRoleNamesByPrincipal(runAsPrincipal));
      }
     
      return new RunAsIdentity(runAs.value(), runAsPrincipal, extraRoles);

   }
View Full Code Here

      return AccessController.doPrivileged(new PrivilegedAction<RunAsIdentity>()
      {
         public RunAsIdentity run()
         {
            SecurityContext sc = getSecurityContext();
            RunAsIdentity ra = (RunAsIdentity) sc.getOutgoingRunAs();
            sc.setOutgoingRunAs(null);
            return ra;
         }
      });
   }
View Full Code Here

      if(ad != null && runAsPrincipal != null)
      {
         extraRoles.addAll(ad.getSecurityRoleNamesByPrincipal(runAsPrincipal));
      }
     
      return new RunAsIdentity(runAs.value(), runAsPrincipal, extraRoles);

   }
View Full Code Here

            {
               log.trace("Current Calling principal is: " + username
                  + " ThreadName: " + Thread.currentThread().getName());
            }
            // Check for a RunAsIdentity
            RunAsIdentity runAs = GetPrincipalInfoAction.peekRunAsIdentity();
            if( runAs != null )
            {
               runAsRoles = runAs.getRunAsRoles();
            }
         }
      }
      catch (Throwable e)
      {
View Full Code Here

  
   public void testPushPopRunAsIdentity()
   {
      assertNull("RunAsIdentity is null", SecurityAssociation.popRunAsIdentity());
     
      RunAsIdentity rai = new RunAsIdentity("role", "anil");
      SecurityAssociation.pushRunAsIdentity(rai);
     
      //Check the security context
      SecurityContext sc = getSecurityContext();
      assertEquals("RAI = anil,role", rai, sc.getOutgoingRunAs());
View Full Code Here

   }

   public void testPermit_Permit_Permit() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("Permit-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 testPermit_Permit_Deny() throws Exception
   {
      JBossSecurityContext sc = new JBossSecurityContext("Permit-Permit-Deny");
      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

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.