From 7d361238baf3493034e3ed86f6d9ffc30b510e3e Mon Sep 17 00:00:00 2001 From: Toni Sormunen Date: Wed, 18 Jan 2023 13:20:25 +0200 Subject: [PATCH] Setup for 1.1 - Update for Shibboleth IdP 4.2 compatibility --- pom.xml | 31 +++++++++++++++---- .../impl/ValidateJwtTokenAuthentication.java | 21 +++++++------ .../ValidateJwtTokenAuthenticationTest.java | 11 ++++--- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index 32815aa..9d8e397 100644 --- a/pom.xml +++ b/pom.xml @@ -22,23 +22,27 @@ THE SOFTWARE. --> 4.0.0 + - net.shibboleth.idp - idp-parent - 4.0.0 + net.shibboleth + parent + 11.3.3 fi.mpass idp-authn-impl-jwt - 1.0.1-SNAPSHOT + 1.1 jar UTF-8 11 11 - 4.0.0 + 9.23 + 4.2.1 mpassid-checkstyle.xml fi.mpass.authn.jwt.impl + org.opensaml + 4.2.0 @@ -71,7 +75,7 @@ THE SOFTWARE. com.nimbusds nimbus-jose-jwt - 8.8 + ${nimbusds-version} net.shibboleth.idp @@ -89,6 +93,11 @@ THE SOFTWARE. ${shib.idp.version} + + javax.servlet + javax.servlet-api + provided + @@ -140,6 +149,16 @@ THE SOFTWARE. test test-jar + + org.springframework + spring-test + test + + + org.testng + testng + test + diff --git a/src/main/java/fi/mpass/shibboleth/authn/impl/ValidateJwtTokenAuthentication.java b/src/main/java/fi/mpass/shibboleth/authn/impl/ValidateJwtTokenAuthentication.java index 05bb494..fdd12ff 100644 --- a/src/main/java/fi/mpass/shibboleth/authn/impl/ValidateJwtTokenAuthentication.java +++ b/src/main/java/fi/mpass/shibboleth/authn/impl/ValidateJwtTokenAuthentication.java @@ -26,18 +26,9 @@ import javax.annotation.Nonnull; import javax.security.auth.Subject; +//import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest; -import net.shibboleth.idp.authn.AbstractValidationAction; -import net.shibboleth.idp.authn.AuthnEventIds; -import net.shibboleth.idp.authn.context.AuthenticationContext; -import net.shibboleth.idp.authn.principal.UsernamePrincipal; -import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty; -import net.shibboleth.utilities.java.support.component.ComponentSupport; -import net.shibboleth.utilities.java.support.logic.Constraint; -import net.shibboleth.utilities.java.support.logic.ConstraintViolationException; -import net.shibboleth.utilities.java.support.primitive.StringSupport; - import org.opensaml.profile.action.ActionSupport; import org.opensaml.profile.action.EventIds; import org.opensaml.profile.context.ProfileRequestContext; @@ -49,6 +40,16 @@ import com.nimbusds.jose.crypto.MACVerifier; import com.nimbusds.jwt.SignedJWT; +import net.shibboleth.idp.authn.AbstractValidationAction; +import net.shibboleth.idp.authn.AuthnEventIds; +import net.shibboleth.idp.authn.context.AuthenticationContext; +import net.shibboleth.idp.authn.principal.UsernamePrincipal; +import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty; +import net.shibboleth.utilities.java.support.component.ComponentSupport; +import net.shibboleth.utilities.java.support.logic.Constraint; +import net.shibboleth.utilities.java.support.logic.ConstraintViolationException; +import net.shibboleth.utilities.java.support.primitive.StringSupport; + /** * An action that checks for incoming JWT token and produces an * {@link net.shibboleth.idp.authn.AuthenticationResult} or records error if the configured user diff --git a/src/test/java/fi/mpass/shibboleth/authn/impl/ValidateJwtTokenAuthenticationTest.java b/src/test/java/fi/mpass/shibboleth/authn/impl/ValidateJwtTokenAuthenticationTest.java index 4f9da36..b429112 100644 --- a/src/test/java/fi/mpass/shibboleth/authn/impl/ValidateJwtTokenAuthenticationTest.java +++ b/src/test/java/fi/mpass/shibboleth/authn/impl/ValidateJwtTokenAuthenticationTest.java @@ -41,12 +41,12 @@ import com.nimbusds.jose.Payload; import com.nimbusds.jose.crypto.MACSigner; -import fi.mpass.shibboleth.authn.impl.ValidateJwtTokenAuthentication; import net.shibboleth.idp.authn.AuthenticationResult; import net.shibboleth.idp.authn.AuthnEventIds; import net.shibboleth.idp.authn.context.AuthenticationContext; -import net.shibboleth.idp.authn.impl.BaseAuthenticationContextTest; -import net.shibboleth.idp.profile.ActionTestingSupport; +import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest; +import net.shibboleth.idp.profile.testing.ActionTestingSupport; +import net.shibboleth.utilities.java.support.component.ComponentInitializationException; import net.shibboleth.utilities.java.support.logic.ConstraintViolationException; /** @@ -68,8 +68,9 @@ public class ValidateJwtTokenAuthenticationTest extends BaseAuthenticationContex private String jwtParameterName; - /** {@inheritDoc} */ - @BeforeMethod public void setUp() throws Exception { + /** {@inheritDoc} + * @throws ComponentInitializationException */ + @BeforeMethod public void setUp() throws ComponentInitializationException { super.setUp(); uidConfig = "username"; uid = "mockUser";