[java-idp-plugin-vci] 02/03: Profile configuration option to set credential lifetime
Codeberg
noreply at shibboleth.net
Fri Jan 2 12:26:24 UTC 2026
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/0bf8393c69781c2862b2ebb7809599d3a3bb9637
commit 0bf8393c69781c2862b2ebb7809599d3a3bb9637
Author: jlauros <janne.lauros at csc.fi>
AuthorDate: Fri Jan 2 14:23:18 2026 +0200
Profile configuration option to set credential lifetime
---
.../openidvci/config/OpenIDVCIConfiguration.java | 19 +++++++-------
.../impl/AbstractOpenIDVCIConfiguration.java | 29 ++++++++++++++++++++++
2 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/config/OpenIDVCIConfiguration.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/config/OpenIDVCIConfiguration.java
index 461095d..c4baa4e 100644
--- a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/config/OpenIDVCIConfiguration.java
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/config/OpenIDVCIConfiguration.java
@@ -42,22 +42,22 @@ public interface OpenIDVCIConfiguration extends ConditionalProfileConfiguration
@Nonnull
@NotEmpty
public static final String PROFILE_ID = "http://geant.org/ns/profiles/openid/vci";
-
+
/** ID for credential offer profile configuration. */
@Nonnull
@NotEmpty
public static final String PROFILE_ID_CREDENTIAL_OFFER = "http://geant.org/ns/profiles/openid/vci/credential-offer";
-
+
/** ID for token configuration. */
@Nonnull
@NotEmpty
public static final String PROFILE_ID_TOKEN = "http://geant.org/ns/profiles/openid/vci/token";
-
+
/** ID for credentials configuration. */
@Nonnull
@NotEmpty
public static final String PROFILE_ID_CREDENTIALS = "http://geant.org/ns/profiles/openid/vci/credentials";
-
+
/** ID for nonce configuration. */
@Nonnull
@NotEmpty
@@ -97,18 +97,19 @@ public interface OpenIDVCIConfiguration extends ConditionalProfileConfiguration
Duration getPreauthorizedCodeLifetime(@Nullable final ProfileRequestContext profileRequestContext);
/**
- * Get access token lifetime.
+ * Get credential lifetime.
*
* <p>
- * Defaults to 5 minutes.
+ * Defaults to 180 days.
* </p>
*
* @param profileRequestContext profile request context
*
- * @return access token lifetime
+ * @return credential lifetime
*/
- @ConfigurationSetting(name = "accessTokenLifetime")
+ @ConfigurationSetting(name = "credentialLifetime")
@Positive
@Nonnull
- Duration getAccessTokenLifetime(@Nullable final ProfileRequestContext profileRequestContext);
+ Duration getCredentialLifetime(@Nullable final ProfileRequestContext profileRequestContext);
+
}
diff --git a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/config/impl/AbstractOpenIDVCIConfiguration.java b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/config/impl/AbstractOpenIDVCIConfiguration.java
index 798b78b..41abd74 100644
--- a/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/config/impl/AbstractOpenIDVCIConfiguration.java
+++ b/openid-vci-impl/src/main/java/org/geant/shibboleth/plugin/openidvci/config/impl/AbstractOpenIDVCIConfiguration.java
@@ -42,6 +42,10 @@ public abstract class AbstractOpenIDVCIConfiguration extends AbstractOIDCSSOConf
@Nonnull
private Function<ProfileRequestContext, Integer> preauthorizedCodeLengthLookupStrategy;
+ /** Lookup function to supply credential lifetime. */
+ @Nonnull
+ private Function<ProfileRequestContext, Duration> credentialLifetimeLookupStrategy;
+
/**
* Constructor.
*/
@@ -49,6 +53,7 @@ public abstract class AbstractOpenIDVCIConfiguration extends AbstractOIDCSSOConf
super(profileId);
preauthorizedCodeLifetimeLookupStrategy = FunctionSupport.constant(Duration.ofMinutes(10));
preauthorizedCodeLengthLookupStrategy = FunctionSupport.constant(Integer.valueOf(0));
+ credentialLifetimeLookupStrategy = FunctionSupport.constant(Duration.ofDays(180));
}
/** {@inheritDoc} */
@@ -100,4 +105,28 @@ public abstract class AbstractOpenIDVCIConfiguration extends AbstractOIDCSSOConf
preauthorizedCodeLengthLookupStrategy = FunctionSupport.constant(codeLength);
}
+ /** {@inheritDoc} */
+ @Override
+ @Positive
+ @Nonnull
+ public Duration getCredentialLifetime(@Nullable final ProfileRequestContext profileRequestContext) {
+ final Duration lifetime = credentialLifetimeLookupStrategy.apply(profileRequestContext);
+
+ Constraint.isTrue(lifetime != null && !lifetime.isZero() && !lifetime.isNegative(),
+ "Credential lifetime must be greater than 0");
+ return lifetime;
+ }
+
+ /**
+ * Set the lifetime of an credential.
+ *
+ * @param lifetime lifetime of an credential
+ */
+ public void setCredentialLifetime(@Positive @Nonnull final Duration lifetime) {
+ Constraint.isTrue(lifetime != null && !lifetime.isZero() && !lifetime.isNegative(),
+ "Credential lifetime must be greater than 0");
+
+ credentialLifetimeLookupStrategy = FunctionSupport.constant(lifetime);
+ }
+
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list