Reputation: 2353
How to set the username and password as a hardcode in a WS-Security usernameToken police?
....
<ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
<ramp:user>admin</ramp:user>
<ramp:password......> ???
</ramp:RampartConfig>
....
Upvotes: 1
Views: 356
Reputation: 5595
You must use the <passwordCallbackClass>
If you want to hardcode the password, define a class like this.
public class MyHardcodedPasswordHandler implements CallbackHandler {
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
for (Callback callback : callbacks) {
WSPasswordCallback pwcb = (WSPasswordCallback)callback;
pwcb.setPassword("myPassword");
}
}
}
Then in the rampart config
<passwordCallbackClass>something.something.MyHardcodedPasswordHandler</passwordCallbackClass>
Upvotes: 1