this pull request tries to enhance configuration and testability of DigestAuthenticator :
remove static keyword on methods for better testability (static methods are harder to test).
add a constructor which permits to inject a java.util.Random object, for better testability (we can inject a java.util.Random mock to define, for tests, the next random value) and flexibility (the actual code in the 'createCnonce' use the SecureRandom constructor to make an instance,i.e choosing a default RNG algorithm, instead of permitting to create a SecureRandom with a defined 'Random Number Generator (RNG) algorithm' from a parameter, with the 'getInstance' method from Random class.
for performance, avoid to make a new instance of SecureRandom, each time a cnonce is required, but reuse the SecureRandom instance injected in the constructor.
Hi, thanks for your work on this project.
this pull request tries to enhance configuration and testability of
DigestAuthenticator
:java.util.Random
object, for better testability (we can inject ajava.util.Random
mock to define, for tests, the next random value) and flexibility (the actual code in the 'createCnonce' use the SecureRandom constructor to make an instance,i.e choosing a default RNG algorithm, instead of permitting to create a SecureRandom with a defined 'Random Number Generator (RNG) algorithm' from a parameter, with the 'getInstance' method from Random class.best regards, Charles.