Examples of RunAsIdentity


Examples of org.jboss.security.RunAsIdentity

      if (servlet != null && metaData != null)
      {
         boolean trace = log.isTraceEnabled();
         String name = servlet.getName();
         RunAsIdentityMetaData identity = metaData.getRunAsIdentity(name);
         RunAsIdentity runAsIdentity = null;
         if(identity != null)
         {
            runAsIdentity = new RunAsIdentity(identity.getRoleName(),
                  identity.getPrincipalName(), identity.getRunAsRoles());
         }
        
         if (trace)
            log.trace(name + ", runAs: " + identity);
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

      PushRunAsRoleAction action = new PushRunAsRoleAction(principal);
      AccessController.doPrivileged(action);
   }
   static RunAsIdentity popRunAsIdentity()
   {
      RunAsIdentity principal = (RunAsIdentity) AccessController.doPrivileged(PopRunAsRoleAction.ACTION);
      return principal;
   }
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

        RoleGroup roleGroup = null;

        RunAs runAs = securityContext.getIncomingRunAs();
        if (runAs != null && runAs instanceof RunAsIdentity) {
            RunAsIdentity runAsIdentity = (RunAsIdentity) runAs;
            roleGroup = runAsIdentity.getRunAsRolesAsRoleGroup();
        } else {

            AuthorizationManager am = securityContext.getAuthorizationManager();
            SecurityContextCallbackHandler scb = new SecurityContextCallbackHandler(securityContext);
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

      PushRunAsRoleAction action = new PushRunAsRoleAction(principal);
      AccessController.doPrivileged(action);
   }
   static RunAsIdentity popRunAsIdentity()
   {
      RunAsIdentity principal = (RunAsIdentity) AccessController.doPrivileged(PopRunAsRoleAction.ACTION);
      return principal;
   }
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

   private static class PopRunAsRoleAction implements PrivilegedAction
   {
      static PrivilegedAction ACTION = new PopRunAsRoleAction();
      public Object run()
      {
         RunAsIdentity principal = SecurityAssociation.popRunAsIdentity();
         return principal;
      }
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

        SecurityAssociation.clear();
    }

    public Principal pushRole(Principal user, String role)
    {
        RunAsIdentity runAs = new RunAsIdentity(role, (user==null?null:user.getName()));
        if (user==null)
            user = (JBossUserPrincipal)_users.get("nobody");
       
        //set up security for Jetty
        ((JBossUserPrincipal)user).push(role);
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

            SubjectInfo si = sc.getSubjectInfo();
           
            if(si != null)
            {
               Subject activeSubject = si.getAuthenticatedSubject();
               RunAsIdentity callerRunAsIdentity = (RunAsIdentity)sc.getIncomingRunAs();
              
               if( activeSubject != null )
               {
                  Set<Principal> principalsSet = null;
                  if( callerRunAsIdentity == null )
                  {
                     principalsSet = activeSubject.getPrincipals();
                  }
                  else
                  {
                     principalsSet = callerRunAsIdentity.getPrincipalsSet();
                  }

                  theSubject = new Subject(true, principalsSet,
                     activeSubject.getPublicCredentials(),
                     activeSubject.getPrivateCredentials());
               }
               else
               {
                  if( callerRunAsIdentity != null )
                  {
                     Set<Principal> principalsSet = callerRunAsIdentity.getPrincipalsSet();
                     theSubject = new Subject(true, principalsSet, EMPTY_SET, EMPTY_SET);
                  }
               }
            }
         }
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

         Subject theSubject = null;
         Subject activeSubject = SecurityAssociation.getSubject();
         if( activeSubject != null )
         {
            Set principalsSet = null;
            RunAsIdentity callerRunAsIdentity = (RunAsIdentity)
               SecurityAssociation.peekRunAsIdentity(1);
            if( callerRunAsIdentity == null )
            {
               principalsSet = activeSubject.getPrincipals();
            }
            else
            {
               principalsSet = callerRunAsIdentity.getPrincipalsSet();
            }

            theSubject = new Subject(true, principalsSet,
               activeSubject.getPublicCredentials(),
               activeSubject.getPrivateCredentials());
         }
         else
         {
            RunAsIdentity callerRunAsIdentity = (RunAsIdentity)
               SecurityAssociation.peekRunAsIdentity(1);
            if( callerRunAsIdentity != null )
            {
               Set principalsSet = callerRunAsIdentity.getPrincipalsSet();
               theSubject = new Subject(true, principalsSet, EMPTY_SET, EMPTY_SET);
            }
         }
         return theSubject;
      }
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

   /** Push the run as role using the SecurityAssociation.pushRunAsIdentity method
    *@see SecurityAssociation#pushRunAsIdentity(RunAsIdentity)
    */
   public boolean login()
   {
      RunAsIdentity runAsRole = new RunAsIdentity(roleName, principalName);
      SecurityAssociation.pushRunAsIdentity(runAsRole);
      pushedRole = true;
      return true;
   }
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

            try
            {
                SecurityAssociation.pushSubjectContext(subject, principal, credential) ;
                if ((securityConfig != null) && securityConfig.hasRunAs())
                {
                    SecurityAssociation.pushRunAsIdentity(new RunAsIdentity(securityConfig.getRunAs(), principal.getName()));
                }
            }
            catch (final Exception ex)
            {
              throw new RuntimeException("Unexpected exception creating security context", ex) ;
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.