[java-idp-oidc] branch main updated: ReplayCache is unused, removing from action.
Scott Cantor
cantor.2 at osu.edu
Mon Dec 13 20:09:26 UTC 2021
This is an automated email from the git hooks/post-receive script.
scantor 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=c40dc9d8c338ebdc7a734e560f80a8f4c2cec516
The following commit(s) were added to refs/heads/main by this push:
new c40dc9d8 ReplayCache is unused, removing from action.
c40dc9d8 is described below
commit c40dc9d8c338ebdc7a734e560f80a8f4c2cec516
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Dec 13 15:09:19 2021 -0500
ReplayCache is unused, removing from action.
---
.../impl/ValidateEndpointAuthentication.java | 27 -------------------
.../oauth2/introspection/introspection-beans.xml | 2 +-
.../flows/oauth2/revocation/revocation-beans.xml | 2 +-
.../idp/flows/oidc/token/token-beans.xml | 4 +--
.../impl/ValidateEndpointAuthenticationTest.java | 30 +++++++++-------------
5 files changed, 16 insertions(+), 49 deletions(-)
diff --git a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateEndpointAuthentication.java b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateEndpointAuthentication.java
index b04813b7..4473e7e4 100644
--- a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateEndpointAuthentication.java
+++ b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateEndpointAuthentication.java
@@ -28,7 +28,6 @@ import org.opensaml.profile.action.ActionSupport;
import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.profile.context.navigate.InboundMessageContextLookup;
-import org.opensaml.storage.ReplayCache;
import org.opensaml.xmlsec.context.SecurityParametersContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -49,8 +48,6 @@ import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCMetadataContext;
import net.shibboleth.oidc.profile.config.navigate.TokenEndpointAuthMethodLookupFunction;
import net.shibboleth.oidc.security.impl.JWTSignatureValidationUtil;
import net.shibboleth.oidc.security.impl.OIDCSignatureValidationParameters;
-import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
@@ -69,9 +66,6 @@ public class ValidateEndpointAuthentication extends AbstractOIDCRequestAction<Ab
@Nullable private Function<ProfileRequestContext, List<ClientAuthenticationMethod>>
tokenEndpointAuthMethodsLookupStrategy;
- /** Message replay cache instance to use. */
- @NonnullAfterInit private ReplayCache replayCache;
-
/** The attached OIDC metadata context. */
@Nullable private OIDCMetadataContext oidcMetadataContext;
@@ -118,17 +112,6 @@ public class ValidateEndpointAuthentication extends AbstractOIDCRequestAction<Ab
}
- /**
- * Set the replay cache instance to use.
- *
- * @param cache
- * The replayCache to set.
- */
- public void setReplayCache(@Nonnull final ReplayCache cache) {
- ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
- replayCache = Constraint.isNotNull(cache, "ReplayCache cannot be null");
- }
-
/**
* Set the strategy used to locate the {@link SecurityParametersContext} to use.
*
@@ -141,16 +124,6 @@ public class ValidateEndpointAuthentication extends AbstractOIDCRequestAction<Ab
securityParametersLookupStrategy =
Constraint.isNotNull(strategy, "SecurityParameterContext lookup strategy cannot be null");
}
-
- /** {@inheritDoc} */
- @Override
- protected void doInitialize() throws ComponentInitializationException {
- super.doInitialize();
-
- if (replayCache == null) {
- throw new ComponentInitializationException("ReplayCache cannot be null");
- }
- }
/** {@inheritDoc} */
@Override
diff --git a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth2/introspection/introspection-beans.xml b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth2/introspection/introspection-beans.xml
index 62dd613a..3efd47e7 100644
--- a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth2/introspection/introspection-beans.xml
+++ b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth2/introspection/introspection-beans.xml
@@ -45,7 +45,7 @@
<bean id="ValidateEndpointAuthentication"
class="net.shibboleth.idp.plugin.oidc.op.profile.impl.ValidateEndpointAuthentication" scope="prototype"
- p:httpServletRequest-ref="shibboleth.HttpServletRequest" p:replayCache-ref="shibboleth.ReplayCache" />
+ p:httpServletRequest-ref="shibboleth.HttpServletRequest" />
<bean id="FormOutboundMessage"
class="net.shibboleth.idp.plugin.oidc.op.oauth2.profile.impl.FormOutboundIntrospectionResponseMessage" scope="prototype"
diff --git a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth2/revocation/revocation-beans.xml b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth2/revocation/revocation-beans.xml
index 6aecfcaf..c1f0c089 100644
--- a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth2/revocation/revocation-beans.xml
+++ b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oauth2/revocation/revocation-beans.xml
@@ -45,7 +45,7 @@
<bean id="ValidateEndpointAuthentication"
class="net.shibboleth.idp.plugin.oidc.op.profile.impl.ValidateEndpointAuthentication" scope="prototype"
- p:httpServletRequest-ref="shibboleth.HttpServletRequest" p:replayCache-ref="shibboleth.ReplayCache" />
+ p:httpServletRequest-ref="shibboleth.HttpServletRequest" />
<bean id="RevokeToken" class="net.shibboleth.idp.plugin.oidc.op.oauth2.profile.impl.RevokeToken" scope="prototype"
c:sealer-ref="#{'%{idp.oidc.tokenSealer:shibboleth.oidc.TokenSealer}'.trim()}"
diff --git a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/token/token-beans.xml b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/token/token-beans.xml
index ba13987a..61b4987e 100644
--- a/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/token/token-beans.xml
+++ b/idp-oidc-extension-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidc/token/token-beans.xml
@@ -29,8 +29,8 @@
scope="prototype" />
<bean id="ValidateEndpointAuthentication"
- class="net.shibboleth.idp.plugin.oidc.op.profile.impl.ValidateEndpointAuthentication" scope="prototype"
- p:httpServletRequest-ref="shibboleth.HttpServletRequest" p:replayCache-ref="shibboleth.ReplayCache">
+ class="net.shibboleth.idp.plugin.oidc.op.profile.impl.ValidateEndpointAuthentication" scope="prototype"
+ p:httpServletRequest-ref="shibboleth.HttpServletRequest">
<property name="securityParametersLookupStrategy">
<bean parent="shibboleth.Functions.Compose"
c:g-ref="shibboleth.ChildLookup.SecurityParameters"
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateEndpointAuthenticationTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateEndpointAuthenticationTest.java
index a15d2900..35aca11d 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateEndpointAuthenticationTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/ValidateEndpointAuthenticationTest.java
@@ -106,23 +106,23 @@ public class ValidateEndpointAuthenticationTest {
final ProfileRequestContext prc = new WebflowRequestContextProfileRequestContextLookup().apply(requestCtx);
- OIDCMetadataContext oidcContext = new OIDCMetadataContext();
- OIDCClientMetadata metadata = new OIDCClientMetadata();
+ final OIDCMetadataContext oidcContext = new OIDCMetadataContext();
+ final OIDCClientMetadata metadata = new OIDCClientMetadata();
metadata.setTokenEndpointAuthMethod(storedMethod);
- Secret secret = sameSecret ? clientSecret : new Secret("WRONG1234567890secret1234567890secret1234567890");
+ final Secret secret = sameSecret ? clientSecret : new Secret("WRONG1234567890secret1234567890secret1234567890");
if (storedMethod != null) {
BasicJWKCredential credential = null;
- OIDCSignatureValidationParameters params = new OIDCSignatureValidationParameters();
+ final OIDCSignatureValidationParameters params = new OIDCSignatureValidationParameters();
if (storedMethod.equals(ClientAuthenticationMethod.PRIVATE_KEY_JWT)) {
params.setSignatureAlgorithm("RS256");
credential = new BasicJWKCredential();
credential.setAlgorithm(JWSAlgorithm.parse("RS256"));
- RSAKey rsaKey;
+ final RSAKey rsaKey;
if (sameSecret) {
rsaKey = new RSAKey.Builder(rsaPublicKey).build();
} else {
- KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
+ final KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
keyGen.initialize(1024);
rsaKey = new RSAKey.Builder((RSAPublicKey)keyGen.genKeyPair().getPublic()).build();
}
@@ -135,13 +135,13 @@ public class ValidateEndpointAuthenticationTest {
}
if (credential != null) {
- SecurityParametersContext secCtx =
+ final SecurityParametersContext secCtx =
(SecurityParametersContext) prc.addSubcontext(new SecurityParametersContext());
params.getValidationCredentials().add(credential);
secCtx.setSignatureSigningParameters(params);
}
}
- OIDCClientInformation clientInformation =
+ final OIDCClientInformation clientInformation =
new OIDCClientInformation(clientId, new Date(), metadata, secret);
oidcContext.setClientInformation(clientInformation);
prc.getInboundMessageContext().addSubcontext(oidcContext);
@@ -167,13 +167,7 @@ public class ValidateEndpointAuthenticationTest {
protected ValidateEndpointAuthentication constructAction(final Function<ProfileRequestContext,
List<ClientAuthenticationMethod>> newFunction) throws ComponentInitializationException {
- ValidateEndpointAuthentication action = new ValidateEndpointAuthentication();
- ReplayCache replayCache = new ReplayCache();
- MemoryStorageService storageService = new MemoryStorageService();
- storageService.setId("mockId");
- storageService.initialize();
- replayCache.setStorage(storageService);
- action.setReplayCache(replayCache);
+ final ValidateEndpointAuthentication action = new ValidateEndpointAuthentication();
if (newFunction != null) {
action.setTokenEndpointAuthMethodsLookupStrategy(newFunction);
}
@@ -183,15 +177,15 @@ public class ValidateEndpointAuthenticationTest {
@Test
public void testNoEnabledMethods() throws Exception {
- ValidateEndpointAuthentication action = constructAction(null);
+ final ValidateEndpointAuthentication action = constructAction(null);
final Event event =
action.execute(initializeRequestCtx(
initializeTokenRequest(ClientAuthenticationMethod.CLIENT_SECRET_BASIC), null, true));
ActionTestingSupport.assertEvent(event, EventIds.ACCESS_DENIED);
}
- protected void testClientAuth(final ClientAuthenticationMethod clientAuth, boolean success) throws Exception {
- ValidateEndpointAuthentication action =
+ protected void testClientAuth(final ClientAuthenticationMethod clientAuth, final boolean success) throws Exception {
+ final ValidateEndpointAuthentication action =
constructAction(new ListMethodsFunction(clientAuth));
final Event event =
action.execute(initializeRequestCtx(
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list