[java-idp-oidc] 02/03: Set identifier and initialize all the dependencies for the tests.

Henri Mikkonen henri.mikkonen at iki.fi
Fri Feb 3 13:19:06 UTC 2023


This is an automated email from the git hooks/post-receive script.

hjmikkon pushed a commit to branch main
in repository java-idp-oidc.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-oidc.git;a=commit;h=11f0117c63f0747e859580411174dd0a86e60197

commit 11f0117c63f0747e859580411174dd0a86e60197
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Fri Feb 3 15:10:26 2023 +0200

    Set identifier and initialize all the dependencies for the tests.
    
    These were not spotted before upgrading the IdP dependency into 4.3.0.
---
 .../oidc/op/oauth2/profile/impl/RevokeTokenTest.java       |  1 +
 .../profile/impl/SetRefreshTokenToResponseContextTest.java |  2 ++
 .../idp/plugin/oidc/op/profile/impl/ValidateGrantTest.java | 14 ++++++++++----
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/RevokeTokenTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/RevokeTokenTest.java
index 8e95531d..010bc9ed 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/RevokeTokenTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/RevokeTokenTest.java
@@ -76,6 +76,7 @@ public class RevokeTokenTest extends BaseTokenClaimsSetTest {
         storageService.initialize();
 
         revocationCache = new RevocationCache();
+        revocationCache.setId("mockCache");
         revocationCache.setEntryExpiration(Duration.ofHours(1));
         revocationCache.setStorage(storageService);
         revocationCache.initialize();
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetRefreshTokenToResponseContextTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetRefreshTokenToResponseContextTest.java
index 4dae7dd6..90925a9e 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetRefreshTokenToResponseContextTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/SetRefreshTokenToResponseContextTest.java
@@ -86,6 +86,8 @@ public class SetRefreshTokenToResponseContextTest extends BaseOIDCResponseAction
         storageService.initialize();
         revocationCache = new RevocationCache();
         revocationCache.setStorage(storageService);
+        revocationCache.setId("mockCache");
+        revocationCache.initialize();
         enforceRotation = false;
         action = initAction(null);
     }
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateGrantTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateGrantTest.java
index 6da5aad0..05ceb6b9 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateGrantTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateGrantTest.java
@@ -260,8 +260,7 @@ public class ValidateGrantTest extends BaseOIDCResponseActionTest {
 
     @Test
     public void testRefreshTokenAuthorizationGrantRevoked() throws Exception {
-        final RevocationCache revocationCache = new RevocationCache();
-        revocationCache.setStorage(storageService);
+        final RevocationCache revocationCache = buildRevocationCache();
         init(true, revocationCache, null);
         Assert.assertTrue(revocationCache.revoke(RevocationCacheContexts.AUTHORIZATION_CODE,
                 rfClaims.getRootTokenIdentifier()));
@@ -275,8 +274,7 @@ public class ValidateGrantTest extends BaseOIDCResponseActionTest {
 
     @Test
     public void testRefreshTokenRevokedShouldRevokeAuthorizationCode() throws Exception {
-        final RevocationCache revocationCache = new RevocationCache();
-        revocationCache.setStorage(storageService);
+        final RevocationCache revocationCache = buildRevocationCache();
         init(true, revocationCache, null);
         Assert.assertTrue(revocationCache.revoke(RevocationCacheContexts.SINGLE_ACCESS_OR_REFRESH_TOKENS,
                 rfClaims.getID()));
@@ -290,6 +288,14 @@ public class ValidateGrantTest extends BaseOIDCResponseActionTest {
                 rfClaims.getRootTokenIdentifier()));
     }
 
+    protected RevocationCache buildRevocationCache() throws ComponentInitializationException {
+        final RevocationCache revocationCache = new RevocationCache();
+        revocationCache.setId("mockCache");
+        revocationCache.setStorage(storageService);
+        revocationCache.initialize();
+        return revocationCache;
+    }
+
     @Test
     public void testTokenRevocationViaRevokedTokenFailsReturnsInvalidProfileConfig() throws Exception {
         RevocationCache revocationCache = Mockito.mock(RevocationCache.class);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list