/** * Given a set of roles, create an attribute statement * * @param roles * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
/** * Given a set of roles, create an attribute statement * * @param roles * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
/** * Given a set of roles, create an attribute statement * * @param roles * * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
/** * Given a set of roles, create an attribute statement * * @param roles * * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
/** * Given a set of roles, create an attribute statement * * @param roles * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); //$NON-NLS-1$ //$NON-NLS-2$ attr.add(role); attrStatement.add(attr); } return attrStatement; }
/** * Given a set of roles, create an attribute statement * * @param roles * * @return */ private SAML11AttributeStatementType createAttributeStatement(List<String> roles) { SAML11AttributeStatementType attrStatement = null; for (String role : roles) { if (attrStatement == null) { attrStatement = new SAML11AttributeStatementType(); } SAML11AttributeType attr = new SAML11AttributeType("Role", URI.create("urn:picketlink:role")); attr.add(role); attrStatement.add(attr); } return attrStatement; }
attributeType.add(attributeValue);
/** * Parse a {@link SAML11AttributeType} * @param xmlEventReader * @return * @throws ParsingException */ public static SAML11AttributeType parseSAML11Attribute(XMLEventReader xmlEventReader) throws ParsingException { StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader); StaxParserUtil.validate(startElement, JBossSAMLConstants.ATTRIBUTE.get()); SAML11AttributeType attributeType = null; Attribute name = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAME)); if (name == null) throw new RuntimeException(REQD_ATTRIBUTE + "Name"); String attribName = StaxParserUtil.getAttributeValue(name); Attribute namesp = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAMESPACE)); if (namesp == null) throw new RuntimeException(REQD_ATTRIBUTE + "Namespace"); String attribNamespace = StaxParserUtil.getAttributeValue(namesp); attributeType = new SAML11AttributeType(attribName, URI.create(attribNamespace)); attributeType.add(parseAttributeValue(xmlEventReader)); parseAttributeType(xmlEventReader, startElement, JBossSAMLConstants.ATTRIBUTE.get(), attributeType); return attributeType; }
/** * Parse a {@link SAML11AttributeType} * @param xmlEventReader * @return * @throws ParsingException */ public static SAML11AttributeType parseSAML11Attribute(XMLEventReader xmlEventReader) throws ParsingException { StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader); StaxParserUtil.validate(startElement, JBossSAMLConstants.ATTRIBUTE.get()); SAML11AttributeType attributeType = null; Attribute name = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAME)); if (name == null) throw new RuntimeException(REQD_ATTRIBUTE + "Name"); String attribName = StaxParserUtil.getAttributeValue(name); Attribute namesp = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAMESPACE)); if (namesp == null) throw new RuntimeException(REQD_ATTRIBUTE + "Namespace"); String attribNamespace = StaxParserUtil.getAttributeValue(namesp); attributeType = new SAML11AttributeType(attribName, URI.create(attribNamespace)); attributeType.add(parseAttributeValue(xmlEventReader)); parseAttributeType(xmlEventReader, startElement, JBossSAMLConstants.ATTRIBUTE.get(), attributeType); return attributeType; }
attributeType.add(attributeValue);
/** * Parse an {@code SAML11AttributeType} * * @param xmlEventReader * @throws ParsingException */ public static void parseAttributeType(XMLEventReader xmlEventReader, StartElement startElement, String rootTag, SAML11AttributeType attributeType) throws ParsingException { while (xmlEventReader.hasNext()) { XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader); if (xmlEvent instanceof EndElement) { EndElement end = StaxParserUtil.getNextEndElement(xmlEventReader); if (StaxParserUtil.matches(end, rootTag)) break; } startElement = StaxParserUtil.peekNextStartElement(xmlEventReader); if (startElement == null) break; String tag = StaxParserUtil.getStartElementName(startElement); if (JBossSAMLConstants.ATTRIBUTE.get().equals(tag)) break; if (JBossSAMLConstants.ATTRIBUTE_VALUE.get().equals(tag)) { Object attributeValue = parseAttributeValue(xmlEventReader); attributeType.add(attributeValue); } else throw logger.parserUnknownTag(tag, startElement.getLocation()); } }
/** * Parse an {@code SAML11AttributeType} * * @param xmlEventReader * * @throws ParsingException */ public static void parseAttributeType(XMLEventReader xmlEventReader, StartElement startElement, String rootTag, SAML11AttributeType attributeType) throws ParsingException { while (xmlEventReader.hasNext()) { XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader); if (xmlEvent instanceof EndElement) { EndElement end = StaxParserUtil.getNextEndElement(xmlEventReader); if (StaxParserUtil.matches(end, rootTag)) break; } startElement = StaxParserUtil.peekNextStartElement(xmlEventReader); if (startElement == null) break; String tag = StaxParserUtil.getStartElementName(startElement); if (JBossSAMLConstants.ATTRIBUTE.get().equals(tag)) break; if (JBossSAMLConstants.ATTRIBUTE_VALUE.get().equals(tag)) { Object attributeValue = parseAttributeValue(xmlEventReader); attributeType.add(attributeValue); } else throw logger.parserUnknownTag(tag, startElement.getLocation()); } }
/** * Parse an {@code SAML11AttributeType} * * @param xmlEventReader * * @throws ParsingException */ public static void parseAttributeType(XMLEventReader xmlEventReader, StartElement startElement, String rootTag, SAML11AttributeType attributeType) throws ParsingException { while (xmlEventReader.hasNext()) { XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader); if (xmlEvent instanceof EndElement) { EndElement end = StaxParserUtil.getNextEndElement(xmlEventReader); if (StaxParserUtil.matches(end, rootTag)) break; } startElement = StaxParserUtil.peekNextStartElement(xmlEventReader); if (startElement == null) break; String tag = StaxParserUtil.getStartElementName(startElement); if (JBossSAMLConstants.ATTRIBUTE.get().equals(tag)) break; if (JBossSAMLConstants.ATTRIBUTE_VALUE.get().equals(tag)) { Object attributeValue = parseAttributeValue(xmlEventReader); attributeType.add(attributeValue); } else throw logger.parserUnknownTag(tag, startElement.getLocation()); } }
/** * Parse a {@link SAML11AttributeType} * * @param xmlEventReader * @return * @throws ParsingException */ public static SAML11AttributeType parseSAML11Attribute(XMLEventReader xmlEventReader) throws ParsingException { StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader); StaxParserUtil.validate(startElement, JBossSAMLConstants.ATTRIBUTE.get()); SAML11AttributeType attributeType = null; Attribute name = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAME)); if (name == null) throw logger.parserRequiredAttribute("Name"); String attribName = StaxParserUtil.getAttributeValue(name); Attribute namesp = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAMESPACE)); if (namesp == null) throw logger.parserRequiredAttribute("Namespace"); String attribNamespace = StaxParserUtil.getAttributeValue(namesp); attributeType = new SAML11AttributeType(attribName, URI.create(attribNamespace)); attributeType.add(parseAttributeValue(xmlEventReader)); parseAttributeType(xmlEventReader, startElement, JBossSAMLConstants.ATTRIBUTE.get(), attributeType); return attributeType; }
/** * Parse a {@link SAML11AttributeType} * * @param xmlEventReader * * @return * * @throws ParsingException */ public static SAML11AttributeType parseSAML11Attribute(XMLEventReader xmlEventReader) throws ParsingException { StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader); StaxParserUtil.validate(startElement, JBossSAMLConstants.ATTRIBUTE.get()); SAML11AttributeType attributeType = null; Attribute name = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAME)); if (name == null) throw logger.parserRequiredAttribute("Name"); String attribName = StaxParserUtil.getAttributeValue(name); Attribute namesp = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAMESPACE)); if (namesp == null) throw logger.parserRequiredAttribute("Namespace"); String attribNamespace = StaxParserUtil.getAttributeValue(namesp); attributeType = new SAML11AttributeType(attribName, URI.create(attribNamespace)); attributeType.add(parseAttributeValue(xmlEventReader)); parseAttributeType(xmlEventReader, startElement, JBossSAMLConstants.ATTRIBUTE.get(), attributeType); return attributeType; }
/** * Parse a {@link SAML11AttributeType} * * @param xmlEventReader * * @return * * @throws ParsingException */ public static SAML11AttributeType parseSAML11Attribute(XMLEventReader xmlEventReader) throws ParsingException { StartElement startElement = StaxParserUtil.getNextStartElement(xmlEventReader); StaxParserUtil.validate(startElement, JBossSAMLConstants.ATTRIBUTE.get()); SAML11AttributeType attributeType = null; Attribute name = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAME)); if (name == null) throw logger.parserRequiredAttribute("Name"); String attribName = StaxParserUtil.getAttributeValue(name); Attribute namesp = startElement.getAttributeByName(new QName(SAML11Constants.ATTRIBUTE_NAMESPACE)); if (namesp == null) throw logger.parserRequiredAttribute("Namespace"); String attribNamespace = StaxParserUtil.getAttributeValue(namesp); attributeType = new SAML11AttributeType(attribName, URI.create(attribNamespace)); attributeType.add(parseAttributeValue(xmlEventReader)); parseAttributeType(xmlEventReader, startElement, JBossSAMLConstants.ATTRIBUTE.get(), attributeType); return attributeType; }