Package org.jboss.security.identity.plugins

Examples of org.jboss.security.identity.plugins.SimpleRoleGroup


         throw new RuntimeException(e);
      }
      SecurityContext sc = scb.getSecurityContext();
      Group roles = this.getCurrentRoles(null, authenticatedSubject, sc);
      if(roles == null)
         return new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      else
         return new SimpleRoleGroup(roles);
  
View Full Code Here


  
   private RoleGroup getRoleGroup(Group roleGroup)
   {
      if(roleGroup == null)
         throw new IllegalArgumentException("roleGroup is null");
      SimpleRoleGroup srg = new SimpleRoleGroup(roleGroup.getName());
      Enumeration<? extends Principal> principals = roleGroup.members();
      while(principals.hasMoreElements())
      {
         srg.getRoles().add(new SimpleRole(principals.nextElement().getName()));
      }
      return srg; 
   }
View Full Code Here

         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
View Full Code Here

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

         RoleGroup mappedObject)
   {
      Set<String> roleset = (Set<String>)principalRolesMap.get(principal.getName());
      if(roleset != null)
      {
         RoleGroup newRoles = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
        
         if(roleset != null)
         {
            for(String r:roleset)
            {
               newRoles.addRole(new SimpleRole(r));           
            }
         }
        
         mappedObject.clearRoles();
         mappedObject.getRoles().addAll(newRoles.getRoles());
      }
      return mappedObject;
   }
View Full Code Here

    * Return a RoleGroup of Run-As roles
    * @return
    */
   public RoleGroup getRunAsRolesAsRoleGroup()
   {
      return new SimpleRoleGroup(runAsRoles);
   }
View Full Code Here

         callerPrincipal = new SimplePrincipal(callerRunAs.getName());
      }
     
      RoleGroup roles = this.getCurrentRoles(callerPrincipal, authenticatedSubject, sc);
      if(roles == null)
         roles = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      return roles;
  
View Full Code Here

   private RoleGroup copyGroups(RoleGroup source, Group toCopy)
   {
      if(toCopy == null)
         return source;
      if(source == null && toCopy != null)
         source = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      Enumeration<? extends Principal> en = toCopy.members();
      while(en.hasMoreElements())
      {
         source.addRole(new SimpleRole(en.nextElement().getName()));
      }
View Full Code Here

  
   private RoleGroup getRoleGroup(Group roleGroup)
   {
      if(roleGroup == null)
         throw new IllegalArgumentException("roleGroup is null");
      SimpleRoleGroup srg = new SimpleRoleGroup(roleGroup.getName());
      Enumeration<? extends Principal> principals = roleGroup.members();
      while(principals.hasMoreElements())
      {
         srg.getRoles().add(new SimpleRole(principals.nextElement().getName()));
      }
      return srg; 
   }
View Full Code Here

            Set<Object> credentials = subject.getPrivateCredentials();
            Object credential = !credentials.isEmpty() ? credentials.iterator().next() : null;
            org.jboss.security.SecurityContext new_jb_securityContext = SecurityContextFactory.createSecurityContext(securityDomain);
            SecurityContextAssociation.setSecurityContext(new_jb_securityContext);
            if (rolesGroup != null) {
                RoleGroup roleGroup = new SimpleRoleGroup(rolesGroup);
                Identity identity = CredentialIdentityFactory.createIdentity(principal, credential, roleGroup);
                new_jb_securityContext.getUtil().createSubjectInfo(identity, subject);
                new_jb_securityContext.getSubjectInfo().setRoles(roleGroup);
            } else {
                Identity identity = CredentialIdentityFactory.createIdentity(principal, credential);
                new_jb_securityContext.getUtil().createSubjectInfo(identity, subject);
            }
            if (new_jb_runAs != null) {
                new_jb_securityContext.setOutgoingRunAs(new_jb_runAs);
            }
            return new JBossContainerContext(null, null, null);
        } else {
            RoleGroup old_jb_roleGroup = old_jb_securityContext.getSubjectInfo().getRoles();
            if (rolesGroup != null) {
                old_jb_securityContext.getSubjectInfo().setRoles(new SimpleRoleGroup(rolesGroup));
            }
            RunAs old_jb_runAs = old_jb_securityContext.getOutgoingRunAs();
            if (new_jb_runAs != null) {
                old_jb_securityContext.setOutgoingRunAs(new_jb_runAs);
            }
View Full Code Here

TOP

Related Classes of org.jboss.security.identity.plugins.SimpleRoleGroup

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.