public String getKeyIdentifierEncodingType() { if (containsKeyIdentifier()) { Element elem = getFirstElement(); return elem.getAttributeNS(null, "EncodingType"); } return null; }
public String getKeyIdentifierValueType() { if (containsKeyIdentifier()) { Element elem = getFirstElement(); return elem.getAttributeNS(null, "ValueType"); } return null; }
private void createKeyIdentifier(Document doc, String uri, Node node, boolean base64) { Element keyId = doc.createElementNS(WSS4JConstants.WSSE_NS, "wsse:KeyIdentifier"); keyId.setAttributeNS(null, "ValueType", uri); if (base64) { keyId.setAttributeNS(null, "EncodingType", WSS4JConstants.BASE64_ENCODING); } keyId.appendChild(node); Element elem = getFirstElement(); if (elem != null) { element.replaceChild(keyId, elem); } else { element.appendChild(keyId); } }
/** * Set an unknown element. * * @param unknownElement the org.w3c.dom.Element to put into this * SecurityTokenReference */ public void setUnknownElement(Element unknownElement) { Element elem = getFirstElement(); if (elem != null) { element.replaceChild(unknownElement, elem); } else { element.appendChild(unknownElement); } }
public String getKeyIdentifierValue() { if (containsKeyIdentifier()) { return XMLUtils.getElementText(getFirstElement()); } return null; }
private DOMX509IssuerSerial getIssuerSerial() throws WSSecurityException { if (issuerSerial != null) { return issuerSerial; } Element elem = getFirstElement(); if (elem == null) { return null; } if (WSS4JConstants.X509_DATA_LN.equals(elem.getLocalName())) { elem = XMLUtils.findElement( elem, WSS4JConstants.X509_ISSUER_SERIAL_LN, WSS4JConstants.SIG_NS ); } issuerSerial = new DOMX509IssuerSerial(elem); return issuerSerial; }
public byte[] getSKIBytes() { if (skiBytes != null) { return skiBytes; } String text = XMLUtils.getElementText(getFirstElement()); if (text != null) { skiBytes = org.apache.xml.security.utils.XMLUtils.decode(text); } return skiBytes; }
/** * set the reference. * * @param ref */ public void setReference(Reference ref) { Element elem = getFirstElement(); if (elem != null) { element.replaceChild(ref.getElement(), elem); } else { element.appendChild(ref.getElement()); } this.reference = ref; }
bspEnforcer.handleBSPRule(BSPRule.R3054); String encodingType = getFirstElement().getAttributeNS(null, "EncodingType");
Element elem = getFirstElement(); String value = elem.getAttributeNS(null, "ValueType"); String text = XMLUtils.getElementText(getFirstElement()); if (text != null) { byte[] thumb = org.apache.xml.security.utils.XMLUtils.decode(text);
Element writeSecurityTokenReference( W3CDOMStreamWriter writer, String id, String instance, String refValueType ) { Reference ref = new Reference(writer.getDocument()); ref.setURI(id); if (refValueType != null) { ref.setValueType(refValueType); } SecurityTokenReference str = new SecurityTokenReference(writer.getDocument()); str.addWSSENamespace(); str.setReference(ref); if (instance != null) { try { Element firstChildElement = str.getFirstElement(); if (firstChildElement != null) { int version = NegotiationUtils.getWSCVersion(refValueType); String ns = ConversationConstants.getWSCNs(version); firstChildElement.setAttributeNS(ns, "wsc:" + ConversationConstants.INSTANCE_LN, instance); } } catch (WSSecurityException e) { //just return without wsc:Instance } } writer.getCurrentNode().appendChild(str.getElement()); return str.getElement(); }
Element writeSecurityTokenReference( W3CDOMStreamWriter writer, String id, String instance, String refValueType ) { Reference ref = new Reference(writer.getDocument()); ref.setURI(id); if (refValueType != null) { ref.setValueType(refValueType); } SecurityTokenReference str = new SecurityTokenReference(writer.getDocument()); str.addWSSENamespace(); str.setReference(ref); if (instance != null) { try { Element firstChildElement = str.getFirstElement(); if (firstChildElement != null) { int version = NegotiationUtils.getWSCVersion(refValueType); String ns = ConversationConstants.getWSCNs(version); firstChildElement.setAttributeNS(ns, "wsc:" + ConversationConstants.INSTANCE_LN, instance); } } catch (WSSecurityException e) { //just return without wsc:Instance } } writer.getCurrentNode().appendChild(str.getElement()); return str.getElement(); }