/** * Get the Attribute value * * @param startElement * @param tag localpart of the qname of the attribute * @return */ public static String getAttributeValue(StartElement startElement, String tag) { String result = null; Attribute attr = startElement.getAttributeByName(new QName(tag)); if (attr != null) result = getAttributeValue(attr); return result; }
/** * Get the Attribute value * @param startElement * @param tag localpart of the qname of the attribute * @return */ public static String getAttributeValue(StartElement startElement, String tag) { String result = null; Attribute attr = startElement.getAttributeByName(new QName(tag)); if (attr != null) result = getAttributeValue(attr); return result; }
/** * Get the Attribute value * @param startElement * @param tag localpart of the qname of the attribute * @return */ public static String getAttributeValue(StartElement startElement, String tag) { String result = null; Attribute attr = startElement.getAttributeByName(new QName(tag)); if (attr != null) result = getAttributeValue(attr); return result; }
protected SAML11RequestType parseRequiredAttributes(StartElement startElement) throws ParsingException { Attribute idAttr = startElement.getAttributeByName(new QName(SAML11Constants.REQUEST_ID)); if (idAttr == null) throw new RuntimeException(REQD_ATTRIBUTE + SAML11Constants.REQUEST_ID); String id = StaxParserUtil.getAttributeValue(idAttr); Attribute issueInstantAttr = startElement.getAttributeByName(new QName(SAML11Constants.ISSUE_INSTANT)); if (issueInstantAttr == null) throw new RuntimeException(REQD_ATTRIBUTE + SAML11Constants.ISSUE_INSTANT); XMLGregorianCalendar issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttr)); return new SAML11RequestType(id, issueInstant); }
protected SAML11RequestType parseRequiredAttributes(StartElement startElement) throws ParsingException { Attribute idAttr = startElement.getAttributeByName(new QName(SAML11Constants.REQUEST_ID)); if (idAttr == null) throw new RuntimeException(REQD_ATTRIBUTE + SAML11Constants.REQUEST_ID); String id = StaxParserUtil.getAttributeValue(idAttr); Attribute issueInstantAttr = startElement.getAttributeByName(new QName(SAML11Constants.ISSUE_INSTANT)); if (issueInstantAttr == null) throw new RuntimeException(REQD_ATTRIBUTE + SAML11Constants.ISSUE_INSTANT); XMLGregorianCalendar issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttr)); return new SAML11RequestType(id, issueInstant); }
private EndpointType getEndpointType(StartElement startElement) { Attribute bindingAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.BINDING.get())); String binding = StaxParserUtil.getAttributeValue(bindingAttr); Attribute locationAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.LOCATION.get())); String location = StaxParserUtil.getAttributeValue(locationAttr); EndpointType endpoint = new IndexedEndpointType(URI.create(binding), URI.create(location)); Attribute responseLocation = startElement.getAttributeByName(new QName(JBossSAMLConstants.RESPONSE_LOCATION.get())); if (responseLocation != null) { endpoint.setResponseLocation(URI.create(StaxParserUtil.getAttributeValue(responseLocation))); } return endpoint; }
protected void parseRequiredAttributes(StartElement startElement) throws ParsingException { Attribute idAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.ID.get())); if (idAttr == null) throw new RuntimeException(ErrorCodes.REQD_ATTRIBUTE + "ID"); id = StaxParserUtil.getAttributeValue(idAttr); Attribute versionAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.VERSION.get())); if (versionAttr == null) throw new RuntimeException(ErrorCodes.REQD_ATTRIBUTE + "Version"); version = StaxParserUtil.getAttributeValue(versionAttr); Attribute issueInstantAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.ISSUE_INSTANT.get())); if (issueInstantAttr == null) throw new RuntimeException(ErrorCodes.REQD_ATTRIBUTE + "IssueInstant"); issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttr)); }
protected void populateKeyValueType(KeyValueType kvt, StartElement startElement) { QName attributeQName = new QName("", KEY); Attribute attribute = startElement.getAttributeByName(attributeQName); if (attribute != null) kvt.setKey(StaxParserUtil.getAttributeValue(attribute)); attributeQName = new QName("", OPTION); attribute = startElement.getAttributeByName(attributeQName); if (attribute != null) kvt.setKey(StaxParserUtil.getAttributeValue(attribute)); attributeQName = new QName("", VALUE); attribute = startElement.getAttributeByName(attributeQName); if (attribute != null) kvt.setValue(StaxParserUtil.getAttributeValue(attribute)); } }
private EndpointType getEndpointType(StartElement startElement) { Attribute bindingAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.BINDING.get())); String binding = StaxParserUtil.getAttributeValue(bindingAttr); Attribute locationAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.LOCATION.get())); String location = StaxParserUtil.getAttributeValue(locationAttr); EndpointType endpoint = new IndexedEndpointType(URI.create(binding), URI.create(location)); Attribute responseLocation = startElement .getAttributeByName(new QName(JBossSAMLConstants.RESPONSE_LOCATION.get())); if (responseLocation != null) { endpoint.setResponseLocation(URI.create(StaxParserUtil.getAttributeValue(responseLocation))); } return endpoint; }
/** * Given a start element, obtain the xsi:type defined * @param startElement * @return * @throws RuntimeException if xsi:type is missing */ public static String getXSITypeValue(StartElement startElement) { Attribute xsiType = startElement.getAttributeByName(new QName(JBossSAMLURIConstants.XSI_NSURI.get(), JBossSAMLConstants.TYPE.get())); if (xsiType == null) throw new RuntimeException(EXPECTED_XSI); return StaxParserUtil.getAttributeValue(xsiType); }
/** * Given a start element, obtain the xsi:type defined * @param startElement * @return * @throws RuntimeException if xsi:type is missing */ public static String getXSITypeValue(StartElement startElement) { Attribute xsiType = startElement.getAttributeByName(new QName(JBossSAMLURIConstants.XSI_NSURI.get(), JBossSAMLConstants.TYPE.get())); if (xsiType == null) throw new RuntimeException(EXPECTED_XSI); return StaxParserUtil.getAttributeValue(xsiType); }
protected SAML11RequestType parseRequiredAttributes(StartElement startElement) throws ParsingException { Attribute idAttr = startElement.getAttributeByName(new QName(SAML11Constants.REQUEST_ID)); if (idAttr == null) throw logger.parserRequiredAttribute(SAML11Constants.REQUEST_ID); String id = StaxParserUtil.getAttributeValue(idAttr); Attribute issueInstantAttr = startElement.getAttributeByName(new QName(SAML11Constants.ISSUE_INSTANT)); if (issueInstantAttr == null) throw logger.parserRequiredAttribute(SAML11Constants.ISSUE_INSTANT); XMLGregorianCalendar issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttr)); return new SAML11RequestType(id, issueInstant); }
private AssertionType parseBaseAttributes(StartElement nextElement) throws ParsingException { Attribute idAttribute = nextElement.getAttributeByName(new QName(JBossSAMLConstants.ID.get())); String id = StaxParserUtil.getAttributeValue(idAttribute); Attribute versionAttribute = nextElement.getAttributeByName(new QName(JBossSAMLConstants.VERSION.get())); String version = StaxParserUtil.getAttributeValue(versionAttribute); StringUtil.match(JBossSAMLConstants.VERSION_2_0.get(), version); Attribute issueInstantAttribute = nextElement .getAttributeByName(new QName(JBossSAMLConstants.ISSUE_INSTANT.get())); XMLGregorianCalendar issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttribute)); return new AssertionType(id, issueInstant); }
private AssertionType parseBaseAttributes(StartElement nextElement) throws ParsingException { Attribute idAttribute = nextElement.getAttributeByName(new QName(JBossSAMLConstants.ID.get())); String id = StaxParserUtil.getAttributeValue(idAttribute); Attribute versionAttribute = nextElement.getAttributeByName(new QName(JBossSAMLConstants.VERSION.get())); String version = StaxParserUtil.getAttributeValue(versionAttribute); StringUtil.match(JBossSAMLConstants.VERSION_2_0.get(), version); Attribute issueInstantAttribute = nextElement.getAttributeByName(new QName(JBossSAMLConstants.ISSUE_INSTANT.get())); XMLGregorianCalendar issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttribute)); return new AssertionType(id, issueInstant); }
private AssertionType parseBaseAttributes(StartElement nextElement) throws ParsingException { Attribute idAttribute = nextElement.getAttributeByName(new QName(JBossSAMLConstants.ID.get())); String id = StaxParserUtil.getAttributeValue(idAttribute); Attribute versionAttribute = nextElement.getAttributeByName(new QName(JBossSAMLConstants.VERSION.get())); String version = StaxParserUtil.getAttributeValue(versionAttribute); StringUtil.match(JBossSAMLConstants.VERSION_2_0.get(), version); Attribute issueInstantAttribute = nextElement .getAttributeByName(new QName(JBossSAMLConstants.ISSUE_INSTANT.get())); XMLGregorianCalendar issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttribute)); return new AssertionType(id, issueInstant); }
protected void parseRequiredAttributes(StartElement startElement) throws ParsingException { Attribute idAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.ID.get())); if (idAttr == null) throw logger.parserRequiredAttribute("ID"); id = StaxParserUtil.getAttributeValue(idAttr); Attribute versionAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.VERSION.get())); if (versionAttr == null) throw logger.parserRequiredAttribute("Version"); version = StaxParserUtil.getAttributeValue(versionAttr); Attribute issueInstantAttr = startElement.getAttributeByName(new QName(JBossSAMLConstants.ISSUE_INSTANT.get())); if (issueInstantAttr == null) throw logger.parserRequiredAttribute("IssueInstant"); issueInstant = XMLTimeUtil.parse(StaxParserUtil.getAttributeValue(issueInstantAttr)); }
/** * Given a start element, obtain the xsi:type defined * * @param startElement * @return * @throws RuntimeException if xsi:type is missing */ public static String getXSITypeValue(StartElement startElement) { Attribute xsiType = startElement.getAttributeByName(new QName(JBossSAMLURIConstants.XSI_NSURI.get(), JBossSAMLConstants.TYPE.get())); if (xsiType == null) throw logger.parserExpectedXSI(EXPECTED_XSI); return StaxParserUtil.getAttributeValue(xsiType); }
private LocalizedNameType getLocalizedName(XMLEventReader xmlEventReader, StartElement startElement) throws ParsingException { Attribute lang = startElement.getAttributeByName(new QName(JBossSAMLURIConstants.XML.get(), "lang")); String langVal = StaxParserUtil.getAttributeValue(lang); LocalizedNameType localName = new LocalizedNameType(langVal); localName.setValue(StaxParserUtil.getElementText(xmlEventReader)); return localName; }
private LocalizedNameType getLocalizedName(XMLEventReader xmlEventReader, StartElement startElement) throws ParsingException { Attribute lang = startElement.getAttributeByName(new QName(JBossSAMLURIConstants.XML.get(), "lang")); String langVal = StaxParserUtil.getAttributeValue(lang); LocalizedNameType localName = new LocalizedNameType(langVal); localName.setValue(StaxParserUtil.getElementText(xmlEventReader)); return localName; }
private LocalizedNameType getLocalizedName(XMLEventReader xmlEventReader, StartElement startElement) throws ParsingException { Attribute lang = startElement.getAttributeByName(new QName(JBossSAMLURIConstants.XML.get(), "lang")); String langVal = StaxParserUtil.getAttributeValue(lang); LocalizedNameType localName = new LocalizedNameType(langVal); localName.setValue(StaxParserUtil.getElementText(xmlEventReader)); return localName; }