[java-oidc-common] branch main updated: Add configuration property to set UserInfo HTTP request method
Phil Smart
philip.smart at jisc.ac.uk
Wed Mar 15 15:13:58 UTC 2023
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-oidc-common.
View the commit online:
http://git.shibboleth.net/view/?p=java-oidc-common.git;a=commit;h=999e6f5f5853e3dd6af5258cc977f1db2d7e9514
The following commit(s) were added to refs/heads/main by this push:
new 999e6f5 Add configuration property to set UserInfo HTTP request method
999e6f5 is described below
commit 999e6f5f5853e3dd6af5258cc977f1db2d7e9514
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Wed Mar 15 15:13:51 2023 +0000
Add configuration property to set UserInfo HTTP request method
---
.../config/OIDCAuthorizationConfiguration.java | 55 +++++++++++++++++++++-
1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCAuthorizationConfiguration.java b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCAuthorizationConfiguration.java
index ab8fbe9..8bed866 100644
--- a/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCAuthorizationConfiguration.java
+++ b/oidc-common-profile-api/src/main/java/net/shibboleth/oidc/profile/config/OIDCAuthorizationConfiguration.java
@@ -118,7 +118,6 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
/** Whether authentication results should carry the proxied auth_time in the id_token. */
@Nonnull private Predicate<ProfileRequestContext> proxiedAuthnInstantPredicate;
-
/**
* Which HTTP method should be used to issue OIDC authentication requests.
* Supported values are POST and GET. The default is GET.
@@ -135,6 +134,12 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
/** Lookup function to determine the login_hint of an authentication request.*/
@Nonnull private Function<ProfileRequestContext, String> loginHintLookupStrategy;
+
+ /**
+ * Which HTTP method should be used to issue the UserInfo requests.
+ * Supported values are POST and GET. The default is GET.
+ */
+ @Nonnull private Function<ProfileRequestContext,String> userInfoHttpRequestMethodLookupStrategy;
/**
* Constructor.
@@ -175,6 +180,7 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
authorizationCodeClaimsSetManipulationStrategyLookupStrategy = FunctionSupport.constant(null);
maxAuthenticationAgeLookupStrategy = FunctionSupport.constant(null);
loginHintLookupStrategy = FunctionSupport.constant(null);
+ userInfoHttpRequestMethodLookupStrategy = FunctionSupport.constant(OIDCHttpRequestMethod.GET.toString());
}
/**
@@ -896,5 +902,52 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
@Nullable public String getLoginHint(@Nullable final ProfileRequestContext profileRequestContext) {
return loginHintLookupStrategy.apply(profileRequestContext);
}
+
+ /**
+ * Set a lookup strategy to determine the HTTP request method for an UserInfo request.
+ *
+ * @param strategy the strategy to set.
+ *
+ * @since 2.2.0
+ */
+ public void setUserInfoHttpRequestMethodLookupStrategy(
+ @Nonnull final Function<ProfileRequestContext, String> strategy) {
+ userInfoHttpRequestMethodLookupStrategy =
+ Constraint.isNotNull(strategy, "HTTP request method strategy can not be null");
+ }
+
+ /**
+ * Set the HTTP request method for an UserInfo request.
+ *
+ * @param method the HTTP method to set, either POST or GET.
+ *
+ * @since 2.2.0
+ */
+ public void setUserInfoHttpRequestMethod(@Nonnull @NotEmpty final OIDCHttpRequestMethod method){
+ userInfoHttpRequestMethodLookupStrategy = FunctionSupport.constant(method != null ? method.toString() : null);
+ }
+
+ /**
+ * Get the HTTP request method for an UserInfo request.
+ *
+ * @param profileRequestContext profile request context
+ *
+ * @return the HTTP request method
+ *
+ * @since 2.2.0
+ */
+ @Nullable public OIDCHttpRequestMethod getUserInfoHttpRequestMethod(
+ @Nullable final ProfileRequestContext profileRequestContext) {
+ final String method = userInfoHttpRequestMethodLookupStrategy.apply(profileRequestContext);
+ if (method != null) {
+ try {
+ return OIDCHttpRequestMethod.valueOf(method);
+ } catch (final IllegalArgumentException e) {
+ throw new ConstraintViolationException("Unexpected HTTP method value: '" + method + "': "
+ + e.getMessage());
+ }
+ }
+ return null;
+ }
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list