Package org.jboss.security

Examples of org.jboss.security.RunAsIdentity


         }
      }

      if (meta.getRunAs() != null)
      {
         advisor.getDefaultMetaData().addMetaData("security", "run-as", new RunAsIdentity(meta.getRunAs(), null), PayloadKey.TRANSIENT);
      }
   }
View Full Code Here


         else
         {
            // Check that the run-as role is in the set of method roles
            if (callerRunAsIdentity instanceof RunAsIdentity)
            {
               RunAsIdentity rai = (RunAsIdentity) callerRunAsIdentity;
               if(rai.doesUserHaveRole(roles) == false)
               {
                  String msg = "Insufficient permissions, runAsPrincipal=" + rai.getName()
                  + ", requiredRoles=" + roles + ", runAsRoles=" + rai.getRunAsRoles();
                  log.error(msg);
                  throw new SecurityException(msg);
               }
            }
            else
View Full Code Here

            try {
                servlet = request.getWrapper();
                if (servlet != null) {
                    String name = servlet.getName();
                    RunAsIdentityMetaData identity = metaData.getRunAsIdentity(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

/* 57 */       this.principalName = "nobody";
/*    */   }
/*    */
/*    */   public boolean login()
/*    */   {
/* 65 */     RunAsIdentity runAsRole = new RunAsIdentity(this.roleName, this.principalName);
/* 66 */     SecurityAssociation.pushRunAsIdentity(runAsRole);
/* 67 */     this.pushedRole = true;
/* 68 */     return true;
/*    */   }
View Full Code Here

/* 152 */         if (log.isTraceEnabled())
/*     */         {
/* 154 */           log.trace("Current Calling principal is: " + username + " ThreadName: " + Thread.currentThread().getName());
/*     */         }
/*     */
/* 158 */         RunAsIdentity runAs = GetPrincipalInfoAction.peekRunAsIdentity();
/* 159 */         if (runAs != null)
/*     */         {
/* 161 */           this.runAsRoles = runAs.getRunAsRoles();
/*     */         }
/*     */       }
/*     */     }
/*     */     catch (Throwable e)
/*     */     {
View Full Code Here

/*  59 */         SubjectInfo si = sc.getSubjectInfo();
/*     */
/*  61 */         if (si != null)
/*     */         {
/*  63 */           Subject activeSubject = si.getAuthenticatedSubject();
/*  64 */           RunAsIdentity callerRunAsIdentity = (RunAsIdentity)sc.getIncomingRunAs();
/*     */
/*  66 */           if (activeSubject != null)
/*     */           {
/*  68 */             Set principalsSet = null;
/*  69 */             if (callerRunAsIdentity == null)
/*     */             {
/*  71 */               principalsSet = activeSubject.getPrincipals();
/*     */             }
/*     */             else
/*     */             {
/*  75 */               principalsSet = callerRunAsIdentity.getPrincipalsSet();
/*     */             }
/*     */
/*  78 */             theSubject = new Subject(true, principalsSet, activeSubject.getPublicCredentials(), activeSubject.getPrivateCredentials());
/*     */           }
/*  84 */           else if (callerRunAsIdentity != null)
/*     */           {
/*  86 */             Set principalsSet = callerRunAsIdentity.getPrincipalsSet();
/*  87 */             theSubject = new Subject(true, principalsSet, SubjectPolicyContextHandler.EMPTY_SET, SubjectPolicyContextHandler.EMPTY_SET);
/*     */           }
/*     */         }
/*     */       }
/*     */
View Full Code Here

/* 95 */         AssemblyDescriptorMetaData assemblyDescriptor = applicationMetaData.getAssemblyDescriptor();
/* 96 */         String roleName = ejbTimeoutIdentity.getRunAsRoleName();
/* 97 */         String principalName = ejbTimeoutIdentity.getRunAsPrincipalName();
/*    */
/* 99 */         Set extraRoleNames = assemblyDescriptor.getSecurityRoleNamesByPrincipal(principalName);
/* 100 */         RunAs runAsIdentity = new RunAsIdentity(roleName, principalName, extraRoleNames);
/* 101 */         SecurityActions.pushRunAsIdentity(runAsIdentity);
/* 102 */         this.pushedRunAs = true;
/*    */       }
/* 104 */       this.container.invoke(inv);
/*    */     }
View Full Code Here

/*     */         }
/*     */
/*     */       }
/* 177 */       else if ((this.callerRunAs instanceof RunAsIdentity))
/*     */       {
/* 179 */         RunAsIdentity callerRunAsIdentity = (RunAsIdentity)this.callerRunAs;
/*     */
/* 181 */         if (!callerRunAsIdentity.doesUserHaveRole(this.methodRoles))
/*     */         {
/* 183 */           String method = this.ejbMethod.getName();
/* 184 */           String msg = "Insufficient method permissions, principal=" + this.ejbPrincipal + ", ejbName=" + this.ejbName + ", method=" + method + ", interface=" + this.methodInterface + ", requiredRoles=" + this.methodRoles + ", runAsRoles=" + callerRunAsIdentity.getRunAsRoles();
/*     */
/* 189 */           if (this.trace)
/* 190 */             log.trace("Exception:" + msg);
/* 191 */           allowed = false;
/*     */         }
View Full Code Here

/* 240 */     if (this.callerRunAs == null) {
/* 241 */       allowed = am.doesUserHaveRole(this.ejbPrincipal, set);
/*     */     }
/* 244 */     else if ((this.callerRunAs instanceof RunAsIdentity))
/*     */     {
/* 246 */       RunAsIdentity callerRunAsIdentity = (RunAsIdentity)this.callerRunAs;
/* 247 */       allowed = callerRunAsIdentity.doesUserHaveRole(set);
/*     */     }
/*     */
/* 250 */     return allowed ? 1 : -1;
/*     */   }
View Full Code Here

/* 160 */       byte[] encodedAuthenticationToken = noAuthenticationToken;
/*     */
/* 162 */       if ((secMech.sas_context_mech.target_supports & 0x400) != 0)
/*     */       {
/* 166 */         Principal p = null;
/* 167 */         RunAsIdentity runAs = SecurityAssociation.peekRunAsIdentity();
/* 168 */         if (runAs != null)
/*     */         {
/* 171 */           p = runAs;
/*     */         }
/*     */         else
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.