return customTokeId;
} else {
Axis2Util.useDOOM(false);
STSClient client = new STSClient(rmd.getMsgContext()
.getConfigurationContext());
// Set request action
client.setAction(action);
client.setVersion(rmd.getWstVersion());
client.setRstTemplate(rstTemplate);
// Set crypto information
Crypto crypto = RampartUtil.getSignatureCrypto(rmd.getPolicyData().getRampartConfig(),
rmd.getMsgContext().getAxisService().getClassLoader());
CallbackHandler cbh = RampartUtil.getPasswordCB(rmd);
client.setCryptoInfo(crypto, cbh);
// Get service policy
Policy servicePolicy = rmd.getServicePolicy();
// Get service epr
String servceEprAddress = rmd.getMsgContext()
.getOptions().getTo().getAddress();
//If addressing version can be found set it
Object addrVersionNs = msgContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
if(addrVersionNs != null) {
client.setAddressingNs((String)addrVersionNs);
}
Options options = new Options();
options.setUserName(rmd.getMsgContext().getOptions().getUserName());
options.setPassword(rmd.getMsgContext().getOptions().getPassword());
if (msgContext.getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER) != null) {
Protocol protocolHandler =
(Protocol)msgContext.getProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER);;
options.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER, protocolHandler);
}
if (msgContext.getParameter(WSHandlerConstants.PW_CALLBACK_REF) != null ) {
Parameter pwCallback = msgContext.getParameter(WSHandlerConstants.PW_CALLBACK_REF);
client.addParameter(pwCallback);
}
client.setOptions(options);
//Set soap version
if (msgContext.isSOAP11()) {
client.setSoapVersion(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
} else {
client.setSoapVersion(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
}
//Make the request
org.apache.rahas.Token rst =
client.requestSecurityToken(servicePolicy,
issuerEpr,
issuerPolicy,
servceEprAddress);
//Add the token to token storage