I'm using JBoss Web Services for a payment service application. At some point I need to make remote SOAP calls to a payment service provider, and I need to authenticate with a Username token.
The only way I know how to do this with JBossWS is like this:
Map<String, Object> requestContext = ((BindingProvider)port).getRequestContext();
requestContext.put(BindingProvider.USERNAME_PROPERTY, "foobar");
requestContext.put(BindingProvider.PASSWORD_PROPERTY, "changeme");
But the problem here is that the "changeme" password is now in memory as a String object and I have no control on when, if ever, it will be garbage collected. If an attacker dumps memory at this point he can find the credentials.
Is there another way to make secure SOAP calls with JBossWS, where I can control how long a password remains in memory?