[java-idp-plugin-oidc-rp] branch main updated: Fix Javadoc and add more to test classes
Phil Smart
philip.smart at jisc.ac.uk
Wed Feb 15 14:26:13 UTC 2023
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=a7e4c2c40fe1e77cd72ddf5b985c793f0834972e
The following commit(s) were added to refs/heads/main by this push:
new a7e4c2c Fix Javadoc and add more to test classes
a7e4c2c is described below
commit a7e4c2c40fe1e77cd72ddf5b985c793f0834972e
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Feb 15 14:26:08 2023 +0000
Fix Javadoc and add more to test classes
---
...OutboundAuthorizationRequestMessageContext.java | 8 +++-
.../InitializeUnverifiedRelyingPartyContext.java | 4 +-
...RelyingPartyProxySigningParametersResolver.java | 2 +-
...CAuthenticationRequestActionMessageHandler.java | 1 +
.../oidc/rp/messaging/impl/AddMaxAgeHandler.java | 1 +
.../authn/oidc/rp/impl/AbstractOIDCTest.java | 1 +
.../oidc/rp/impl/AuthorizationControllerTest.java | 17 ++++++++
.../authn/oidc/rp/impl/BuildRequestObjectTest.java | 50 +++++++++++++++++++++-
.../DefaultRedirectUriCreationFunctionTest.java | 45 +++++++++++++++++++
.../authn/oidc/rp/impl/TestCredentialHelper.java | 5 +--
.../plugin/authn/oidc/rp/impl/TestTokenHelper.java | 5 +--
...nticationContextClassReferencesHandlerTest.java | 14 +++---
.../messaging/impl/AddEndpointURIHandlerTest.java | 15 +++++--
.../AddForceAuthenticationPromptHandlerTest.java | 10 +++++
.../messaging/impl/AddRedirectURIHandlerTest.java | 10 +++++
.../impl/AddRequestedClaimsHandlerTest.java | 10 +++++
.../impl/AddResponseTypeAndModeHandlerTest.java | 28 ++++++++++++
.../rp/messaging/impl/AddScopesHandlerTest.java | 15 +++++++
.../rp/messaging/impl/AddStateHandlerTest.java | 10 +++++
.../impl/BuildPlainRequestObjectJWTTest.java | 10 +++++
.../flow/AbstractAuthnXmlFlowExecutionTests.java | 1 +
21 files changed, 242 insertions(+), 20 deletions(-)
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/InitializeOutboundAuthorizationRequestMessageContext.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/InitializeOutboundAuthorizationRequestMessageContext.java
index 647233f..c29befe 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/InitializeOutboundAuthorizationRequestMessageContext.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/InitializeOutboundAuthorizationRequestMessageContext.java
@@ -41,7 +41,13 @@ import net.shibboleth.oidc.metadata.context.OIDCProviderMetadataContext;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
-// FIXME: think of the logic
+/**
+ * Initialize an outbound message context ready for an authorization/authentication request to be built.
+ *
+ * @event {@link org.opensaml.profile.action.EventIds#PROCEED_EVENT_ID}
+ * @post ProfileRequestContext.getOutboundMessageContext(msgCtx != null
+ *
+ */
public class InitializeOutboundAuthorizationRequestMessageContext extends AbstractProfileAction {
/** Class logger. */
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/InitializeUnverifiedRelyingPartyContext.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/InitializeUnverifiedRelyingPartyContext.java
index cc2b7c4..d46e336 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/InitializeUnverifiedRelyingPartyContext.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/InitializeUnverifiedRelyingPartyContext.java
@@ -34,8 +34,8 @@ import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
/**
- * Action that adds an unverified {@link RelyingPartyContext} to the current {@link ProfileRequestContext} tree via a creation
- * function.
+ * Action that adds an unverified {@link RelyingPartyContext} to the current {@link ProfileRequestContext} tree via a
+ * creation function.
*
* @event {@link IdPEventIds#INVALID_RELYING_PARTY_CTX}
* @post ProfileRequestContext.getSubcontext(RelyingPartyContext.class) != null
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/RelyingPartyProxySigningParametersResolver.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/RelyingPartyProxySigningParametersResolver.java
index a7b08a5..854019c 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/RelyingPartyProxySigningParametersResolver.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/RelyingPartyProxySigningParametersResolver.java
@@ -57,7 +57,7 @@ import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
*
* * <p>
* In addition to the {@link net.shibboleth.utilities.java.support.resolver.Criterion} inputs documented in
- * {@link JWTBasicSignatureSigningParametersResolver}, the following inputs are also supported:
+ * {@link BasicSignatureSigningParametersResolver}, the following inputs are also supported:
* </p>
* <ul>
* <li>{@link ClientSecretCredentialCriterion} - optional</li>
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AbstractOIDCAuthenticationRequestActionMessageHandler.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AbstractOIDCAuthenticationRequestActionMessageHandler.java
index 8a2f852..3f55fe5 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AbstractOIDCAuthenticationRequestActionMessageHandler.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AbstractOIDCAuthenticationRequestActionMessageHandler.java
@@ -80,6 +80,7 @@ public abstract class AbstractOIDCAuthenticationRequestActionMessageHandler exte
/** Current HTTP request, if available. */
@Nullable private HttpServletRequest httpServletRequest;
+ /** Constructor.*/
protected AbstractOIDCAuthenticationRequestActionMessageHandler() {
providerMetadataLookupStrategy = new ChildContextLookup<>(OIDCProviderMetadataContext.class).compose(
new ChildContextLookup<>(OIDCPeerEntityContext.class));
diff --git a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddMaxAgeHandler.java b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddMaxAgeHandler.java
index 75650fd..2ca4a7c 100644
--- a/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddMaxAgeHandler.java
+++ b/idp-oidc-rp-impl/src/main/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddMaxAgeHandler.java
@@ -10,6 +10,7 @@ import org.opensaml.messaging.handler.MessageHandlerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/** Message handler that adds the max_age parameter based on any defined in the profile configuration.*/
public class AddMaxAgeHandler extends AbstractOIDCAuthenticationRequestActionMessageHandler {
/** Logger. */
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCTest.java
index 10cc1b5..480222e 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AbstractOIDCTest.java
@@ -59,6 +59,7 @@ public abstract class AbstractOIDCTest {
/** The client_secret.*/
private static final String CLIENT_SECRET = "Xp2s5v8y/B?E(H+MbQeThWmYq3t6w9z$";
+ /** Provider configuration.*/
protected final String GOOD_PROVIDER_CONFIGURATION_INFO =
"{\"issuer\":\"https://op.example.com/\","
+ "\"authorization_endpoint\":\"https://www.certification.openid.net/test/a/"
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AuthorizationControllerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AuthorizationControllerTest.java
index df85b5f..6c9677a 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AuthorizationControllerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/AuthorizationControllerTest.java
@@ -167,6 +167,11 @@ public class AuthorizationControllerTest extends AbstractTestNGSpringContextTest
context = exportServletContextAttributes();
}
+ /**
+ * Test the correct 302 redirect is returned from the authorization controller.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccessfulAuthorizeRequest() throws Exception {
@@ -189,6 +194,11 @@ public class AuthorizationControllerTest extends AbstractTestNGSpringContextTest
assertFalse(result.getResponse().getRedirectedUrl().contains("request"));
}
+ /**
+ * Test the correct 302 redirect is returned from the authorization controller. Including a Request Object.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccessfulAuthorizeRequest_WithRequestObject() throws Exception {
@@ -413,6 +423,11 @@ public class AuthorizationControllerTest extends AbstractTestNGSpringContextTest
return rootPrc;
}
+ /**
+ * Create an external authentication context.
+ *
+ * @return external authentication context
+ */
private ExternalAuthenticationContext extractExternalAuthContext() {
final Object flowExecutorObject = servletContext.getAttribute(ExternalAuthentication.SWF_KEY);
assertTrue(flowExecutorObject instanceof FlowExecutorImpl);
@@ -466,6 +481,7 @@ public class AuthorizationControllerTest extends AbstractTestNGSpringContextTest
}
}
+ /** Mock no-op redirect decoder.*/
private class NoOpMockRedirectResponseDecoder
extends AbstractHttpServletRequestMessageDecoder implements OIDCMessageDecoder {
@@ -477,6 +493,7 @@ public class AuthorizationControllerTest extends AbstractTestNGSpringContextTest
}
+ /** Mock redirect encoder.*/
private class MockRedirectEncoder extends AbstractOIDCMessageEncoder {
@Override
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/BuildRequestObjectTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/BuildRequestObjectTest.java
index 0291e2b..3e5cd45 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/BuildRequestObjectTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/BuildRequestObjectTest.java
@@ -74,6 +74,11 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
authnRequest.setProviderSupportsClaimsParameter(true);
}
+ /**
+ * Build a request object with the correct claims.
+ *
+ * @throws ComponentInitializationException on error.
+ */
@Test
public void testBuildRequestObject_Success() throws ComponentInitializationException {
@@ -97,6 +102,11 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
assertTrue(isValidJSON(claims.toJSONString()));
}
+ /**
+ * Build a request object with the correct set of ACRs.
+ *
+ * @throws ComponentInitializationException on error
+ */
@Test
public void testBuildRequestObject_WithACRs_Success() throws ComponentInitializationException {
@@ -128,7 +138,11 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
assertTrue(isValidJSON(claims.toJSONString()));
}
- /* Test building acr_values when the claims claim is not supported.*/
+ /**
+ * Test building acr_values when the claims claim is not supported.
+ *
+ * @throws ComponentInitializationException on error
+ */
@Test
public void testBuildRequestObject_WithACRs_ClaimsNotSupported_Success() throws ComponentInitializationException {
@@ -157,6 +171,11 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
assertEquals(claims.getStringClaim("acr_values"),"urn:mace:incommon:iap:silver");
}
+ /**
+ * Test build a request object with requested claims and ACRs.
+ *
+ * @throws ComponentInitializationException on error
+ */
@Test
public void testBuildRequestObject_WithACRsAndExistingRequestedClaims_Success() throws ComponentInitializationException {
@@ -199,6 +218,12 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
assertTrue(isValidJSON(claims.toJSONString()));
}
+ /**
+ * Test build a request object with ACRS when ACRs have been requested and claims configured.
+ * These should be merged in.
+ *
+ * @throws ComponentInitializationException on error
+ */
@Test
public void testBuildRequestObject_WithACRsAndExistingACRs_Success() throws ComponentInitializationException {
@@ -250,6 +275,12 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
assertTrue(isValidJSON(claims.toJSONString()));
}
+ /**
+ * Test build a request object with ACRS when ACRs have been requested and claims configured.
+ * These should be merged in.
+ *
+ * @throws ComponentInitializationException on error
+ */
@Test
public void testBuildRequestObject_WithACRsAndExistingACRs_WithSingleValue_Success()
throws ComponentInitializationException {
@@ -302,6 +333,11 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
assertTrue(isValidJSON(claims.toJSONString()));
}
+ /**
+ * Test build ACRs into an existing set of requested claims.
+ *
+ * @throws ComponentInitializationException on error
+ */
@Test
public void testBuildRequestObject_WithACRsAndExistingACRsAndClaims_Success() throws ComponentInitializationException {
@@ -356,6 +392,11 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
assertTrue(isValidJSON(claims.toJSONString()));
}
+ /**
+ * Test build request object with requested claims.
+ *
+ * @throws ComponentInitializationException on error
+ */
@Test
public void testBuildRequestObject_WithRequestedClaims_Success() throws ComponentInitializationException {
@@ -385,6 +426,13 @@ public class BuildRequestObjectTest extends AbstractOIDCTest {
assertTrue(isValidJSON(claims.toJSONString()));
}
+ /**
+ * Is the string valid JSON.
+ *
+ * @param json the json to test
+ *
+ * @return true if valid, false otherwise.
+ */
private boolean isValidJSON(final String json) {
try{
final ObjectMapper objectMapper = new ObjectMapper();
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/DefaultRedirectUriCreationFunctionTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/DefaultRedirectUriCreationFunctionTest.java
index 8a555ce..5b73f60 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/DefaultRedirectUriCreationFunctionTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/DefaultRedirectUriCreationFunctionTest.java
@@ -64,6 +64,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is allowed and built.
+ *
+ * @throws Exception on error
+ */
@Test
public final void testComputedRedirectAllowed() throws Exception {
@@ -82,6 +87,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is disallowed and not built.
+ *
+ * @throws Exception on error
+ */
@Test
public final void testComputedRedirectDisallowed() throws Exception {
@@ -99,6 +109,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is disallowed on the origin.
+ *
+ * @throws Exception on error
+ */
@Test
public final void testComputedRedirectDisallowedNotOrigins() throws Exception {
@@ -116,6 +131,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is allowed and built using a custom HTTPS port.
+ *
+ * @throws Exception on error
+ */
@Test
public final void testComputedRedirectAllowedHTTPSCustomPort() throws Exception {
@@ -133,6 +153,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is allowed and built using a custom HTTP port.
+ *
+ * @throws Exception on error
+ */
@Test
public final void testComputedRedirectAllowedHTTPCustomPort() throws Exception {
@@ -150,6 +175,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is allowed and built using a null port (assume the default).
+ *
+ * @throws Exception on error
+ */
@Test
public final void testComputedRedirectAllowedNullPort() throws Exception {
@@ -167,6 +197,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is disallowed on port.
+ *
+ * @throws Exception on error
+ */
@Test
public final void testComputedRedirectDisallowedOnPort() throws Exception {
@@ -184,6 +219,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is allowed and built using a pre-registered URL.
+ *
+ * @throws Exception on error
+ */
@Test
public final void testPreregisteredURL() throws Exception {
@@ -203,6 +243,11 @@ public class DefaultRedirectUriCreationFunctionTest {
}
+ /**
+ * Test redirect URI is disallowed and not built when using an injected, malicious, hostname header.
+ *
+ * @throws Exception on error
+ */
@Test
public final void testComputedRedirectBadHostname() throws Exception {
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestCredentialHelper.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestCredentialHelper.java
index 9ce9a3e..a13f237 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestCredentialHelper.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestCredentialHelper.java
@@ -49,10 +49,7 @@ public final class TestCredentialHelper {
/**
* Create a simple symmetric key client_secret credential from from the given shared secret.
*
- * @param kid the key ID
- * @param secret the secret to convert to a {@link JWKCredential}.
- * @param algorithm the JWA algorithm to set on the credential.
- * @param usage TODO
+ * @param secret the client_secret
* @return the credential
* @throws KeyException on error creating the key
*/
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestTokenHelper.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestTokenHelper.java
index 59995ab..9a49ff8 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestTokenHelper.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/impl/TestTokenHelper.java
@@ -98,15 +98,14 @@ public final class TestTokenHelper {
/**
* Build a basic {@link JWTClaimsSet} from the supplied parameters to mock a UserInfo response.
*
- * @param subject the subject
* @param opIssuerId the OP's issuer ID *
* @param audience the list of audiences
* @param sub the subject
*
* @return the JWT claims set.
*/
- public static JWTClaimsSet createBasicUserInfoClaims(
- final String opIssuerId, final List<String> audience, final String sub) {
+ public static JWTClaimsSet createBasicUserInfoClaims(final String opIssuerId, final List<String> audience,
+ final String sub) {
return new JWTClaimsSet.Builder()
.issuer(opIssuerId)
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddAuthenticationContextClassReferencesHandlerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddAuthenticationContextClassReferencesHandlerTest.java
index 56e675f..c961c42 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddAuthenticationContextClassReferencesHandlerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddAuthenticationContextClassReferencesHandlerTest.java
@@ -22,16 +22,11 @@ import static org.testng.Assert.assertEquals;
import java.util.Collections;
import java.util.List;
-import org.opensaml.messaging.context.navigate.ChildContextLookup;
-import org.opensaml.messaging.context.navigate.ParentContextLookup;
-import org.opensaml.profile.context.ProfileRequestContext;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.plugin.authn.oidc.rp.impl.AbstractOIDCTest;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
-import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
import net.shibboleth.idp.relyingparty.RelyingPartyConfiguration;
import net.shibboleth.oidc.authn.principal.AuthenticationContextClassReferencePrincipal;
import net.shibboleth.oidc.profile.config.OIDCAuthorizationConfiguration;
@@ -67,6 +62,11 @@ public class AddAuthenticationContextClassReferencesHandlerTest extends Abstrac
}
+ /**
+ * Test ACR values are correct.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccess() throws Exception {
handler.initialize();
@@ -79,6 +79,10 @@ public class AddAuthenticationContextClassReferencesHandlerTest extends Abstrac
assertEquals(authnRequest.getAcrs().get(2).getValue(),"test-value-3");
}
+ /** Test no principals are returned.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccess_NoPrincipals() throws Exception {
oidcAuthzConfig.setDefaultAuthenticationMethods(Collections.emptyList());
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddEndpointURIHandlerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddEndpointURIHandlerTest.java
index 2980891..64725a0 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddEndpointURIHandlerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddEndpointURIHandlerTest.java
@@ -27,7 +27,6 @@ import net.shibboleth.idp.plugin.authn.oidc.rp.impl.AbstractOIDCTest;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.relyingparty.RelyingPartyConfiguration;
import net.shibboleth.oidc.profile.config.OIDCAuthorizationConfiguration;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
/** Tests for {@link AddEndpointURIHandler}.*/
public class AddEndpointURIHandlerTest extends AbstractOIDCTest {
@@ -56,8 +55,13 @@ public class AddEndpointURIHandlerTest extends AbstractOIDCTest {
}
+ /**
+ * Test URI is added correctly.
+ *
+ * @throws Exception on error
+ */
@Test
- public void testSuccess() throws ComponentInitializationException, MessageHandlerException {
+ public void testSuccess() throws Exception {
handler.initialize();
handler.invoke(prc.getOutboundMessageContext());
@@ -66,8 +70,13 @@ public class AddEndpointURIHandlerTest extends AbstractOIDCTest {
providerCtx.getProviderInformation().getAuthorizationEndpointURI());
}
+ /**
+ * Test what happens if no authz endpoint is provided in metadata.
+ *
+ * @throws Exception on error
+ */
@Test(expectedExceptions = MessageHandlerException.class)
- public void testNoAuthzEndpoint() throws ComponentInitializationException, MessageHandlerException {
+ public void testNoAuthzEndpoint() throws Exception {
providerCtx.getProviderInformation().setAuthorizationEndpointURI(null);
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddForceAuthenticationPromptHandlerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddForceAuthenticationPromptHandlerTest.java
index 748cb04..d59062d 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddForceAuthenticationPromptHandlerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddForceAuthenticationPromptHandlerTest.java
@@ -55,6 +55,11 @@ public class AddForceAuthenticationPromptHandlerTest extends AbstractOIDCTest {
}
+ /**
+ * Test LOGIN prompt is added when force authn is enabled.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccess() throws Exception {
@@ -67,6 +72,11 @@ public class AddForceAuthenticationPromptHandlerTest extends AbstractOIDCTest {
assertEquals(authnRequest.getPrompt().iterator().next(), Prompt.Type.LOGIN);
}
+ /**
+ * Test no login prompt is added when force authn is not requested.
+ *
+ * @throws Exception on error
+ */
@Test
public void testForceAuthnNotRequired() throws Exception {
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddRedirectURIHandlerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddRedirectURIHandlerTest.java
index beaa51d..ac1e90e 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddRedirectURIHandlerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddRedirectURIHandlerTest.java
@@ -56,6 +56,11 @@ public class AddRedirectURIHandlerTest extends AbstractOIDCTest {
}
+ /**
+ * Test redirect URI is added.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccess() throws Exception {
@@ -69,6 +74,11 @@ public class AddRedirectURIHandlerTest extends AbstractOIDCTest {
assertEquals(authnRequest.getRedirectURI(),redirectUri);
}
+ /**
+ * Test error when the strategy does not produce a result.
+ *
+ * @throws Exception on error
+ */
@Test(expectedExceptions = MessageHandlerException.class)
public void testNullURI() throws Exception {
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddRequestedClaimsHandlerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddRequestedClaimsHandlerTest.java
index 77be96a..04bdf42 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddRequestedClaimsHandlerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddRequestedClaimsHandlerTest.java
@@ -58,6 +58,11 @@ public class AddRequestedClaimsHandlerTest extends AbstractOIDCTest {
rpc.setConfiguration(rpConfig);
}
+ /**
+ * Test claims are added successfully.
+ *
+ * @throws Exception on error
+ */
@Test
public void testAddRequestedClaims() throws Exception {
@@ -80,6 +85,11 @@ public class AddRequestedClaimsHandlerTest extends AbstractOIDCTest {
.getMessage()).getRequestedClaims().getUserInfoClaimsRequest().get("family_name", null));
}
+ /**
+ * Test no claims are added.
+ *
+ * @throws Exception on error
+ */
@Test
public void testNoRequestedClaims() throws Exception {
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddResponseTypeAndModeHandlerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddResponseTypeAndModeHandlerTest.java
index 6f13818..c57d316 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddResponseTypeAndModeHandlerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddResponseTypeAndModeHandlerTest.java
@@ -36,10 +36,13 @@ import net.shibboleth.oidc.profile.core.OIDCAuthenticationRequest;
/** Tests for the {@link AddResponseTypeAndModeHandler} action.*/
public class AddResponseTypeAndModeHandlerTest extends AbstractOIDCTest {
+ /** The handler.*/
private AddResponseTypeAndModeHandler handler;
+ /** The relying party context.*/
private RelyingPartyContext rpc;
+ /** The profile config.*/
private OIDCAuthorizationConfiguration oidcAuthzConfig;
@@ -55,6 +58,11 @@ public class AddResponseTypeAndModeHandlerTest extends AbstractOIDCTest {
rpc.setConfiguration(rpConfig);
}
+ /**
+ * Test the response mode override is added when set.
+ *
+ * @throws Exception on error
+ */
@Test
public void testResponseModeOverride() throws Exception {
@@ -72,6 +80,11 @@ public class AddResponseTypeAndModeHandlerTest extends AbstractOIDCTest {
(OIDCAuthenticationRequest)prc.getOutboundMessageContext().getMessage()).getResponseType());
}
+ /**
+ * Test the unsupported response type (IDTOKEN).
+ *
+ * @throws Exception on error
+ */
@Test(expectedExceptions = MessageHandlerException.class)
public void testResponseTypeNotSupportedByOP() throws Exception {
@@ -81,6 +94,11 @@ public class AddResponseTypeAndModeHandlerTest extends AbstractOIDCTest {
handler.invoke(prc.getOutboundMessageContext());
}
+ /**
+ * Test a response mode that is not supported by the OP.
+ *
+ * @throws Exception on error
+ */
@Test(expectedExceptions = MessageHandlerException.class)
public void testResponseModeNotSupportedByOP() throws Exception {
@@ -90,6 +108,11 @@ public class AddResponseTypeAndModeHandlerTest extends AbstractOIDCTest {
handler.invoke(prc.getOutboundMessageContext());
}
+ /**
+ * Test a response mode and type that are the default pairing.
+ *
+ * @throws Exception on error
+ */
@Test
public void testResponseModeDefault() throws Exception {
@@ -107,6 +130,11 @@ public class AddResponseTypeAndModeHandlerTest extends AbstractOIDCTest {
((OIDCAuthenticationRequest)prc.getOutboundMessageContext().getMessage()).getResponseType());
}
+ /**
+ * Test an unknown response type correctly throws an exception.
+ *
+ * @throws Exception on error
+ */
@Test(expectedExceptions = MessageHandlerException.class)
public void testUnknownResponseType() throws Exception {
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddScopesHandlerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddScopesHandlerTest.java
index 76d4b53..f88f53f 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddScopesHandlerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddScopesHandlerTest.java
@@ -56,6 +56,11 @@ public class AddScopesHandlerTest extends AbstractOIDCTest {
}
+ /**
+ * Test default scope is added.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccessWithDefaultScope() throws Exception {
@@ -67,6 +72,11 @@ public class AddScopesHandlerTest extends AbstractOIDCTest {
assertEquals(authnRequest.getScope().iterator().next().getValue(), "openid");
}
+ /**
+ * Test additional scopes are added.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccess_AddScopes() throws Exception {
@@ -83,6 +93,11 @@ public class AddScopesHandlerTest extends AbstractOIDCTest {
}
+ /**
+ * Test the default scope is added even if null scopes are set.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccess_NullScopes() throws Exception {
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddStateHandlerTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddStateHandlerTest.java
index 5e718f3..2f9b0f8 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddStateHandlerTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/AddStateHandlerTest.java
@@ -69,6 +69,11 @@ public class AddStateHandlerTest extends AbstractOIDCTest {
prc.getOutboundMessageContext().addSubcontext(handlerContext);
}
+ /**
+ * Test the state is added correctly.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccess() throws Exception {
handler.initialize();
@@ -84,6 +89,11 @@ public class AddStateHandlerTest extends AbstractOIDCTest {
assertTrue(request.getState().getValue().split("\\.")[1].equals(keyHex));
}
+ /**
+ * Test error occurs if no outbound context is supplied.
+ *
+ * @throws Exception on error
+ */
@Test(expectedExceptions = MessageHandlerException.class)
public void testFailure_NoOutBoundContext() throws Exception {
prc.getOutboundMessageContext().removeSubcontext(OutboundMessageHandlerContext.class);
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/BuildPlainRequestObjectJWTTest.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/BuildPlainRequestObjectJWTTest.java
index 5a48da9..942b04d 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/BuildPlainRequestObjectJWTTest.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/oidc/rp/messaging/impl/BuildPlainRequestObjectJWTTest.java
@@ -69,6 +69,11 @@ public class BuildPlainRequestObjectJWTTest extends AbstractOIDCTest {
}
+ /**
+ * Test a plain request object and default claims are added.
+ *
+ * @throws Exception on error
+ */
@Test
public void testSuccess() throws Exception {
handler.initialize();
@@ -82,6 +87,11 @@ public class BuildPlainRequestObjectJWTTest extends AbstractOIDCTest {
.equals("http://rp.example.com/callback"));
}
+ /**
+ * Test what happens if no request object claims are set in the authentication request.
+ *
+ * @throws Exception on error
+ */
@Test
public void testFail_NoClaims() throws Exception {
request.setRequestObjectClaimsSet(null);
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/test/flow/AbstractAuthnXmlFlowExecutionTests.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/test/flow/AbstractAuthnXmlFlowExecutionTests.java
index c2cbc53..2e46101 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/test/flow/AbstractAuthnXmlFlowExecutionTests.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/test/flow/AbstractAuthnXmlFlowExecutionTests.java
@@ -563,6 +563,7 @@ public abstract class AbstractAuthnXmlFlowExecutionTests extends CustomAbstractX
* Build a {@link ProfileRequestContext} by configuring a suitable context tree e.g. a
* {@link AuthenticationContext}.
*
+ * @param flowId the flow identifier
* @param forceAuthn force authentication
* @param addC14Context add the c14 context, yes or no.
* @return a profile request context.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list