Package org.glassfish.security.common

Examples of org.glassfish.security.common.Role


      Set roleReferences = descriptor.getRoleReferences();
      Iterator roleRefsIterator = roleReferences.iterator();
      EjbBundleDescriptorImpl bundleDescriptor = descriptor.getEjbBundleDescriptor();
      Set roles = bundleDescriptor.getRoles();
      Iterator roleIterator = roles.iterator();
      Role role = null;
      RoleReference roleReference = null;
      boolean found = false;
      boolean oneFailed = false;
     
      if (roleRefsIterator.hasNext()) {
    while (roleRefsIterator.hasNext()) {
        found = false;
        roleReference = (RoleReference)roleRefsIterator.next();

        while (roleIterator.hasNext()) {
      role = (Role)roleIterator.next();
      if (role.getName().equals(roleReference.getValue())) {
          found = true;
          //reset this so next time it drop back into here
          roleIterator = roles.iterator();
          break;
      }
View Full Code Here


  if (!descriptor.getPermissionedRoles().isEmpty()) {
      for (Iterator itr = descriptor.getPermissionedRoles().iterator();
     itr.hasNext();) {

    Role nextRole = (Role) itr.next();
    if (NameToken.isNMTOKEN(nextRole.getName()))  {
        result.addGoodDetails(smh.getLocalString
            ("tests.componentNameConstructor",
             "For [ {0} ]",
             new Object[] {compName.toString()}));
        result.addGoodDetails
      (smh.getLocalString
       (getClass().getName() + ".passed",
        "Role name [ {0} ] conforms to the lexical rules of NMTOKEN within bean [ {1} ]",
        new Object[] {nextRole.getName(), descriptor.getName()}));
        if (result.getStatus()!= Result.FAILED)
      result.setStatus(Result.PASSED);
    } else {
        result.addErrorDetails(smh.getLocalString
             ("tests.componentNameConstructor",
              "For [ {0} ]",
              new Object[] {compName.toString()}));
        result.failed
      (smh.getLocalString
       (getClass().getName() + ".failed",
        "Role name [ {0} ] does not conform to the lexical rules of NMTOKEN within bean [ {1} ]",
        new Object[] {nextRole.getName(), descriptor.getName()}));
    }
      }
  } else {
      result.addNaDetails(smh.getLocalString
        ("tests.componentNameConstructor",
View Full Code Here

     * Returns an Enumeration of my SecurityRole objects.
     */
    public Enumeration<SecurityRoleDescriptor> getSecurityRoles() {
        Vector<SecurityRoleDescriptor> securityRoles = new Vector<SecurityRoleDescriptor>();
        for (Iterator itr = super.getRoles().iterator(); itr.hasNext();) {
            Role r = (Role) itr.next();
            SecurityRoleDescriptor srd = new SecurityRoleDescriptor(r);
            securityRoles.add(srd);
        }
        return securityRoles.elements();
    }
View Full Code Here

    /**
     * Add a new abstrct role to me.
     */
    public void addSecurityRole(SecurityRole securityRole) {
        Role r = new Role(securityRole.getName());
        r.setDescription(securityRole.getDescription());
        super.addRole(r);
    }
View Full Code Here

      // get the security role name's in this app
      Set sc = descriptor.getRoles();
      Iterator itr = sc.iterator();
      while (itr.hasNext()) {
    foundIt = false;
    Role role = (Role) itr.next();
    String roleName = role.getName();
    if (roleName.length() > 0) {
        foundIt = true;
    } else {
        foundIt = false;
    }
View Full Code Here

    EjbBundleDescriptorImpl bundleDescriptor = descriptor.getEjbBundleDescriptor();
    Set roles = bundleDescriptor.getRoles();
    Iterator roleIterator = roles.iterator();
    while (roleIterator.hasNext()) {
      Role role = (Role) roleIterator.next();
      if (role.getName().equals(identity.getRoleName())) {
        result.addGoodDetails(smh.getLocalString
            ("tests.componentNameConstructor",
             "For [ {0} ]",
             new Object[] {compName.toString()}));
        result.passed(smh.getLocalString(
              "com.sun.enterprise.tools.verifier.tests.ejb.SecurityIdentityRefs.passed",
              "Security identity run-as specified identity [ {0} ] role is found in the list of roles",
              new Object[] {role.getName()}));       
        return result;               
      }
    }
    result.addErrorDetails(smh.getLocalString
        ("tests.componentNameConstructor",
View Full Code Here

  Set roleReferences = null;
  Iterator roleRefsIterator = null;
  Set roles = bundleDescriptor.getRoles();
  Iterator rolesIterator = roles.iterator();
  RoleReference roleReference = null;
  Role role = null;
  boolean oneFailed = false;
       
  // check to see if there are any undefined roles being referenced
  while (ejbIterator.hasNext()) {
      ejb = (EjbDescriptor)ejbIterator.next();
      roleReferences = ejb.getRoleReferences();
      roleRefsIterator = roleReferences.iterator();
      if (roleRefsIterator.hasNext()) {
    while (roleRefsIterator.hasNext()) {
        roleReference = (RoleReference)roleRefsIterator.next();
        role = roleReference.getRole();
        if (!role.getName().equals("")
      && !bundleDescriptor.getRoles().contains(role) ) {
      // print the undefine role
      result.addErrorDetails(smh.getLocalString
                 ("tests.componentNameConstructor",
            "For [ {0} ]",
            new Object[] {compName.toString()}));
      result.addErrorDetails(smh.getLocalString
                 (getClass().getName() + ".failed",
            "Error: The role [ {0} ] for bean [ {1} ] is undefined.",
            new Object[] {role.getName(),ejb.getName()}));
      if (!oneFailed) {
          oneFailed = true;
      }
        } else {
      result.addGoodDetails(smh.getLocalString
                ("tests.componentNameConstructor",
                 "For [ {0} ]",
                 new Object[] {compName.toString()}));
      result.passed(smh.getLocalString
              (getClass().getName() + ".passed",
               "The role [ {0} ] for bean [ {1} ] is defined.",
               new Object[] {role.getName(),ejb.getName()}));
        }
    }
      } else {
    result.addNaDetails(smh.getLocalString
            ("tests.componentNameConstructor",
View Full Code Here

                        "One cannot specify DENY with an non-empty array of rolesAllowed in @ServletSecurity / ServletSecurityElement"));
            }

            ac = new AuthorizationConstraintImpl();
            for (String roleName : rolesAllowed) {
                Role role = new Role(roleName);
                webBundleDesc.addRole(role);
                ac.addSecurityRole(roleName);
            }
        } else if (emptyRoleSemantic == EmptyRoleSemantic.PERMIT) {
            // ac is null
View Full Code Here

     * Returns an Enumeration of my SecurityRole objects.
     */
    public Enumeration<SecurityRoleDescriptor> getSecurityRoles() {
        Vector<SecurityRoleDescriptor> securityRoles = new Vector<SecurityRoleDescriptor>();
        for (Iterator itr = super.getRoles().iterator(); itr.hasNext();) {
            Role r = (Role) itr.next();
            SecurityRoleDescriptor srd = new SecurityRoleDescriptor(r);
            securityRoles.add(srd);
        }
        return securityRoles.elements();
    }
View Full Code Here

    /**
     * Add a new abstrct role to me.
     */
    public void addSecurityRole(SecurityRole securityRole) {
        Role r = new Role(securityRole.getName());
        r.setDescription(securityRole.getDescription());
        super.addRole(r);
    }
View Full Code Here

TOP

Related Classes of org.glassfish.security.common.Role

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.