Examples of RunAsIdentity


Examples of org.jboss.security.RunAsIdentity

         // The caller is using a run-as identity
         else
         {
            if(callerRunAs instanceof RunAsIdentity)
            {
               RunAsIdentity callerRunAsIdentity = (RunAsIdentity) callerRunAs;
               RoleGroup srg = new SimpleRoleGroup(callerRunAsIdentity.getRunAsRoles());
              
               // Check that the run-as role is in the set of method roles
               if(srg.containsAtleastOneRole(methodRoles) == false)
               {
                  String method = this.ejbMethod.getName();
                  String msg = "Insufficient method permissions, principal=" + ejbPrincipal
                  + ", ejbName=" + this.ejbName
                  + ", method=" + method + ", interface=" + this.methodInterface
                  + ", requiredRoles=" + methodRoles + ", runAsRoles="
                  + callerRunAsIdentity.getRunAsRoles();
                  if(trace)
                     log.trace("Exception:"+msg);
                  allowed = false;
               }
              
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

         //allowed = am.doesUserHaveRole(ejbPrincipal, set);
      else
      {
         if(callerRunAs instanceof RunAsIdentity)
         {
            RunAsIdentity callerRunAsIdentity = (RunAsIdentity) callerRunAs;
            SimpleRoleGroup srg = new SimpleRoleGroup(callerRunAsIdentity.getRunAsRoles());
            allowed = srg.containsRole(deploymentrole);
            //allowed = callerRunAsIdentity.doesUserHaveRole(set);
         }
      }
      return allowed ? AuthorizationContext.PERMIT : AuthorizationContext.DENY;
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

            try {
                servlet = request.getWrapper();
                if (servlet != null) {
                    String name = servlet.getName();
                    RunAsIdentityMetaData identity = runAsIdentity.get(name);
                    RunAsIdentity runAsIdentity = null;
                    if (identity != null) {
                        WebLogger.WEB_SECURITY_LOGGER.tracef(name + ", runAs: " + identity);
                        runAsIdentity = new RunAsIdentity(identity.getRoleName(), identity.getPrincipalName(),
                                identity.getRunAsRoles());
                    }
                    SecurityActions.pushRunAsIdentity(runAsIdentity);
                }
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

            try {
                servlet = request.getWrapper();
                if (servlet != null) {
                    String name = servlet.getName();
                    RunAsIdentityMetaData identity = metaData.getRunAsIdentity(name);
                    RunAsIdentity runAsIdentity = null;
                    if (identity != null) {
                        log.tracef(name + ", runAs: " + identity);
                        runAsIdentity = new RunAsIdentity(identity.getRoleName(), identity.getPrincipalName(),
                                identity.getRunAsRoles());
                    }
                    SecurityActions.pushRunAsIdentity(runAsIdentity);
                }
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

            InvokerLocator locator = (InvokerLocator) invocation.getMetaData(InvokeRemoteInterceptor.REMOTING,
                  InvokeRemoteInterceptor.INVOKER_LOCATOR);

            String iface = (locator != null) ? "Remote" : "Local";
           
            RunAsIdentity callerRunAs = SecurityActions.peekRunAsIdentity();
           
            EJBAuthorizationHelper helper = new EJBAuthorizationHelper(sc);
            boolean isAuthorized = helper.authorize(ejbName,
                             mi.getMethod(),
                             sc.getUtil().getUserPrincipal(),
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

   }

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

Examples of org.jboss.security.RunAsIdentity

      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

Examples of org.jboss.security.RunAsIdentity

         this.depth = depth;
      }

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

Examples of org.jboss.security.RunAsIdentity

      {
         Policy policy = Policy.getPolicy();
         // Get the caller
         Subject caller = SecurityActions.getContextSubject();
 
         RunAsIdentity rai = SecurityActions.peekRunAsIdentity();

         Principal[] principals = null;
         if(rai != null)
         {
            Set runAsRoles = rai.getRunAsRoles();
            principals = new Principal[runAsRoles.size()];
            runAsRoles.toArray(principals);
         }
         else
         {
View Full Code Here

Examples of org.jboss.security.RunAsIdentity

   public Object invoke(Invocation invocation) throws Throwable
   {
      Subject previousSubject = null;
      try
      {
         RunAsIdentity runAsIdentity = getRunAsIdentity(invocation);
         SecurityActions.pushRunAsIdentity(runAsIdentity);
        
         runAsIdentity = SecurityActions.peekRunAsIdentity(1);
         if (runAsIdentity != null)
         {
            previousSubject = SecurityActions.getActiveSubject();
            java.util.Set newPrincipals = runAsIdentity.getPrincipalsSet();
            Subject newSubject = new Subject(false, newPrincipals, new java.util.HashSet(), new java.util.HashSet());
            SecurityAssociation.setSubject(newSubject);
         }
        
         return invocation.invokeNext();
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.