[java-idp-plugin-vci] 01/03: New abstract action for perfoming actions on resource originated credential configurations

Codeberg noreply at shibboleth.net
Wed Dec 31 12:10:32 UTC 2025


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch dev/W3CCred
in repository java-idp-plugin-vci.

View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-vci/commit/234231fbbb3fd2dd2e5271a59c1465e6e33c87ac

commit 234231fbbb3fd2dd2e5271a59c1465e6e33c87ac
Author: jlauros <janne.lauros at csc.fi>
AuthorDate: Wed Dec 31 10:14:10 2025 +0200

    New abstract action for perfoming actions on resource originated credential configurations
---
 .../impl/AbstractCredentialValidationAction.java   | 91 ++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/AbstractCredentialValidationAction.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/AbstractCredentialValidationAction.java
new file mode 100644
index 0000000..1ed34d3
--- /dev/null
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/profile/impl/AbstractCredentialValidationAction.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2025, GÉANT
+ *
+ * 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.profile.impl;
+
+import java.io.IOException;
+
+import javax.annotation.Nonnull;
+
+import org.geant.shibboleth.plugin.openidvci.credential.CredentialConfigurations;
+import org.geant.shibboleth.plugin.openidvci.profile.OpenIDVCIEventIds;
+import org.opensaml.profile.action.ActionSupport;
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import net.shibboleth.shared.resource.Resource;
+import net.shibboleth.idp.profile.AbstractProfileAction;
+import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
+import net.shibboleth.shared.annotation.constraint.NonnullBeforeExec;
+import net.shibboleth.shared.annotation.constraint.NotEmpty;
+import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.logic.Constraint;
+
+/**
+ * Abstract class for actions performing actions on
+ * {@link CredentialConfigurations} source from resource.
+ */
+abstract class AbstractCredentialValidationAction extends AbstractProfileAction {
+
+    /** Class logger. */
+    @Nonnull
+    private Logger log = LoggerFactory.getLogger(AbstractCredentialValidationAction.class);
+
+    /** The supported credentials file. */
+    @NonnullAfterInit
+    private Resource credentialsResource;
+
+    /** The supported credentials parsed from file. */
+    @NonnullBeforeExec
+    private CredentialConfigurations credentialConfigurations;
+
+    /** The supported credentials file. */
+    public void setCredentialsResource(@Nonnull @NotEmpty Resource resource) {
+        assert resource != null;
+        assert resource.exists();
+        credentialsResource = resource;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected void doInitialize() throws ComponentInitializationException {
+        super.doInitialize();
+        Constraint.isNotNull(credentialsResource, "Credentials resource cannot be null");
+    }
+
+    /**
+     * Get supported credentials parsed from file.
+     * 
+     * @return Supported credentials parsed from file
+     */
+    public CredentialConfigurations getCredentialConfigurations() {
+        return credentialConfigurations;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
+        try {
+            credentialConfigurations = CredentialConfigurations.parse(credentialsResource);
+        } catch (IOException e) {
+            log.error("{} Parsing credential configuration failed.", getLogPrefix(), e);
+            ActionSupport.buildEvent(profileRequestContext, OpenIDVCIEventIds.NO_CREDENTIAL_CONFIGURATION);
+            return false;
+        }
+        return super.doPreExecute(profileRequestContext);
+    }
+
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list