[java-oidc-common] branch main updated: JCOMOIDC-193 - Profile configuration setting to control one-time use of registration access tokens
Codeberg
noreply at shibboleth.net
Tue Nov 24 13:21:20 UTC 2026
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-oidc-common.
View the commit online:
https://codeberg.org/Shibboleth/java-oidc-common/commit/26f2b7a91a45f0ff706e5b410d4fc8f2a20373b3
The following commit(s) were added to refs/heads/main by this push:
new 26f2b7a9 JCOMOIDC-193 - Profile configuration setting to control one-time use of registration access tokens
26f2b7a9 is described below
commit 26f2b7a91a45f0ff706e5b410d4fc8f2a20373b3
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Tue Nov 24 15:20:23 2026 +0200
JCOMOIDC-193 - Profile configuration setting to control one-time use of registration access tokens
https://shibboleth.atlassian.net/browse/JCOMOIDC-193
Defaults to false for backwards compatibility
---
.../OIDCDynamicRegistrationConfiguration.java | 14 +++++++
.../OneTimeRegistrationAccessTokenPredicate.java | 45 ++++++++++++++++++++++
...efaultOIDCDynamicRegistrationConfiguration.java | 34 ++++++++++++++++
3 files changed, 93 insertions(+)
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCDynamicRegistrationConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCDynamicRegistrationConfiguration.java
index 379b49f1..863068a8 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCDynamicRegistrationConfiguration.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCDynamicRegistrationConfiguration.java
@@ -75,4 +75,18 @@ public interface OIDCDynamicRegistrationConfiguration extends OverriddenIssuerPr
@ConfigurationSetting(name="metadataPolicy")
@Nullable
Map<String,MetadataPolicy> getMetadataPolicy(@Nullable final ProfileRequestContext profileRequestContext);
+
+ /**
+ * Get whether registration access tokens are for one-time use.
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return whether registration access tokens are for one-time use
+ *
+ * @since 3.4.0
+ */
+ @ConfigurationSetting(name="oneTimeRegistrationAccessToken")
+ default boolean isOneTimeRegistrationAccessToken(@Nullable final ProfileRequestContext profileRequestContext) {
+ return false;
+ }
}
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/logic/OneTimeRegistrationAccessTokenPredicate.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/logic/OneTimeRegistrationAccessTokenPredicate.java
new file mode 100644
index 00000000..98c1cc7c
--- /dev/null
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/logic/OneTimeRegistrationAccessTokenPredicate.java
@@ -0,0 +1,45 @@
+/*
+ * 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 net.shibboleth.oidc.profile.config.logic;
+
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import net.shibboleth.profile.config.ProfileConfiguration;
+import net.shibboleth.profile.context.RelyingPartyContext;
+import net.shibboleth.profile.context.logic.AbstractRelyingPartyPredicate;
+import net.shibboleth.oidc.profile.config.OIDCDynamicRegistrationConfiguration;
+
+/**
+ * A predicate implementation that forwards to
+ * {@link OIDCDynamicRegistrationConfiguration#isOneTimeRegistrationAccessToken(ProfileRequestContext)}.
+ */
+public class OneTimeRegistrationAccessTokenPredicate extends AbstractRelyingPartyPredicate {
+
+ /** {@inheritDoc} */
+ @Override
+ public boolean test(@Nullable final ProfileRequestContext input) {
+ final RelyingPartyContext rpc = getRelyingPartyContextLookupStrategy().apply(input);
+ if (rpc != null) {
+ final ProfileConfiguration pc = rpc.getProfileConfig();
+ if (pc instanceof OIDCDynamicRegistrationConfiguration drc) {
+ return drc.isOneTimeRegistrationAccessToken(input);
+ }
+ }
+ return false;
+ }
+
+}
\ No newline at end of file
diff --git a/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/config/impl/DefaultOIDCDynamicRegistrationConfiguration.java b/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/config/impl/DefaultOIDCDynamicRegistrationConfiguration.java
index 34663ac6..b171dfe9 100644
--- a/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/config/impl/DefaultOIDCDynamicRegistrationConfiguration.java
+++ b/oidc-common-profile-impl/src/main/java/net/shibboleth/oidc/profile/config/impl/DefaultOIDCDynamicRegistrationConfiguration.java
@@ -17,6 +17,7 @@ package net.shibboleth.oidc.profile.config.impl;
import java.time.Duration;
import java.util.Map;
import java.util.function.Function;
+import java.util.function.Predicate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -30,6 +31,7 @@ import net.shibboleth.shared.annotation.constraint.NonNegative;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.logic.PredicateSupport;
/**
* Implemenation of a profile configuration for the OpenID Connect dynamic client registration.
@@ -52,6 +54,9 @@ public class DefaultOIDCDynamicRegistrationConfiguration extends AbstractOAuth2F
/** Lookup function to the default metadata policy. */
@Nonnull private Function<ProfileRequestContext,Map<String,MetadataPolicy>> metadataPolicyLookupStrategy;
+ /** Whether registration access tokens are for one-time use. */
+ @Nonnull private Predicate<ProfileRequestContext> oneTimeRegistrationAccessTokenPredicate;
+
/**
* Constructor.
*/
@@ -71,6 +76,7 @@ public class DefaultOIDCDynamicRegistrationConfiguration extends AbstractOAuth2F
secretExpirationPeriodLookupStrategy = FunctionSupport.constant(Duration.ofDays(365));
metadataPolicyLookupStrategy = FunctionSupport.constant(null);
registrationValidityPeriodLookupStrategy = FunctionSupport.constant(null);
+ oneTimeRegistrationAccessTokenPredicate = PredicateSupport.alwaysFalse();
}
/** {@inheritDoc} */
@@ -194,4 +200,32 @@ public class DefaultOIDCDynamicRegistrationConfiguration extends AbstractOAuth2F
metadataPolicyLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
}
+ /** {@inheritDoc} */
+ @Override
+ public boolean isOneTimeRegistrationAccessToken(@Nullable final ProfileRequestContext profileRequestContext) {
+ return oneTimeRegistrationAccessTokenPredicate.test(profileRequestContext);
+ }
+
+ /**
+ * Set whether registration access tokens are for one-time use.
+ *
+ * @param flag flag to set
+ *
+ * @since 3.4.0
+ */
+ public void setOneTimeRegistrationAccessToken(final boolean flag) {
+ oneTimeRegistrationAccessTokenPredicate = flag ? PredicateSupport.alwaysTrue() : PredicateSupport.alwaysFalse();
+ }
+
+ /**
+ * Set condition for whether registration access tokens are for one-time use.
+ *
+ * @param condition condition to set
+ *
+ * @since 3.4.0
+ */
+ public void setOneTimeRegistrationAccessTokenPredicate(@Nonnull final Predicate<ProfileRequestContext> condition) {
+ oneTimeRegistrationAccessTokenPredicate = Constraint.isNotNull(condition, "Condition cannot be null");
+ }
+
}
\ 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