File tree Expand file tree Collapse file tree
core/src/test/java/com/predic8/membrane/core/interceptor/jwt Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ public class JwksRefreshTest {
3434
3535 public static final int PROVIDER_PORT = 3000 ;
3636 public static final int AUTH_INTERCEPTOR_PORT = 3001 ;
37+ public static final int JWKS_REFRESH_INTERVAL = 1 ;
3738 static DefaultRouter jwksProvider ;
3839 static DefaultRouter jwtValidator ;
3940
@@ -89,7 +90,7 @@ public Outcome handleRequest(Exchange exc) {
8990 private static @ NotNull JwtAuthInterceptor jwtAuthInterceptor () {
9091 Jwks jwks = new Jwks ();
9192 jwks .setJwksUris ("http://localhost:%d/jwks" .formatted (PROVIDER_PORT ));
92- jwks .setAuthorizationService (buildAuthorizationService (1 ));
93+ jwks .setAuthorizationService (buildAuthorizationService (JWKS_REFRESH_INTERVAL ));
9394
9495 JwtAuthInterceptor jwtAuth = new JwtAuthInterceptor ();
9596 jwtAuth .setExpectedAud ("some-audience" );
@@ -147,7 +148,7 @@ public void testRefresh() throws Exception {
147148
148149 // 2. switch keys
149150 currentJwkSet .set (new JsonWebKeySet (publicKey2 ));
150- Thread .sleep (2000 ); // wait for refresh
151+ Thread .sleep (JWKS_REFRESH_INTERVAL * 1_000 * 2 ); // wait for refresh
151152
152153 // 3. new key works
153154 Exchange exc3 = new Request .Builder ()
You can’t perform that action at this time.
0 commit comments