use of com.sun.identity.liberty.ws.security.SecurityTokenManager in project OpenAM by OpenRock.
the class MessageProcessor method addBinaryToken.
/**
* Adds binary token to the security header.
*/
private BinarySecurityToken addBinaryToken(SOAPMessage msg) throws SOAPBindingException {
try {
SOAPHeader header = msg.getSOAPPart().getEnvelope().getHeader();
if (header == null) {
header = msg.getSOAPPart().getEnvelope().addHeader();
}
SecurityTokenManager manager = new SecurityTokenManager(null);
BinarySecurityToken binaryToken = manager.getX509CertificateToken();
binaryToken.setWSFVersion(SOAPBindingConstants.WSF_11_VERSION);
binaryToken.addToParent(header);
return binaryToken;
} catch (Exception ex) {
Utils.debug.error("MessageProcessor.addBinaryToken: " + "Could not add binary security token", ex);
throw new SOAPBindingException(Utils.bundle.getString("cannotAddCorrelationHeader"));
}
}
use of com.sun.identity.liberty.ws.security.SecurityTokenManager in project OpenAM by OpenRock.
the class DSTRequestHandler method generateBinarySecurityToken.
/**
* Generates the binary security token if the security profile is X509.
* @param msg Request Message.
* @return BinarySecurityToken.
* @exception DSTException.
*/
private BinarySecurityToken generateBinarySecurityToken(Message msg) throws DSTException {
try {
SecurityTokenManager manager = new SecurityTokenManager(msg.getToken());
BinarySecurityToken binaryToken = manager.getX509CertificateToken();
binaryToken.setWSFVersion(msg.getWSFVersion());
return binaryToken;
} catch (Exception e) {
DSTUtils.debug.error("DSTRequestHandler:generateBinary" + "SecurityToken: Error in generating binary security token.", e);
throw new DSTException(e);
}
}
Aggregations