private Element convertToDOM(
BinarySecurityTokenType binarySecurityTokenType,
byte[] securityTokenData
) {
Document doc = DOMUtils.newDocument();
BinarySecurity binarySecurity = null;
if (WSSConstants.NS_X509_V3_TYPE.equals(binarySecurityTokenType.getValueType())) {
binarySecurity = new X509Security(doc);
} else if (WSSConstants.NS_X509PKIPathv1.equals(binarySecurityTokenType.getValueType())) {
binarySecurity = new PKIPathSecurity(doc);
} else if (WSSConstants.NS_GSS_Kerberos5_AP_REQ.equals(binarySecurityTokenType.getValueType())) {
binarySecurity = new KerberosSecurity(doc);
}
binarySecurity.addWSSENamespace();
binarySecurity.addWSUNamespace();
binarySecurity.setEncodingType(binarySecurityTokenType.getEncodingType());
binarySecurity.setValueType(binarySecurityTokenType.getValueType());
binarySecurity.setID(binarySecurityTokenType.getId());
binarySecurity.setToken(securityTokenData);
return binarySecurity.getElement();
}