Examples of SecurityRoleMetaData


Examples of org.jboss.metadata.javaee.spec.SecurityRoleMetaData

            for (final AnnotationInstance annotation : declareRolesAnnotations) {
                if (annotation.value() == null) {
                    throw new DeploymentUnitProcessingException(MESSAGES.invalidDeclareRolesAnnotation(annotation.target()));
                }
                for (String role : annotation.value().asStringArray()) {
                    SecurityRoleMetaData sr = new SecurityRoleMetaData();
                    sr.setRoleName(role);
                    securityRoles.add(sr);
                }
            }
        }
        // @MultipartConfig
View Full Code Here

Examples of org.jboss.metadata.javaee.spec.SecurityRoleMetaData

/*     */
/*     */   public Set<String> getSecurityRolePrincipals(String name)
/*     */   {
/* 296 */     if (this.securityRoles == null)
/* 297 */       return null;
/* 298 */     SecurityRoleMetaData securityRole = (SecurityRoleMetaData)this.securityRoles.get(name);
/* 299 */     if (securityRole == null)
/* 300 */       return null;
/* 301 */     return securityRole.getPrincipals();
/*     */   }
View Full Code Here

Examples of org.jboss.metadata.javaee.spec.SecurityRoleMetaData

/* 51 */     if (roles == null) {
/* 52 */       return;
/*    */     }
/* 54 */     for (String role : roles.value())
/*    */     {
/* 56 */       SecurityRoleMetaData sr = new SecurityRoleMetaData();
/* 57 */       sr.setRoleName(role);
/* 58 */       Descriptions descriptions = ProcessorUtils.getDescription("DeclareRoles(" + roles.value() + ") on class: " + element.getName());
/* 59 */       sr.setDescriptions(descriptions);
/* 60 */       metaData.add(sr);
/*    */     }
/*    */   }
View Full Code Here

Examples of org.jboss.metadata.javaee.spec.SecurityRoleMetaData

            for (final AnnotationInstance annotation : declareRolesAnnotations) {
                if (annotation.value() == null) {
                    throw new DeploymentUnitProcessingException("@DeclareRoles needs to specify role names on " + annotation.target());
                }
                for (String role : annotation.value().asStringArray()) {
                    SecurityRoleMetaData sr = new SecurityRoleMetaData();
                    sr.setRoleName(role);
                    securityRoles.add(sr);
                }
            }
        }
        // @MultipartConfig
View Full Code Here

Examples of org.jboss.metadata.javaee.spec.SecurityRoleMetaData

* @author Remy Maucherat
*/
public class SecurityRoleMetaDataParser extends MetaDataElementParser {

    public static SecurityRoleMetaData parse(XMLStreamReader reader) throws XMLStreamException {
        SecurityRoleMetaData securityRole = new SecurityRoleMetaData();

        // Handle attributes
        final int count = reader.getAttributeCount();
        for (int i = 0; i < count; i ++) {
            final String value = reader.getAttributeValue(i);
            if (reader.getAttributeNamespace(i) != null) {
                continue;
            }
            final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
            switch (attribute) {
                case ID: {
                    securityRole.setId(value);
                    break;
                }
                default: throw unexpectedAttribute(reader, i);
            }
        }

        DescriptionsImpl descriptions = new DescriptionsImpl();
        // Handle elements
        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            if (DescriptionsMetaDataParser.parse(reader, descriptions)) {
                if (securityRole.getDescriptions() == null) {
                    securityRole.setDescriptions(descriptions);
                }
                continue;
            }
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case ROLE_NAME:
                    securityRole.setRoleName(reader.getElementText());
                    break;
                case PRINCIPAL_NAME:
                    Set<String> principalNames = securityRole.getPrincipals();
                    if (principalNames == null) {
                        principalNames = new HashSet<String>();
                        securityRole.setPrincipals(principalNames);
                    }
                    principalNames.add(reader.getElementText());
                    break;
                default: throw unexpectedElement(reader);
            }
View Full Code Here

Examples of org.jboss.security.SecurityRoleMetaData

      SecurityRolesMetaData roles = getDelegate().getSecurityRoles();
      if (roles == null)
         return Collections.emptyMap();
      Map<String, SecurityRoleMetaData> result = new LinkedHashMap<String, SecurityRoleMetaData>(roles.size());
      for (org.jboss.metadata.javaee.spec.SecurityRoleMetaData role : roles)
         result.put(role.getRoleName(), new SecurityRoleMetaData(role));
      return result;
   }
View Full Code Here

Examples of org.jboss.security.SecurityRoleMetaData

   public SecurityRoleMetaData getSecurityRoleByName(String roleName)
   {
      org.jboss.metadata.javaee.spec.SecurityRoleMetaData role = getDelegate().getSecurityRole(roleName);
      if (role == null)
         return null;
      return new SecurityRoleMetaData(role);
   }
View Full Code Here

Examples of org.jboss.security.SecurityRoleMetaData

      if (securityRoles != null)
      {
         Iterator it = securityRoles.values().iterator();
         while (it.hasNext())
         {
            SecurityRoleMetaData srMetaData = (SecurityRoleMetaData) it.next();
            if (srMetaData.getPrincipals().contains(userName))
               roleNames.add(srMetaData.getRoleName());
         }
      }
      return roleNames;
   }
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.