Following an audit on our Swing application, it appears that some passwords of our users remain in memory long after they logged in or even out.
One of the causes seem to be that Apache HttpClient's UsernamePasswordCredentials
stores the password as a final String
, preventing to programmatically wipe it from memory (see Why is char[] preferred over String for passwords?).
However since the Credentials
interface it implements has a String getPassword()
method, it does not seem possible to avoid the conversion to a String
at some point.
Is there another way to avoid passing the password around as a String
in this case?
We are using HttpClient 4.0.3 but it does not seem like this has changed in more recent versions.