sun.net.www.protocol.http.NegotiateAuthentication
caches per host (and no port information in the key)
whether negotiation is supported or not (for instance SPNEGO). Worth to mention the cache is static (god knows why).
This is so far so good but can lead to issues in unit tests. For example:
- Developer writes a positive and negative test case for an SPNEGO protected server
- Normally the order of test cases are not defined
- Negative test case executes where SPNEGO turned off and expect 401
NegotiateAuthentication
stores false in a map- Negative test case pass
- Positive test case executes where SPNEGO turned on and expect 200
NegotiateAuthentication
gives baseisSupported
=false
from cache- Positive test case fails
To overcome this issue it would be good to have a configuration in the JVM not to cache such things but it's not available. All the rest is just hacking it around. For example:
- Defining explicit order of tests (which is super ugly and brittle)
- Map
localhost
to a different host name (not sure it's possible w/o horrible hacks) - ...