[java-idp-plugin-oidc-rp] branch main updated: Remove test for deleted class
Phil Smart
philip.smart at jisc.ac.uk
Thu Apr 7 09:54:55 UTC 2022
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-idp-plugin-oidc-rp.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-oidc-rp.git;a=commit;h=195202dac1efed35b3159a3dcfa3eaca9f622ae5
The following commit(s) were added to refs/heads/main by this push:
new 195202d Remove test for deleted class
195202d is described below
commit 195202dac1efed35b3159a3dcfa3eaca9f622ae5
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Thu Apr 7 10:54:49 2022 +0100
Remove test for deleted class
---
...ckedClientAuthenticationLookupStrategyTest.java | 202 ---------------------
1 file changed, 202 deletions(-)
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/StorageServiceBackedClientAuthenticationLookupStrategyTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/StorageServiceBackedClientAuthenticationLookupStrategyTest.java
deleted file mode 100644
index 6e0336b..0000000
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/config/StorageServiceBackedClientAuthenticationLookupStrategyTest.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements. See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.plugin.authn.oidc.rp.config;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.storage.impl.MemoryStorageService;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.nimbusds.oauth2.sdk.auth.ClientSecretBasic;
-
-import net.shibboleth.idp.plugin.authn.oidc.rp.context.OAuth2ClientContext;
-import net.shibboleth.idp.plugin.authn.oidc.rp.context.OIDCPeerEntityContext;
-import net.shibboleth.idp.plugin.authn.oidc.rp.storage.ClientAuthenticationDetails;
-
-/** Tests for the StorageServiceBackedClientAuthenticationLookupStrategy.*/
-public class StorageServiceBackedClientAuthenticationLookupStrategyTest {
-
- /** The profile request context.*/
- private ProfileRequestContext prc;
-
- /** Setup.*/
- @BeforeMethod
- public void setup() {
-
- prc = new ProfileRequestContext();
- final var oauth2Context = new OAuth2ClientContext();
- oauth2Context.setClientId("client_id");
- final var outboundMsg = new MessageContext();
- outboundMsg.getSubcontext(OIDCPeerEntityContext.class, true).addSubcontext(oauth2Context);
- prc.setOutboundMessageContext(outboundMsg);
- }
-
- /**
- * Test for a successful client authentication lookup.
- *
- * @throws Exception on error
- */
- @Test
- public void testLookupSuccess() throws Exception {
-
-
- final var memStore = new MemoryStorageService();
- memStore.setId("MockMemoryStorageService");
- memStore.initialize();
-
- final var mapper = new ObjectMapper();
- final var record =
- new ClientAuthenticationDetails("secret".toCharArray(), 0L, "client_secret_basic");
-
- memStore.create(
- StorageServiceBackedClientAuthenticationLookupStrategy.CONTEXT_NAME, "client_id",
- mapper.writer().writeValueAsString(record), null);
-
- final var strategy = new StorageServiceBackedClientAuthenticationLookupStrategy();
- strategy.setId("MockStrategy");
- strategy.setStorageService(memStore);
- strategy.initialize();
-
- final var clientAuth = strategy.apply(prc);
- assertNotNull(clientAuth);
- assertTrue(clientAuth instanceof ClientSecretBasic);
- assertEquals(((ClientSecretBasic)clientAuth).getClientID().getValue(), "client_id");
- assertEquals(((ClientSecretBasic)clientAuth).getClientSecret().getValue(), "secret");
- }
-
- /**
- * Test for an unsuccessful client authentication lookup, record does not exist.
- *
- * @throws Exception on error
- */
- @Test
- public void testLookupNoRecord() throws Exception {
-
- final var memStore = new MemoryStorageService();
- memStore.setId("MockMemoryStorageService");
- memStore.initialize();
-
- final var strategy = new StorageServiceBackedClientAuthenticationLookupStrategy();
- strategy.setId("MockStrategy");
- strategy.setStorageService(memStore);
- strategy.initialize();
-
- final var clientAuth = strategy.apply(prc);
- assertNull(clientAuth);
-
- }
-
-
- /**
- * Test for an unsuccessful client authentication lookup, wrong record exists.
- *
- * @throws Exception on error
- */
- @Test
- public void testLookupWrongRecord() throws Exception {
-
- final var memStore = new MemoryStorageService();
- memStore.setId("MockMemoryStorageService");
- memStore.initialize();
-
- final var mapper = new ObjectMapper();
- final var record =
- new ClientAuthenticationDetails("secret".toCharArray(), 0L, "client_secret_basic");
-
- memStore.create(
- StorageServiceBackedClientAuthenticationLookupStrategy.CONTEXT_NAME, "different_client",
- mapper.writer().writeValueAsString(record), null);
-
- final var strategy = new StorageServiceBackedClientAuthenticationLookupStrategy();
- strategy.setId("MockStrategy");
- strategy.setStorageService(memStore);
- strategy.initialize();
-
- final var clientAuth = strategy.apply(prc);
- assertNull(clientAuth);
-
- }
-
- /**
- * Test for an unsuccessful client authentication lookup, secret has expired.
- *
- * @throws Exception on error
- */
- @Test
- public void testLookupSecretExpired() throws Exception {
-
- final var memStore = new MemoryStorageService();
- memStore.setId("MockMemoryStorageService");
- memStore.initialize();
-
- final var mapper = new ObjectMapper();
- final var record =
- new ClientAuthenticationDetails("secret".toCharArray(), 1L, "client_secret_basic");
-
- memStore.create(
- StorageServiceBackedClientAuthenticationLookupStrategy.CONTEXT_NAME, "client_id",
- mapper.writer().writeValueAsString(record), null);
-
- final var strategy = new StorageServiceBackedClientAuthenticationLookupStrategy();
- strategy.setId("MockStrategy");
- strategy.setStorageService(memStore);
- strategy.initialize();
-
- final var clientAuth = strategy.apply(prc);
- assertNull(clientAuth);
-
- }
-
- /**
- * Test for an unsuccessful client authentication lookup, incompatible record. Will log stack and return
- * null.
- *
- * @throws Exception on error
- */
- @Test
- public void testLookupIncompatibleRecord() throws Exception {
-
- final var memStore = new MemoryStorageService();
- memStore.setId("MockMemoryStorageService");
- memStore.initialize();
-
- final var record = "{\"key\":\"value\"}";
-
- memStore.create(
- StorageServiceBackedClientAuthenticationLookupStrategy.CONTEXT_NAME, "client_id",
- record, null);
-
- final var strategy = new StorageServiceBackedClientAuthenticationLookupStrategy();
- strategy.setId("MockStrategy");
- strategy.setStorageService(memStore);
- strategy.initialize();
-
- final var clientAuth = strategy.apply(prc);
- assertNull(clientAuth);
-
- }
-
-
-}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list