Package org.jboss.metadata.javaee.spec

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


/*     */
/*     */   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

/* 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

            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

* @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

TOP

Related Classes of org.jboss.metadata.javaee.spec.SecurityRoleMetaData

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.