[java-oidc-common] 02/18: Add more incorrect interfaces
Phil Smart
philip.smart at jisc.ac.uk
Tue Mar 28 15:26:29 UTC 2023
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch dev/JCOMOIDC-66
in repository java-oidc-common.
View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=edd728de3b52bfdd96c7c949ed4246f4f59edeaa
commit edd728de3b52bfdd96c7c949ed4246f4f59edeaa
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Mar 17 10:02:04 2023 +0000
Add more incorrect interfaces
---
.../OIDCDynamicRegistrationConfiguration.java | 30 ++------
...IDCDynamicRegistrationProfileConfiguration.java | 65 +++++++++++++++++
...IDCProviderInformationProfileConfiguration.java | 6 ++
...th2ClientAuthenticableProfileConfiguration.java | 3 +-
...th2ClientAuthenticableProfileConfiguration.java | 83 ++++++++++++++++++++++
.../oauth2/config/OAuth2TokenConfiguration.java | 30 ++------
.../config/OAuth2TokenProfileConfiguration.java | 74 +++++++++++++++++++
7 files changed, 238 insertions(+), 53 deletions(-)
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 ca81434..debc9fc 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
@@ -38,7 +38,7 @@ import net.shibboleth.utilities.java.support.logic.FunctionSupport;
* Profile configuration for the OpenID Connect dynamic client registration.
*/
public class OIDCDynamicRegistrationConfiguration extends AbstractOAuth2FlowAwareProfileConfiguration
- implements OverriddenIssuerProfileConfiguration {
+ implements OIDCDynamicRegistrationProfileConfiguration, OverriddenIssuerProfileConfiguration {
/** OIDC base protocol URI. */
public static final String PROTOCOL_URI = "https://openid.net/specs/openid-connect-registration-1_0.html";
@@ -102,15 +102,7 @@ public class OIDCDynamicRegistrationConfiguration extends AbstractOAuth2FlowAwar
issuerLookupStrategy = Constraint.isNotNull(strategy, "Issuer lookup strategy cannot be null");
}
- /**
- * Get dynamic registration validity period.
- *
- * <p>A 0 is interpreted as an unlimited period.</p>
- *
- * @param profileRequestContext profile request context
- *
- * @return dynamic registration validity period
- */
+ @Override
@Nullable @NonNegative
public Duration getRegistrationValidityPeriod(@Nullable final ProfileRequestContext profileRequestContext) {
@@ -145,15 +137,7 @@ public class OIDCDynamicRegistrationConfiguration extends AbstractOAuth2FlowAwar
registrationValidityPeriodLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
}
- /**
- * Get client secret expiration period.
- *
- * <p>A 0 is interpreted as an unlimited period.</p>
- *
- * @param profileRequestContext profile request context
- *
- * @return client secret expiration period
- */
+ @Override
@Nullable @NonNegative
public Duration getSecretExpirationPeriod(@Nullable final ProfileRequestContext profileRequestContext) {
final Duration period = secretExpirationPeriodLookupStrategy.apply(profileRequestContext);
@@ -187,13 +171,7 @@ public class OIDCDynamicRegistrationConfiguration extends AbstractOAuth2FlowAwar
secretExpirationPeriodLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
}
- /**
- * Get the metadata policy.
- *
- * @param profileRequestContext profile request context
- *
- * @return metadata policy
- */
+ @Override
@Nullable
public Map<String,MetadataPolicy> getMetadataPolicy(@Nullable final ProfileRequestContext profileRequestContext) {
return metadataPolicyLookupStrategy.apply(profileRequestContext);
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCDynamicRegistrationProfileConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCDynamicRegistrationProfileConfiguration.java
new file mode 100644
index 0000000..95d6f22
--- /dev/null
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCDynamicRegistrationProfileConfiguration.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You 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;
+
+import java.time.Duration;
+import java.util.Map;
+
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import net.shibboleth.oidc.metadata.policy.MetadataPolicy;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonNegative;
+
+public interface OIDCDynamicRegistrationProfileConfiguration {
+
+ /**
+ * Get dynamic registration validity period.
+ *
+ * <p>A 0 is interpreted as an unlimited period.</p>
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return dynamic registration validity period
+ */
+ @Nullable @NonNegative
+ Duration getRegistrationValidityPeriod(@Nullable final ProfileRequestContext profileRequestContext);
+
+ /**
+ * Get client secret expiration period.
+ *
+ * <p>A 0 is interpreted as an unlimited period.</p>
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return client secret expiration period
+ */
+ @Nullable @NonNegative
+ Duration getSecretExpirationPeriod(@Nullable final ProfileRequestContext profileRequestContext);
+
+ /**
+ * Get the metadata policy.
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return metadata policy
+ */
+ @Nullable
+ Map<String,MetadataPolicy> getMetadataPolicy(@Nullable final ProfileRequestContext profileRequestContext)
+}
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCProviderInformationProfileConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCProviderInformationProfileConfiguration.java
new file mode 100644
index 0000000..c8e3e8f
--- /dev/null
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCProviderInformationProfileConfiguration.java
@@ -0,0 +1,6 @@
+
+package net.shibboleth.oidc.profile.config;
+
+public interface OIDCProviderInformationProfileConfiguration {
+
+}
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/AbstractOAuth2ClientAuthenticableProfileConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/AbstractOAuth2ClientAuthenticableProfileConfiguration.java
index b06b64a..618595a 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/AbstractOAuth2ClientAuthenticableProfileConfiguration.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/AbstractOAuth2ClientAuthenticableProfileConfiguration.java
@@ -51,7 +51,8 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
* Base class for OAuth profile configurations that support OAuth-defined client authentication methods.
*/
public abstract class AbstractOAuth2ClientAuthenticableProfileConfiguration
- extends AbstractConditionalProfileConfiguration implements AuthenticationProfileConfiguration {
+ extends AbstractConditionalProfileConfiguration implements OAuth2ClientAuthenticableProfileConfiguration,
+ AuthenticationProfileConfiguration {
/** Enabled token endpoint authentication methods. */
@Nonnull private Function<ProfileRequestContext,Set<String>> tokenEndpointAuthMethodsLookupStrategy;
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2ClientAuthenticableProfileConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2ClientAuthenticableProfileConfiguration.java
new file mode 100644
index 0000000..64a00f8
--- /dev/null
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2ClientAuthenticableProfileConfiguration.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You 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.oauth2.config;
+
+import java.util.Set;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import net.shibboleth.oidc.security.credential.ClientSecretCredential;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+
+/** OAuth 2.0 profile configurations that support OAuth-defined client authentication methods.*/
+public interface OAuth2ClientAuthenticableProfileConfiguration {
+
+ /**
+ * Get the enabled token endpoint authentication methods.
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return enabled token endpoint authentication methods
+ */
+ @Nonnull @NonnullElements @NotLive @Unmodifiable Set<String> getTokenEndpointAuthMethods(
+ @Nullable final ProfileRequestContext profileRequestContext);
+
+ /**
+ * Get the token endpoint authentication method to use with an OpenID Provider.
+ *
+ * @param profileRequestContext the profile request context
+ *
+ * @return the token endpoint authentication method to use.
+ *
+ * @since 2.2.0
+ */
+ @Nonnull String getTokenEndpointAuthMethod(@Nullable final ProfileRequestContext profileRequestContext);
+
+ /**
+ * Get the client credential for the given context. Typically a client_secret
+ * associated with the current client_id.
+ *
+ * @param profileRequestContext the profile request context
+ *
+ * @return the client credential
+ *
+ * @since 2.2.0
+ *
+ */
+ @Nullable ClientSecretCredential getClientCredential(
+ @Nullable final ProfileRequestContext profileRequestContext);
+
+ /**
+ * Get the client_id appropriate for the given context. Typically that associated
+ * with the chosen OpenID Connect Provider.
+ *
+ * @param profileRequestContext the profile request context
+ *
+ * @return the client_id
+ *
+ * @since 2.2.0
+ */
+ @Nonnull @NotEmpty String getClientId(@Nullable final ProfileRequestContext profileRequestContext);
+
+}
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2TokenConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2TokenConfiguration.java
index 2f75eb7..4fa49f2 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2TokenConfiguration.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2TokenConfiguration.java
@@ -45,7 +45,7 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
/**
* OIDC-aware OAuth 2 token endpoint profile configuration.
*/
-public class OAuth2TokenConfiguration extends AbstractOIDCSSOConfiguration {
+public class OAuth2TokenConfiguration extends AbstractOIDCSSOConfiguration implements OAuth2TokenProfileConfiguration {
/** ID for this profile configuration. */
@Nonnull @NotEmpty public static final String PROFILE_ID = "http://shibboleth.net/ns/profiles/oauth2/token";
@@ -82,13 +82,7 @@ public class OAuth2TokenConfiguration extends AbstractOIDCSSOConfiguration {
super(profileId);
}
- /**
- * Get the enabled grant types.
- *
- * @param profileRequestContext profile request context
- *
- * @return enabled grant types
- */
+ @Override
@Nonnull @NonnullElements @NotLive @Unmodifiable public Set<String> getGrantTypes(
@Nullable final ProfileRequestContext profileRequestContext) {
@@ -125,15 +119,7 @@ public class OAuth2TokenConfiguration extends AbstractOIDCSSOConfiguration {
grantTypesLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
}
- /**
- * Get the bi-function for manipulating refresh token claims set.
- *
- * @param profileRequestContext profile request context
- *
- * @return the bi-function for manipulating refresh token claims set
- *
- * @since 2.1.0
- */
+ @Override
@Nonnull
public BiFunction<ProfileRequestContext,Map<String,Object>,Map<String,Object>>
getRefreshTokenClaimsSetManipulationStrategy(
@@ -167,15 +153,7 @@ public class OAuth2TokenConfiguration extends AbstractOIDCSSOConfiguration {
"Lookup strategy cannot be null");
}
- /**
- * Get whether always revoke the refresh_token after it's used.
- *
- * @param profileRequestContext profile request context
- *
- * @return whether always revoke the refresh_token after it's used
- *
- * @since 2.1.0
- */
+ @Override
@Nonnull
public boolean isEnforceRefreshTokenRotation(
@Nullable final ProfileRequestContext profileRequestContext) {
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2TokenProfileConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2TokenProfileConfiguration.java
new file mode 100644
index 0000000..9eea7b8
--- /dev/null
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/oauth2/config/OAuth2TokenProfileConfiguration.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the University Corporation for Advanced Internet Development,
+ * Inc. (UCAID) under one or more contributor license agreements. See the
+ * NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The UCAID licenses this file to You 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.oauth2.config;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.function.BiFunction;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotLive;
+import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
+
+public interface OAuth2TokenProfileConfiguration {
+
+
+ /**
+ * Get the enabled grant types.
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return enabled grant types
+ */
+ @Nonnull @NonnullElements @NotLive @Unmodifiable Set<String> getGrantTypes(
+ @Nullable final ProfileRequestContext profileRequestContext);
+
+
+ /**
+ * Get the bi-function for manipulating refresh token claims set.
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return the bi-function for manipulating refresh token claims set
+ *
+ * @since 2.1.0
+ */
+ @Nonnull
+ BiFunction<ProfileRequestContext,Map<String,Object>,Map<String,Object>>
+ getRefreshTokenClaimsSetManipulationStrategy(
+ @Nullable final ProfileRequestContext profileRequestContext);
+
+ /**
+ * Get whether always revoke the refresh_token after it's used.
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return whether always revoke the refresh_token after it's used
+ *
+ * @since 2.1.0
+ */
+ @Nonnull
+ public boolean isEnforceRefreshTokenRotation(
+ @Nullable final ProfileRequestContext profileRequestContext)
+
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list