/** * 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; }
public void writeAttributeTypeWithoutRootTag(SAML11AttributeType attributeType) throws ProcessingException { String attributeName = attributeType.getAttributeName(); if (StringUtil.isNullOrEmpty(attributeName)) throw logger.writerNullValueError("attribute name"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAME, attributeName); String attributeNamespace = attributeType.getAttributeNamespace().toString(); if (StringUtil.isNullOrEmpty(attributeNamespace)) throw logger.writerNullValueError("attribute namespace"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAMESPACE, attributeNamespace); List<Object> attributeValues = attributeType.get(); if (attributeValues != null) { for (Object attributeValue : attributeValues) { if (attributeValue instanceof String) { writeStringAttributeValue((String) attributeValue); } else throw logger.writerUnsupportedAttributeValueError(attributeValue.getClass().getName()); } } }
for (SAML11AttributeType attr : attributes) { if (roleKeys != null && roleKeys.size() > 0) { if (!roleKeys.contains(attr.getAttributeName())) continue; List<Object> attributeValues = attr.get(); if (attributeValues != null) { for (Object attrValue : attributeValues) {
attributeType.add(attributeValue);
attributeType.add(attributeValue);
for (SAML11AttributeType attr : attributes) { if (roleKeys != null && roleKeys.size() > 0) { if (!roleKeys.contains(attr.getAttributeName())) continue; List<Object> attributeValues = attr.get(); if (attributeValues != null) { for (Object attrValue : attributeValues) {
/** * 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; }
public void writeAttributeTypeWithoutRootTag(SAML11AttributeType attributeType) throws ProcessingException { String attributeName = attributeType.getAttributeName(); if (StringUtil.isNullOrEmpty(attributeName)) throw logger.writerNullValueError("attribute name"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAME, attributeName); String attributeNamespace = attributeType.getAttributeNamespace().toString(); if (StringUtil.isNullOrEmpty(attributeNamespace)) throw logger.writerNullValueError("attribute namespace"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAMESPACE, attributeNamespace); List<Object> attributeValues = attributeType.get(); if (attributeValues != null) { for (Object attributeValue : attributeValues) { if (attributeValue instanceof String) { writeStringAttributeValue((String) attributeValue); } else throw logger.writerUnsupportedAttributeValueError(attributeValue.getClass().getName()); } } }
/** * 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()); } }
if (!roleKeys.contains(attr.getAttributeName())) continue; List<Object> attributeValues = attr.get(); if (attributeValues != null)
/** * 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; }
public void writeAttributeTypeWithoutRootTag(SAML11AttributeType attributeType) throws ProcessingException { String attributeName = attributeType.getAttributeName(); if (StringUtil.isNullOrEmpty(attributeName)) throw new ProcessingException(ErrorCodes.WRITER_NULL_VALUE + "attribute name"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAME, attributeName); String attributeNamespace = attributeType.getAttributeNamespace().toString(); if (StringUtil.isNullOrEmpty(attributeNamespace)) throw new ProcessingException(ErrorCodes.WRITER_NULL_VALUE + "attribute namespace"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAMESPACE, attributeNamespace); List<Object> attributeValues = attributeType.get(); if (attributeValues != null) { for (Object attributeValue : attributeValues) { if (attributeValue instanceof String) { writeStringAttributeValue((String) attributeValue); } else throw new RuntimeException(ErrorCodes.WRITER_UNSUPPORTED_ATTRIB_VALUE + attributeValue.getClass().getName()); } } }
/** * 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()); } }
if (!roleKeys.contains(attr.getAttributeName())) continue; List<Object> attributeValues = attr.get(); if (attributeValues != null)
/** * 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; }
public void writeAttributeTypeWithoutRootTag(SAML11AttributeType attributeType) throws ProcessingException { String attributeName = attributeType.getAttributeName(); if (StringUtil.isNullOrEmpty(attributeName)) throw new ProcessingException(ErrorCodes.WRITER_NULL_VALUE + "attribute name"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAME, attributeName); String attributeNamespace = attributeType.getAttributeNamespace().toString(); if (StringUtil.isNullOrEmpty(attributeNamespace)) throw new ProcessingException(ErrorCodes.WRITER_NULL_VALUE + "attribute namespace"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAMESPACE, attributeNamespace); List<Object> attributeValues = attributeType.get(); if (attributeValues != null) { for (Object attributeValue : attributeValues) { if (attributeValue instanceof String) { writeStringAttributeValue((String) attributeValue); } else throw new RuntimeException(ErrorCodes.WRITER_UNSUPPORTED_ATTRIB_VALUE + attributeValue.getClass().getName()); } } }
/** * 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()); } }
for (SAML11AttributeType attr : attributes) { if (roleKeys != null && roleKeys.size() > 0) { if (!roleKeys.contains(attr.getAttributeName())) continue; List<Object> attributeValues = attr.get(); if (attributeValues != null) { for (Object attrValue : attributeValues) {
/** * 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; }
public void writeAttributeTypeWithoutRootTag(SAML11AttributeType attributeType) throws ProcessingException { String attributeName = attributeType.getAttributeName(); if (StringUtil.isNullOrEmpty(attributeName)) throw logger.writerNullValueError("attribute name"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAME, attributeName); String attributeNamespace = attributeType.getAttributeNamespace().toString(); if (StringUtil.isNullOrEmpty(attributeNamespace)) throw logger.writerNullValueError("attribute namespace"); StaxUtil.writeAttribute(writer, SAML11Constants.ATTRIBUTE_NAMESPACE, attributeNamespace); List<Object> attributeValues = attributeType.get(); if (attributeValues != null) { for (Object attributeValue : attributeValues) { if (attributeValue instanceof String) { writeStringAttributeValue((String) attributeValue); } else throw logger.writerUnsupportedAttributeValueError(attributeValue.getClass().getName()); } } }