public String getValue(Node rootNode, XMLPathCtx context) { String nameSpaceURI = getNamespaceURI(rootNode); if (startsWith ? nameSpaceURI.startsWith(namespace) : nameSpaceURI.equals(namespace)) { if (nodeExists != null && context.findIn(rootNode).node(nodeExists).get() != null) { return value; } else { return value; } } return null; } }
public void setAuthenticationMethods(Collection<AuthenticationMethod> methods) { Node newSuppAuthMethodsElem = m_capsDoc.createElementNS("http://www.gdi-nrw.org/wss", "SupportedAuthenticationMethodList"); Node capabilityElement = m_xPathCtx.findIn(m_capsDoc).node("//wss:Capability").get(); Node lOldSuppAuthMethodsElem = m_xPathCtx.findIn(capabilityElement).node("//wss:Capability/wss:SupportedAuthenticationMethodList").get(); if (lOldSuppAuthMethodsElem != null) { capabilityElement.removeChild(lOldSuppAuthMethodsElem); } AuthenticationMethodDOMRenderer renderer = new AuthenticationMethodDOMRenderer(); for (AuthenticationMethod method : methods) { Element authMethodElem = renderer.render(method); Node importedNode = m_capsDoc.importNode(authMethodElem, true); newSuppAuthMethodsElem.appendChild(importedNode); } capabilityElement.appendChild(newSuppAuthMethodsElem); }
private Node getSecuredServiceTypeNode() { Node securedServiceTypeNode = m_xPathCtx.findIn(m_capsDoc).node("//wss:SecuredServiceType").get(); return securedServiceTypeNode; }
public void setLicensePrecondition(LicensePrecondition licenseProcondition) { if (licenseProcondition == null) { return; } Node caproot = m_xPathCtx.findIn(m_capsDoc).node("//wss:Capability").get(); String baseUrl = licenseProcondition.getBaseUrl(); String redirectUrl = licenseProcondition.getRedirectUrl(); String ssoUrl = licenseProcondition.getSsoGetUrl(); String filledTemplate = String.format(licensePreconditionTemplate, baseUrl, ssoUrl, redirectUrl, baseUrl); StringReader reader = new StringReader(filledTemplate); Document templateDoc = DOMParser.createNew().parse(new InputSource(reader)); Node importedTemplateNode = m_capsDoc.importNode(templateDoc.getDocumentElement(), true); caproot.appendChild(importedTemplateNode); }
public String getTemplateFor(Document document) { Node rootNode = context.findIn(document).node("/*[1]").get(); String serviceType = getServiceTypeFrom(rootNode); String version = context.findIn(rootNode).text("@version").get(); return version.equals("") ? templateMap.get(serviceType) : templateMap.get(serviceType + "_" + version); }
public Element getAuthnRequest() { return (Element) getXpathCtx().findIn( m_paosResponse).node("//samlp:AuthnRequest").get(); }
private Node find(final String xpath) { Node node = XMLPathCtx.createNew().addNamespaces(namespaces).findIn(sourceDocument).node(xpath).get(); if (node == null) { throw new IllegalArgumentException("XPath <" + xpath + "> must resolve to an node"); } return (Element) node; }
public Element getRelayState() { return (Element) getXpathCtx().findIn(m_paosResponse).node("//ecp:RelayState").get(); }
Node textBlock = ctxResponse.findIn(member).node(".//*/" + SOSInterceptorGlobals.ELEMENT_SWE_TEXTBLOCK).get(); String blockSeparator = ";"; if (textBlock.hasAttributes()) { .getTextContent(); Node values = ctxResponse.findIn(member).node(".//*/" + SOSInterceptorGlobals.ELEMENT_SWE_VALUES).get(); if (values != null && values.getTextContent() != null && !values.getTextContent().isEmpty()) { String[] blocks = values.getTextContent().split(blockSeparator);
.node("./*/" + documentPrefix + SOSInterceptorGlobals.ELEMENT_PROCEDURE).get(); if (procedure.getAttributes().getNamedItem(SOSInterceptorGlobals.ATTRIBUTE_XLINK_HREF) != null) { String id =
Node queryFilterSubNode = ctx.findIn(queryNode).node("Filter/*").get();
ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_PERIOD + "/" + SOSInterceptorGlobals.ELEMENT_GML_BEGIN_POSITION).get(); Node endPositionNode = ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_PERIOD + "/" + SOSInterceptorGlobals.ELEMENT_GML_END_POSITION).get(); Node timePositionNode = ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_INSTANT + "/" + SOSInterceptorGlobals.ELEMENT_GML_TIME_POSITION).get();
ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_PERIOD + "/" + SOSInterceptorGlobals.ELEMENT_GML_BEGIN_POSITION).get(); Node endPositionNode = ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_PERIOD + "/" + SOSInterceptorGlobals.ELEMENT_GML_END_POSITION).get(); Node timePositionNode = ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_INSTANT + "/" + SOSInterceptorGlobals.ELEMENT_GML_TIME_POSITION).get();
ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_PERIOD + "/" + SOSInterceptorGlobals.ELEMENT_GML_BEGIN_POSITION).get(); Node endPositionNode = ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_PERIOD + "/" + SOSInterceptorGlobals.ELEMENT_GML_END_POSITION).get(); Node timePositionNode = ctxRequest .findIn(actualNode) .node(SOSInterceptorGlobals.ELEMENT_GML_TIME_INSTANT + "/" + SOSInterceptorGlobals.ELEMENT_GML_TIME_POSITION).get();
private List<AuthenticationMethod> getSupportedAuthenticationMethods() { List<AuthenticationMethod> supportedAuthNMethods = new ArrayList<AuthenticationMethod>(); NodeList authenticationMethodList = m_xPathCtx.findIn(m_capsDoc).all("//authn:AuthenticationMethod").get(); for (int i = 0; i < authenticationMethodList.getLength(); i++) { org.w3c.dom.Node currentAuthMethod = authenticationMethodList.item(i); String type = m_xPathCtx.findIn(currentAuthMethod).text("@xsi:type").get(); type = type.substring(type.lastIndexOf(":") + 1); String method = m_xPathCtx.findIn(currentAuthMethod).text("@method").get(); AuthenticationMethod supportedAuthMethod; if (type.equals("WASType")) { org.w3c.dom.Node accAuthNServiceNode = m_xPathCtx.findIn(currentAuthMethod).node("//authn:AuthenticationService").get(); String wasName = m_xPathCtx.findIn(accAuthNServiceNode).text("authn:Name/text()").get(); String wasUrl = m_xPathCtx.findIn(accAuthNServiceNode).text("authn:OnlineResource/@xlink:href").get(); supportedAuthMethod = new org.n52.security.authentication.WASAuthenticationMethod(wasName, wasUrl, ""); } else { supportedAuthMethod = AuthenticationMethodFactory.getDefault().create(method); } supportedAuthNMethods.add(supportedAuthMethod); } return supportedAuthNMethods; } }
public static SAML2IdPMetadata createFrom(Element idpSsoDescrElement) throws MalformedURLException { XMLPathCtx xpathCtx = XMLPathCtx.createNew().addNamespace("md", "urn:oasis:names:tc:SAML:2.0:metadata"); NodeList nodeList = xpathCtx.findIn(idpSsoDescrElement).all("md:SingleSignOnService").get(); SAML2IdPMetadata metadata = new SAML2IdPMetadata(); for (int i = 0; i < nodeList.getLength(); i++) { Element ssoService = (Element) nodeList.item(i); String binding = ssoService.getAttribute("Binding"); String location = ssoService.getAttribute("Location"); metadata.addSSOBinding(binding, new URL(location)); } Element organizationElem = (Element) xpathCtx.findIn(idpSsoDescrElement).node("./../md:Organization").get(); if (organizationElem == null) { String entityID = xpathCtx.findIn(idpSsoDescrElement).text("./../@entityID").get(); metadata.setOrganisationDisplayName(entityID); } else { String idpDisplayName = xpathCtx.findIn(organizationElem).text("md:OrganizationDisplayName/text()").get(); metadata.setOrganisationDisplayName(idpDisplayName); } return metadata; }
"http://www.opengis.net/wps/1.0.0"); Node nl = ctx.findIn(doc).node("/wps:Execute/ows:Identifier/text()").get(); String requestedProcessId = nl.getNodeValue();
Document lDoc = getThematicTreeDAO().asXmlDocument(pLocale); Node rootNode = xmlPathContextFactory.createContext().findIn(lDoc).node("*/node").get();
Node envelope = ctx.findIn(doc) .node("//*/sos:Contents/sos:ObservationOfferingList/sos:ObservationOffering[@gml:id='" + offeringId + "']/gml:boundedBy/gml:Envelope[@srsName='" + srs + "']").get();
/** * @return */ public LicensePrecondition getLicensePrecondition() { org.w3c.dom.Node licBroClientElement = m_xPathCtx.findIn(m_capsDoc).node("/wss:WSS_Capabilities/wss:Capability/licb:LicensePrecondition/licb:LicenseBrokerClient").get(); if (licBroClientElement == null) { return null; } String licenseRedirectURL = m_xPathCtx.findIn(licBroClientElement).text("licb:RedirectURL/text()").get(); String ssoGetURL = m_xPathCtx.findIn(licBroClientElement).text("licb:SSOGetURL").get(); if (licenseRedirectURL == null && ssoGetURL == null) { String baseUrl = m_xPathCtx.findIn(licBroClientElement).text("ows:DCP/ows:HTTP/ows:Post/text()").get(); if (baseUrl == null) { return null; } baseUrl = ensureSingleEndingSlash(baseUrl); licenseRedirectURL = baseUrl + "getOrCreateLicenseToken.faces"; ssoGetURL = baseUrl + "getLicenseToken.faces"; } LicensePrecondition licensePrecondition = new LicensePrecondition(ssoGetURL.trim(), licenseRedirectURL.trim(), null); return licensePrecondition; }