[java-idp-plugin-vci] 04/05: Rename abstract msg classes
Codeberg
noreply at shibboleth.net
Wed Dec 3 12:02:56 UTC 2025
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch DPOP
in repository java-idp-plugin-vci.
View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-vci/commit/afc4502c3aa5e819c7881af8ece4b4a9d82b9e46
commit afc4502c3aa5e819c7881af8ece4b4a9d82b9e46
Author: jlauros <janne.lauros at csc.fi>
AuthorDate: Wed Dec 3 14:01:34 2025 +0200
Rename abstract msg classes
---
.../AbstractOpenIDVCICredentialsRequestAction.java | 40 ++++++++
...AbstractOpenIDVCICredentialsResponseAction.java | 81 ++++++++++++++++
...enIDVCICredentialsValidationResponseAction.java | 82 ++++++++++++++++
.../impl/AbstractOpenIDVCITokenRequestAction.java | 51 ++++++++++
.../impl/AbstractOpenIDVCITokenResponseAction.java | 105 +++++++++++++++++++++
.../profile/impl/stolen/ParseAccessToken.java | 5 +-
6 files changed, 362 insertions(+), 2 deletions(-)
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsRequestAction.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsRequestAction.java
new file mode 100644
index 0000000..20006cc
--- /dev/null
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsRequestAction.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed 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 org.geant.shibboleth.plugin.openidvci.messaging.impl;
+
+import org.geant.shibboleth.plugin.openidvci.profile.impl.stolen.AbstractOIDCRequestAction;
+import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import com.nimbusds.openid.connect.sdk.UserInfoRequest;
+
+/**
+ * Abstract class for actions performing actions on {@link UserInfoRequest}
+ * found via {@link ProfileRequestContext#getInboundMessageContext()} and
+ * {@link MessageContext#getMessage()}.
+ */
+public abstract class AbstractOpenIDVCICredentialsRequestAction
+ extends AbstractOIDCRequestAction<OpenIDVCICredentialsRequest> {
+
+ /**
+ * Returns OpenID VCI Credentials request.
+ *
+ * @return request
+ */
+ public OpenIDVCICredentialsRequest getCredentialsRequest() {
+ return getRequest();
+ }
+
+}
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsResponseAction.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsResponseAction.java
new file mode 100644
index 0000000..c554e26
--- /dev/null
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsResponseAction.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed 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.
+ */
+
+// TODO: This abstract class is copied as is from shibboleth project. Refactoring needed.
+
+package org.geant.shibboleth.plugin.openidvci.messaging.impl;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.profile.action.ActionSupport;
+import org.opensaml.profile.action.EventIds;
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.slf4j.Logger;
+
+import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCAuthenticationResponseContext;
+import net.shibboleth.oidc.metadata.context.OIDCMetadataContext;
+import net.shibboleth.shared.primitive.LoggerFactory;
+
+/**
+ *
+ * Abstract class for actions performing actions on {@link OIDCMetadataContext}
+ * located under {@link ProfileRequestContext#getInboundMessageContext()}.
+ * Extends base classes that offer actions on
+ * {@link OpenIDVCICredentialsRequest} found via
+ * {@link ProfileRequestContext#getInboundMessageContext()} and
+ * {@link MessageContext#getMessage()} and on
+ * {@link OIDCAuthenticationResponseContext} located under
+ * {@link ProfileRequestContext#getOutboundMessageContext()}.
+ */
+abstract public class AbstractOpenIDVCICredentialsResponseAction
+ extends AbstractOpenIDVCICredentialsValidationResponseAction {
+
+ /** Class logger. */
+ @Nonnull
+ private Logger log = LoggerFactory.getLogger(AbstractOpenIDVCICredentialsResponseAction.class);
+
+ /** OIDC Metadata context. */
+ @Nullable
+ private OIDCMetadataContext oidcMetadataContext;
+
+ /**
+ * Returns the OIDC Metadata context.
+ *
+ * @return The OIDC Metadata context.
+ */
+ @Nullable
+ public OIDCMetadataContext getMetadataContext() {
+ return oidcMetadataContext;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
+
+ if (!super.doPreExecute(profileRequestContext)) {
+ return false;
+ }
+ oidcMetadataContext = profileRequestContext.ensureInboundMessageContext()
+ .getSubcontext(OIDCMetadataContext.class);
+ if (oidcMetadataContext == null) {
+ log.error("{} No metadata found for relying party", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsValidationResponseAction.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsValidationResponseAction.java
new file mode 100644
index 0000000..b7d371a
--- /dev/null
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCICredentialsValidationResponseAction.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed 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.
+ */
+
+// TODO: This abstract class is copied as is from shibboleth project. Refactoring needed.
+
+package org.geant.shibboleth.plugin.openidvci.messaging.impl;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.profile.action.ActionSupport;
+import org.opensaml.profile.action.EventIds;
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.slf4j.Logger;
+import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCAuthenticationResponseContext;
+import net.shibboleth.shared.primitive.LoggerFactory;
+
+/**
+ *
+ * Abstract class for actions performing actions on
+ * {@link OIDCAuthenticationResponseContext} located under
+ * {@link ProfileRequestContext#getOutboundMessageContext()}. Extends base class
+ * that offers actions on {@link OpenIDVCICredentialsRequest} found via
+ * {@link ProfileRequestContext#getInboundMessageContext()} and
+ * {@link MessageContext#getMessage()}.
+ */
+abstract public class AbstractOpenIDVCICredentialsValidationResponseAction
+ extends AbstractOpenIDVCICredentialsRequestAction {
+
+ /** Class logger. */
+ @Nonnull
+ private Logger log = LoggerFactory.getLogger(AbstractOpenIDVCICredentialsValidationResponseAction.class);
+
+ /** oidc response context. */
+ @Nullable
+ private OIDCAuthenticationResponseContext oidcResponseContext;
+
+ /**
+ * Returns oidc response context.
+ *
+ * @return ctx.
+ */
+ @Nullable
+ public OIDCAuthenticationResponseContext getOidcResponseContext() {
+ return oidcResponseContext;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
+
+ if (!super.doPreExecute(profileRequestContext)) {
+ return false;
+ }
+ final MessageContext outboundMessageCtx = profileRequestContext.getOutboundMessageContext();
+ if (outboundMessageCtx == null) {
+ log.error("{} No outbound message context", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
+ return false;
+ }
+ oidcResponseContext = outboundMessageCtx.getSubcontext(OIDCAuthenticationResponseContext.class);
+ if (oidcResponseContext == null) {
+ log.error("{} No oidc response context", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCITokenRequestAction.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCITokenRequestAction.java
new file mode 100644
index 0000000..c45b84d
--- /dev/null
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCITokenRequestAction.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed 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 org.geant.shibboleth.plugin.openidvci.messaging.impl;
+
+import javax.annotation.Nullable;
+
+import org.geant.shibboleth.plugin.openidvci.profile.impl.stolen.AbstractOIDCRequestAction;
+import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import com.nimbusds.oauth2.sdk.TokenRequest;
+
+/**
+ * Abstract class for actions performing actions on {@link TokenRequest} found
+ * via {@link ProfileRequestContext#getInboundMessageContext()} and
+ * {@link MessageContext#getMessage()}.
+ */
+public abstract class AbstractOpenIDVCITokenRequestAction extends AbstractOIDCRequestAction<OpenIDVCITokenRequest> {
+
+ /**
+ * Returns OIDC token request.
+ *
+ * @return request
+ */
+ @Nullable
+ public TokenRequest getTokenRequest() {
+ return getRequest().getOPTokenRequest();
+ }
+
+ /**
+ * Returns OpenID VCI token request.
+ *
+ * @return request
+ */
+ public OpenIDVCITokenRequest getOpenIDVCITokenRequest() {
+ return getRequest();
+ }
+
+}
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCITokenResponseAction.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCITokenResponseAction.java
new file mode 100644
index 0000000..8d05dc7
--- /dev/null
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/messaging/impl/AbstractOpenIDVCITokenResponseAction.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed 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 org.geant.shibboleth.plugin.openidvci.messaging.impl;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.messaging.context.MessageContext;
+import org.opensaml.profile.action.ActionSupport;
+import org.opensaml.profile.action.EventIds;
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.slf4j.Logger;
+
+import com.nimbusds.oauth2.sdk.TokenRequest;
+
+import net.shibboleth.idp.plugin.oidc.op.messaging.context.OIDCAuthenticationResponseContext;
+import net.shibboleth.oidc.metadata.context.OIDCMetadataContext;
+import net.shibboleth.shared.primitive.LoggerFactory;
+
+/**
+ * Abstract class for actions performing actions on
+ * {@link OIDCAuthenticationResponseContext} located under
+ * {@link ProfileRequestContext#getOutboundMessageContext()}. Extends base class
+ * that offers actions on {@link TokenRequest} and {@link OpenIDVCITokenRequest}
+ * found via {@link MessageContext#getMessage()}.
+ */
+public abstract class AbstractOpenIDVCITokenResponseAction extends AbstractOpenIDVCITokenRequestAction {
+
+ /** Class logger. */
+ @Nonnull
+ private Logger log = LoggerFactory.getLogger(AbstractOpenIDVCITokenResponseAction.class);
+
+ /** oidc response context. */
+ @Nullable
+ private OIDCAuthenticationResponseContext oidcResponseContext;
+
+ /** OIDC Metadata context. */
+ @Nullable
+ private OIDCMetadataContext oidcMetadataContext;
+
+ /**
+ * Returns oidc response context.
+ *
+ * @return ctx.
+ */
+ @Nullable
+ public OIDCAuthenticationResponseContext getOidcResponseContext() {
+ return oidcResponseContext;
+ }
+
+ /**
+ * Returns the OIDC Metadata context.
+ *
+ * @return The OIDC Metadata context.
+ */
+ @Nullable
+ public OIDCMetadataContext getMetadataContext() {
+ return oidcMetadataContext;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
+
+ if (!super.doPreExecute(profileRequestContext)) {
+ return false;
+ }
+
+ if (profileRequestContext.getOutboundMessageContext() == null) {
+ log.error("{} No outbound message context", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
+ return false;
+ }
+ oidcResponseContext = profileRequestContext.ensureOutboundMessageContext()
+ .getSubcontext(OIDCAuthenticationResponseContext.class);
+ if (oidcResponseContext == null) {
+ log.error("{} No OIDC response context", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
+ return false;
+ }
+
+ if (profileRequestContext.getInboundMessageContext() == null) {
+ log.error("{} No inbound message context", getLogPrefix());
+ ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX);
+ return false;
+ }
+ oidcMetadataContext = profileRequestContext.ensureInboundMessageContext()
+ .getSubcontext(OIDCMetadataContext.class);
+
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/stolen/ParseAccessToken.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/stolen/ParseAccessToken.java
index 2d9944e..5ddc2f4 100644
--- a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/stolen/ParseAccessToken.java
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/stolen/ParseAccessToken.java
@@ -22,6 +22,7 @@ import java.util.function.Predicate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+import org.geant.shibboleth.plugin.openidvci.messaging.impl.AbstractOpenIDVCICredentialsValidationResponseAction;
import org.opensaml.profile.action.ActionSupport;
import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -66,7 +67,7 @@ import net.shibboleth.shared.security.DataSealerException;
*
* @since 3.2.0
*/
-public class ParseAccessToken extends AbstractOIDCUserInfoValidationResponseAction {
+public class ParseAccessToken extends AbstractOpenIDVCICredentialsValidationResponseAction {
/** Class logger. */
@Nonnull private Logger log = LoggerFactory.getLogger(ParseAccessToken.class);
@@ -136,7 +137,7 @@ public class ParseAccessToken extends AbstractOIDCUserInfoValidationResponseActi
final String invalidTokenId = dpopAccessTokenCondition.test(profileRequestContext) ?
OidcEventIds.INVALID_ACCESS_TOKEN : OidcEventIds.INVALID_ACCESS_TOKEN;
- final AccessToken token = getUserInfoRequest().getAccessToken();
+ final AccessToken token = getCredentialsRequest().getAccessToken();
if (token == null) {
log.error("{} Token missing from request", getLogPrefix());
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list