/** * Returns the BST Token element. * The method can be called any time after <code>prepare()</code>. * @return the BST Token element */ public Element getBinarySecurityTokenElement() { if (bstToken != null) { return bstToken.getElement(); } return null; }
@Override public int hashCode() { int result = 17; byte[] token = getToken(); if (token != null) { result = 31 * result + Arrays.hashCode(token); } result = 31 * result + getValueType().hashCode(); result = 31 * result + getEncodingType().hashCode(); return result; }
/** * Get the id of the BSt generated during <code>prepare()</code>. * * @return Returns the the value of wsu:Id attribute of the * BinaruSecurityToken element. */ public String getBSTTokenId() { if (bstToken == null) { return null; } return bstToken.getID(); }
ref.setValueType(bstToken.getValueType()); secRef.setReference(ref); bstToken.setID(certUri); wsDocInfo.addTokenElement(bstToken.getElement(), false); break;
); String encoding = getEncodingType(); if (bspCompliant && !BASE64_ENCODING.equals(encoding)) { String valueType = getValueType(); if (bspCompliant && (valueType == null || "".equals(valueType))) { throw new WSSecurityException(
byte[] token = binarySecurity.getToken();
bstToken = new X509Security(document); ((X509Security) bstToken).setX509Certificate(remoteCert); bstToken.setID(certUri); ref.setValueType(bstToken.getValueType()); secToken.setReference(ref); break;
/** * set the token information. * * @param data */ public void setToken(byte[] data) { if (data == null) { throw new IllegalArgumentException("data == null"); } Text node = getFirstNode(); node.setData(Base64.encode(data)); }
/** * Constructor. * * @param doc */ public BinarySecurity(Document doc) { element = doc.createElementNS(WSConstants.WSSE_NS, "wsse:BinarySecurityToken"); setEncodingType(BASE64_ENCODING); element.appendChild(doc.createTextNode("")); }
/** * Checks the <code>element</code> and creates appropriate binary security object. * * @param element The XML element that contains either a <code>BinarySecurityToken * </code> or a <code>PKIPath</code> element. * @param config A WSSConfig instance * @return a BinarySecurity token element * @throws WSSecurityException */ private BinarySecurity createSecurityToken( Element element, WSSConfig config ) throws WSSecurityException { String type = element.getAttributeNS(null, "ValueType"); BinarySecurity token = null; if (X509Security.X509_V3_TYPE.equals(type)) { token = new X509Security(element, config.isWsiBSPCompliant()); } else if (PKIPathSecurity.getType().equals(type)) { token = new PKIPathSecurity(element, config.isWsiBSPCompliant()); } else if (KerberosSecurity.isKerberosToken(type)) { token = new KerberosSecurity(element, config.isWsiBSPCompliant()); } else { token = new BinarySecurity(element, config.isWsiBSPCompliant()); } return token; }
ref.setValueType(bstToken.getValueType()); secRef.setReference(ref); bstToken.setID(certUri); wsDocInfo.addTokenElement(bstToken.getElement(), false); break;
); String encoding = getEncodingType(); if (bspCompliant && !BASE64_ENCODING.equals(encoding)) { String valueType = getValueType(); if (bspCompliant && (valueType == null || "".equals(valueType))) { throw new WSSecurityException(
byte[] token = binarySecurity.getToken();
bstToken = new X509Security(document); ((X509Security) bstToken).setX509Certificate(remoteCert); bstToken.setID(certUri); ref.setValueType(bstToken.getValueType()); secToken.setReference(ref); break;
/** * set the token information. * * @param data */ public void setToken(byte[] data) { if (data == null) { throw new IllegalArgumentException("data == null"); } Text node = getFirstNode(); node.setData(Base64.encode(data)); }
/** * Constructor. * * @param doc */ public BinarySecurity(Document doc) { element = doc.createElementNS(WSConstants.WSSE_NS, "wsse:BinarySecurityToken"); setEncodingType(BASE64_ENCODING); element.appendChild(doc.createTextNode("")); }
/** * Checks the <code>element</code> and creates appropriate binary security object. * * @param element The XML element that contains either a <code>BinarySecurityToken * </code> or a <code>PKIPath</code> element. * @param config A WSSConfig instance * @return a BinarySecurity token element * @throws WSSecurityException */ private BinarySecurity createSecurityToken( Element element, WSSConfig config ) throws WSSecurityException { String type = element.getAttributeNS(null, "ValueType"); BinarySecurity token = null; if (X509Security.X509_V3_TYPE.equals(type)) { token = new X509Security(element, config.isWsiBSPCompliant()); } else if (PKIPathSecurity.getType().equals(type)) { token = new PKIPathSecurity(element, config.isWsiBSPCompliant()); } else if (KerberosSecurity.isKerberosToken(type)) { token = new KerberosSecurity(element, config.isWsiBSPCompliant()); } else { token = new BinarySecurity(element, config.isWsiBSPCompliant()); } return token; }
@Override public int hashCode() { int result = 17; byte[] token = getToken(); if (token != null) { result = 31 * result + Arrays.hashCode(token); } result = 31 * result + getValueType().hashCode(); result = 31 * result + getEncodingType().hashCode(); return result; }
bstToken = new X509Security(doc); ((X509Security) bstToken).setX509Certificate(certs[0]); bstToken.setID(certUri); wsDocInfo.addTokenElement(bstToken.getElement(), false); ref.setValueType(bstToken.getValueType()); secRef.setReference(ref); break;
/** * Returns the BST Token element. * The method can be called any time after <code>prepare()</code>. * @return the BST Token element */ public Element getBinarySecurityTokenElement() { if (bstToken != null) { return bstToken.getElement(); } return null; }