/**
* Set the raw (plain text) password used to compute secret key.
*/
public void setRawPassword(RequestData data) throws WSSecurityException {
WSPasswordCallback pwCb =
new WSPasswordCallback(
getName(), getPassword(), getPasswordType(),
WSPasswordCallback.Usage.USERNAME_TOKEN
);
if (data.getCallbackHandler() == null) {
LOG.debug("CallbackHandler is null");
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILED_AUTHENTICATION);
}
try {
data.getCallbackHandler().handle(new Callback[]{pwCb});
} catch (IOException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getMessage(), e);
}
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILED_AUTHENTICATION, e
);
} catch (UnsupportedCallbackException e) {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getMessage(), e);
}
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILED_AUTHENTICATION, e
);
}
rawPassword = pwCb.getPassword();
}