public String getLocalName() { return delegateElement.getLocalName(); }
public String getLocalName() { return delegateHeader.getLocalName(); }
public String getLocalName() { return delegateElement.getLocalName(); }
public String getLocalName() { return delegateElement.getLocalName(); }
static boolean isSecondaryHeaderElement(SOAPElement element) { if ( element.getLocalName().equals(MessageConstants.ENCRYPTEDKEY_LNAME)) { NodeList nl = element.getElementsByTagNameNS(MessageConstants.XENC_NS, MessageConstants.XENC_REFERENCE_LIST_LNAME); if ( nl.getLength() == 0 ) { return true; } } return (element.getLocalName().equals(MessageConstants.WSSE_BINARY_SECURITY_TOKEN_LNAME) || element.getLocalName().equals(MessageConstants.USERNAME_TOKEN_LNAME) || element.getLocalName().equals(MessageConstants.SAML_ASSERTION_LNAME) || element.getLocalName().equals(MessageConstants.TIMESTAMP_LNAME) || element.getLocalName().equals(MessageConstants.SIGNATURE_CONFIRMATION_LNAME) || element.getLocalName().equals(MessageConstants.WSSE_SECURITY_TOKEN_REFERENCE_LNAME) || element.getLocalName().equals(MessageConstants.DERIVEDKEY_TOKEN_LNAME) || element.getLocalName().equals(MessageConstants.SECURITY_CONTEXT_TOKEN_LNAME)); }
@Override public SOAPElement addChildElement(SOAPElement element) throws SOAPException { String localName = element.getLocalName(); if ("Detail".equalsIgnoreCase(localName)) { if (hasDetail()) { log.severe("SAAJ0305.ver1_2.detail.exists.error"); throw new SOAPExceptionImpl("Cannot add Detail, Detail already exists"); } } return super.addChildElement(element); }
public static boolean isEncryptedKey(SOAPElement elem) { if (MessageConstants.XENC_ENCRYPTED_KEY_LNAME.equals(elem.getLocalName()) && MessageConstants.XENC_NS.equals(elem.getNamespaceURI())) { return true; } return false; }
public static boolean isBinarySecret(SOAPElement elem) { if (MessageConstants.BINARY_SECRET_LNAME.equals(elem.getLocalName()) && WSTrustConstants.WST_NAMESPACE.equals(elem.getNamespaceURI())) { return true; } return false; }
/** * Takes a SOAPElement and checks if it has the right name. */ public KeyIdentifier(SOAPElement element) throws XWSSecurityException { setSOAPElement(element); if (!(element.getLocalName().equals("KeyIdentifier") && XMLUtil.inWsseNS(element))) { log.log(Level.SEVERE, "WSS0756.invalid.key.identifier", element.getLocalName()); throw new XWSSecurityException("Invalid keyIdentifier passed"); } }
/** * @return Iterator over referenceURI Strings */ public Iterator getReferences() { Vector references = new Vector(); Iterator eachChild = getChildElements(); while (eachChild.hasNext()) { Node object = (Node)eachChild.next(); if (object.getNodeType() == Node.ELEMENT_NODE) { SOAPElement element = (SOAPElement) object; if (element.getLocalName().equals("DataReference") && XMLUtil.inEncryptionNS(element)) { references.addElement(element.getAttribute("URI")); } } } return references.iterator(); }
private SOAPElement getSOAPNode(SOAPMessageContext context, QName operation) { SOAPMessage message = context.getMessage(); SOAPBody body; try { body = message.getSOAPBody(); } catch (SOAPException e) { throw CXFUtility.getFault(e); } SOAPElement bodyElement = body; if (bodyElement.getNamespaceURI().equals("http://schemas.xmlsoap.org/soap/envelope/") && bodyElement.getLocalName().equals("Body")){ bodyElement = (SOAPElement)bodyElement.getElementsByTagNameNS(operation.getNamespaceURI(), operation.getLocalPart()).item(0); } if (logger.isDebugEnabled() && bodyElement != null) { logger.debug("Operation: {} {}", operation.getNamespaceURI(), operation.getLocalPart()); } return bodyElement; }
public X509SecurityToken(SOAPElement tokenElement, boolean isBSP) throws XWSSecurityException { super(tokenElement, isBSP); if (!(tokenElement.getLocalName().equals( MessageConstants.WSSE_BINARY_SECURITY_TOKEN_LNAME) && XMLUtil.inWsseNS(tokenElement))) { log.log(Level.SEVERE, "WSS0391.error.creating.X509SecurityToken", tokenElement.getTagName()); throw new XWSSecurityException( "BinarySecurityToken expected, found " + tokenElement.getTagName()); } }
/** * Takes a SOAPElement and checks if it has the right name. */ public DirectReference(SOAPElement element, boolean isBSP) throws XWSSecurityException { setSOAPElement(element); if (!(element.getLocalName().equals("Reference") && XMLUtil.inWsseNS(element))) { log.log(Level.SEVERE, "WSS0751.invalid.direct.reference", "{"+element.getNamespaceURI()+"}"+element.getLocalName()); throw new XWSSecurityException("Invalid DirectReference passed"); } if (isBSP && (getURI()==null)) { throw new XWSSecurityException("Violation of BSP R3062" + ": A wsse:Reference element in a SECURITY_TOKEN_REFERENCE MUST specify a URI attribute"); } }
@Override public SOAPElement addChildElement(SOAPElement arg0) throws SOAPException { String uri = arg0.getNamespaceURI(); if(uri == null) return null; String value = arg0.getValue(); if(value == null) value = arg0.getNodeValue(); if(value == null) return null; headers.add(new RpcHeader(uri, arg0.getLocalName(), value)); return arg0; }
/** * @throws XWSSecurityException * If the given element does not have an appropriate name. */ public ReferenceListHeaderBlock(SOAPElement element) throws XWSSecurityException { super(element); if (!(element.getLocalName().equals("ReferenceList") && XMLUtil.inEncryptionNS(element))) { log.log(Level.SEVERE, "WSS0362.error.creating.rlhb", element.getTagName()); throw new XWSSecurityException("Invalid ReferenceList passed"); } ownerDoc = element.getOwnerDocument(); size = element.getElementsByTagNameNS(MessageConstants.XENC_NS, "DataReference").getLength(); }
@Override protected void runTest() throws Throwable { SOAPElement root = newSOAPFactory().createElement("root", "ns1", "urn:ns1"); SOAPElement element = root.addChildElement("child", "ns2", "urn:ns2"); assertThat(element.getLocalName()).isEqualTo("child"); assertThat(element.getNamespaceURI()).isEqualTo("urn:ns2"); assertThat(element.getPrefix()).isEqualTo("ns2"); assertThat(element.getParentNode()).isSameAs(root); NamedNodeMap attributes = element.getAttributes(); assertThat(attributes.getLength()).isEqualTo(1); Attr attr = (Attr)attributes.item(0); assertThat(attr.getNamespaceURI()).isEqualTo(XMLConstants.XMLNS_ATTRIBUTE_NS_URI); assertThat(attr.getPrefix()).isEqualTo(XMLConstants.XMLNS_ATTRIBUTE); assertThat(attr.getLocalName()).isEqualTo("ns2"); } }
/** * @throws XWSSecurityException * If there is problem in initializing EncryptedData element. */ public EncryptedDataHeaderBlock(SOAPElement element) throws XWSSecurityException { setSOAPElement(element); if (!(element.getLocalName().equals( MessageConstants.ENCRYPTED_DATA_LNAME) && XMLUtil.inEncryptionNS(element))) { log.log(Level.SEVERE, "WSS0346.error.creating.edhb", element.getTagName()); throw new XWSSecurityException("Invalid EncryptedData passed"); } initializeEncryptedType(element); }
@Override protected void runTest() throws Throwable { SOAPElement root = newSOAPFactory().createElement("root", "p", "urn:test"); SOAPElement element = root.addChildElement("child"); assertThat(element.getLocalName()).isEqualTo("child"); assertThat(element.getNamespaceURI()).isNull(); assertThat(element.getPrefix()).isNull(); assertThat(element.getParentNode()).isSameAs(root); assertThat(element.getAttributes().getLength()).isEqualTo(0); } }
public SOAPElement addChildElement(SOAPElement soapElement) throws SOAPException { OMNamespace ns = omTarget.getOMFactory().createOMNamespace(soapElement.getNamespaceURI(), soapElement.getPrefix()); SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock( soapElement.getLocalName(), ns, omTarget); SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock); soapHeaderElement.setParentElement(this); return soapHeaderElement; }
public SOAPElement addChildElement(SOAPElement soapElement) throws SOAPException { OMNamespace ns = omTarget.getOMFactory().createOMNamespace(soapElement.getNamespaceURI(), soapElement.getPrefix()); SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock( soapElement.getLocalName(), ns, omTarget); SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock); soapHeaderElement.setParentElement(this); return soapHeaderElement; }