[keycloak-dev] min-time-between-jwks-requests Problems when running tests

Bill Burke bburke at redhat.com
Wed Mar 1 18:29:41 EST 2017


Ok, I just spent 1.5 days on debugging a problem and I was ready to 
throw my Laptop out of the window I was getting so frustrated.

#1 I copied code from the arquillian adapter tests to deploy my own 
servlet.  When running in IntelliJ, all logging messages by the servlet 
and OIDC adapters were eaten and never displayed.

#2 If you have a @Deployment it deploys it in @BeforeClass and only once 
for all tests run in the class

#3 I  recreate/destroy my realms for every test

#4 The default "min-time-between-jwks-requests" is 10 seconds...Because 
my servlet doesn't get redeployed per test, the 1st test would set up 
the cache for the realm key for the servlet.  The 2nd test would run, 
because the realms were recreated, there is a different key, but the 
min-time-between-jwkds-requests was 10 seconds so it wasn't updating the 
key and my logins would fail.  This was extermely frustrating to debug 
because of #1 and because it only happened if I was running all tests in 
the class.

The workaround is to set "min-time-between-jwks-requests" to zero in 
your adapter configuration.  This is an FYI just in case somebody else 
runs into this.  Took me awhile to figure out.



More information about the keycloak-dev mailing list