/** * 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; }
SAML11AttributeQueryType query = SAML11ParserUtil.parseSAML11AttributeQuery(xmlEventReader); request.setQuery(query); } else if (SAML11Constants.AUTHENTICATION_QUERY.equals(elementName)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); SAML11AuthenticationQueryType query = SAML11ParserUtil.parseSAML11AuthenticationQuery(xmlEventReader); request.setQuery(query); } else if (SAML11Constants.ASSERTION_ARTIFACT.equals(elementName)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); SAML11AuthorizationDecisionQueryType query = SAML11ParserUtil .parseSAML11AuthorizationDecisionQueryType(xmlEventReader); request.setQuery(query); } else if (elementName.equals(JBossSAMLConstants.SIGNATURE.get())) {
SAML11ConditionsType conditions = SAML11ParserUtil.parseSAML11Conditions(xmlEventReader); assertion.setConditions(conditions); SAML11AuthenticationStatementType authStat = SAML11ParserUtil.parseAuthenticationStatement(xmlEventReader); assertion.add(authStat); .parseSAML11AttributeStatement(xmlEventReader); assertion.add(attributeStatementType); .parseSAML11AuthorizationDecisionStatement(xmlEventReader); assertion.add(authzStat);
tag = StaxParserUtil.getStartElementName(startElement); if (tag.equals(WSTrustConstants.XMLDSig.RSA_KEYVALUE)) { keyValue = parseRSAKeyValue(xmlEventReader); } else if (tag.equals(WSTrustConstants.XMLDSig.DSA_KEYVALUE)) { keyValue = parseDSAKeyValue(xmlEventReader); } else throw logger.parserUnknownTag(tag, startElement.getLocation());
Object attributeValue = parseAttributeValue(xmlEventReader); attributeType.add(attributeValue);
if (JBossSAMLConstants.ATTRIBUTE.get().equals(tag)) SAML11AttributeType attribute = parseSAML11Attribute(xmlEventReader); attributeStatementType.add(attribute);
if (tag.equals(WSTrustConstants.XMLDSig.KEYINFO)) KeyInfoType keyInfo = parseKeyInfo(xmlEventReader); subjectConfirmationData.setAnyType(keyInfo);
if (tag.equals(WSTrustConstants.XMLDSig.RSA_KEYVALUE)) keyValue.getContent().add(parseRSAKeyValue(xmlEventReader));
SAML11ConditionsType conditions = SAML11ParserUtil.parseSAML11Conditions(xmlEventReader); assertion.setConditions(conditions); SAML11AuthenticationStatementType authStat = SAML11ParserUtil.parseAuthenticationStatement(xmlEventReader); assertion.add(authStat); .parseSAML11AttributeStatement(xmlEventReader); assertion.add(attributeStatementType); .parseSAML11AuthorizationDecisionStatement(xmlEventReader); assertion.add(authzStat);
tag = StaxParserUtil.getStartElementName(startElement); if (tag.equals(WSTrustConstants.XMLDSig.RSA_KEYVALUE)) { keyValue = parseRSAKeyValue(xmlEventReader); } else if (tag.equals(WSTrustConstants.XMLDSig.DSA_KEYVALUE)) { keyValue = parseDSAKeyValue(xmlEventReader); } else throw logger.parserUnknownTag(tag, startElement.getLocation());
Object attributeValue = parseAttributeValue(xmlEventReader); attributeType.add(attributeValue);
if (JBossSAMLConstants.ATTRIBUTE.get().equals(tag)) SAML11AttributeType attribute = parseSAML11Attribute(xmlEventReader); attributeStatementType.add(attribute);
if (tag.equals(WSTrustConstants.XMLDSig.KEYINFO)) KeyInfoType keyInfo = parseKeyInfo(xmlEventReader); subjectConfirmationData.setAnyType(keyInfo);
if (tag.equals(WSTrustConstants.XMLDSig.RSA_KEYVALUE)) keyValue.getContent().add(parseRSAKeyValue(xmlEventReader));
startElement = (StartElement) xmlEvent; SAML11ConditionsType conditions = SAML11ParserUtil.parseSAML11Conditions(xmlEventReader); assertion.setConditions(conditions); } else if (SAML11Constants.AUTHENTICATION_STATEMENT.equals(tag)) { startElement = (StartElement) xmlEvent; SAML11AuthenticationStatementType authStat = SAML11ParserUtil.parseAuthenticationStatement(xmlEventReader); assertion.add(authStat); } else if (SAML11Constants.ATTRIBUTE_STATEMENT.equalsIgnoreCase(tag)) { SAML11AttributeStatementType attributeStatementType = SAML11ParserUtil .parseSAML11AttributeStatement(xmlEventReader); assertion.add(attributeStatementType); } else if (SAML11Constants.AUTHORIZATION_DECISION_STATEMENT.equalsIgnoreCase(tag)) { SAML11AuthorizationDecisionStatementType authzStat = SAML11ParserUtil .parseSAML11AuthorizationDecisionStatement(xmlEventReader); assertion.add(authzStat); } else
SAML11AttributeQueryType query = SAML11ParserUtil.parseSAML11AttributeQuery(xmlEventReader); request.setQuery(query); } else if (SAML11Constants.AUTHENTICATION_QUERY.equals(elementName)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); SAML11AuthenticationQueryType query = SAML11ParserUtil.parseSAML11AuthenticationQuery(xmlEventReader); request.setQuery(query); } else if (SAML11Constants.ASSERTION_ARTIFACT.equals(elementName)) { startElement = StaxParserUtil.getNextStartElement(xmlEventReader); SAML11AuthorizationDecisionQueryType query = SAML11ParserUtil .parseSAML11AuthorizationDecisionQueryType(xmlEventReader); request.setQuery(query); } else if (elementName.equals(JBossSAMLConstants.SIGNATURE.get())) {
/** * 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; }
tag = StaxParserUtil.getStartElementName(startElement); if (tag.equals(WSTrustConstants.XMLDSig.RSA_KEYVALUE)) { keyValue = parseRSAKeyValue(xmlEventReader); } else if (tag.equals(WSTrustConstants.XMLDSig.DSA_KEYVALUE)) { keyValue = parseDSAKeyValue(xmlEventReader); } 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()); } }
String tag = startElement.getName().getLocalPart(); if (JBossSAMLConstants.ATTRIBUTE.get().equals(tag)) { SAML11AttributeType attribute = parseSAML11Attribute(xmlEventReader); attributeStatementType.add(attribute); } else if (JBossSAMLConstants.SUBJECT.get().equals(tag)) {