[java-oidc-common] branch main updated: Adjust some misnamed predicate settings.

Scott Cantor cantor.2 at osu.edu
Fri Jan 28 16:50:59 UTC 2022


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

scantor 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=597944408b27a5f5686c6e593b6a1b26c2aada45

The following commit(s) were added to refs/heads/main by this push:
     new 5979444  Adjust some misnamed predicate settings.
5979444 is described below

commit 597944408b27a5f5686c6e593b6a1b26c2aada45
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Jan 28 11:50:55 2022 -0500

    Adjust some misnamed predicate settings.
---
 .../config/OIDCAuthorizationConfiguration.java     | 114 ++++++++++-----------
 1 file changed, 57 insertions(+), 57 deletions(-)

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 6269564..dd79df8 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
@@ -65,7 +65,7 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
     /** Lookup function to supply attribute IDs to embed in authorization code or access token. */
     @Nonnull private Function<ProfileRequestContext,Set<String>> encodedAttributesLookupStrategy;
     
-    /** Whether to encode authentication request parameters inside a JWT request object.*/
+    /** Whether to encode authentication request parameters inside a JWT request object .*/
     @Nonnull private Predicate<ProfileRequestContext> useRequestObjectPredicate;
 
     /** Lookup function to supply attribute IDs to omit from UserInfo token. */
@@ -104,57 +104,17 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
     public OIDCAuthorizationConfiguration(@Nonnull @NotEmpty final String profileId) {
         super(profileId);
 
-        authorizeCodeLifetimeLookupStrategy = FunctionSupport.constant(Duration.ofMinutes(5));
-
         acrRequestAlwaysEssentialPredicate = Predicates.alwaysFalse();
         encodeConsentInTokensPredicate = Predicates.alwaysFalse();
         useRequestObjectPredicate = Predicates.alwaysFalse();
+
+        authorizeCodeLifetimeLookupStrategy = FunctionSupport.constant(Duration.ofMinutes(5));
         
         encodedAttributesLookupStrategy = FunctionSupport.constant(null);
         deniedUserInfoAttributesLookupStrategy = FunctionSupport.constant(null);
         httpRequestMethodLookupStrategy = FunctionSupport.constant(OIDCHttpRequestMethod.GET);
     }
 
-    /**
-     * Get authz code lifetime.
-     * 
-     * <p>Defaults to 5 minutes.</p>
-     * 
-     * @param profileRequestContext profile request context
-     * 
-     * @return authz code lifetime
-     */
-    @Positive @Nonnull
-    public Duration getAuthorizeCodeLifetime(@Nullable final ProfileRequestContext profileRequestContext) {
-        final Duration lifetime = authorizeCodeLifetimeLookupStrategy.apply(profileRequestContext);
-        
-        Constraint.isTrue(lifetime != null && !lifetime.isZero() && !lifetime.isNegative(),
-                "Authorization code lifetime must be greater than 0");
-        return lifetime;
-    }
-
-    /**
-     * Set the lifetime of authz code.
-     * 
-     * @param lifetime lifetime of authz code
-     */
-    public void setAuthorizeCodeLifetime(@Positive @Nonnull final Duration lifetime) {
-        Constraint.isTrue(lifetime != null && !lifetime.isZero() && !lifetime.isNegative(),
-                "Authorization code lifetime must be greater than 0");
-        
-        authorizeCodeLifetimeLookupStrategy = FunctionSupport.constant(lifetime);
-    }
-    
-    /**
-     * Set a lookup strategy for the authz code lifetime.
-     *
-     * @param strategy lookup strategy
-     */
-    public void setAuthorizeCodeLifetimeLookupStrategy(
-            @Nonnull final Function<ProfileRequestContext,Duration> strategy) {
-        authorizeCodeLifetimeLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
-    }
-
     /**
      * Get whether all acr claim requests should be treated as Essential.
      * 
@@ -185,14 +145,14 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
     }
     
     /**
-     * Set condition for whether the authentication request parameters should be passed in a single, 
-     * self contained, JWT. 
+     * Should authentication request parameters should be passed in a single, self contained, JWT?
      * 
-     * @param condition condition to set
+     * @param profileRequestContext the profile request context
+     * 
+     * @return whether authentication request parameters should be passed in a single, self contained, JWT
      */
-    public void setUseRequestObjectPredicate(
-            @Nonnull final Predicate<ProfileRequestContext> condition) {
-        useRequestObjectPredicate = Constraint.isNotNull(condition, "Use request object condition cannot be null");
+    public boolean isUseRequestObject(@Nullable final ProfileRequestContext profileRequestContext) {
+        return useRequestObjectPredicate.test(profileRequestContext);
     }
     
     /**
@@ -200,19 +160,19 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
      *
      * @param flag flag to set
      */
-    public void setUseRequestObjectPredicate(final boolean flag) {
+    public void setUseRequestObject(final boolean flag) {
         useRequestObjectPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
     }
-    
+
     /**
-     * Should authentication request parameters should be passed in a single, self contained, JWT?
-     * 
-     * @param profileRequestContext the profile request context
+     * Set condition for whether the authentication request parameters should be passed in a single, 
+     * self contained, JWT. 
      * 
-     * @return whether authentication request parameters should be passed in a single, self contained, JWT
+     * @param condition condition to set
      */
-    public boolean isUseRequestObjectPredicate(@Nullable final ProfileRequestContext profileRequestContext) {
-        return useRequestObjectPredicate.test(profileRequestContext);
+    public void setUseRequestObjectPredicate(
+            @Nonnull final Predicate<ProfileRequestContext> condition) {
+        useRequestObjectPredicate = Constraint.isNotNull(condition, "Use request object condition cannot be null");
     }
 
     /**
@@ -244,6 +204,46 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
         encodeConsentInTokensPredicate = Constraint.isNotNull(condition, "Condition cannot be null");
     }
     
+    /**
+     * Get authz code lifetime.
+     * 
+     * <p>Defaults to 5 minutes.</p>
+     * 
+     * @param profileRequestContext profile request context
+     * 
+     * @return authz code lifetime
+     */
+    @Positive @Nonnull
+    public Duration getAuthorizeCodeLifetime(@Nullable final ProfileRequestContext profileRequestContext) {
+        final Duration lifetime = authorizeCodeLifetimeLookupStrategy.apply(profileRequestContext);
+        
+        Constraint.isTrue(lifetime != null && !lifetime.isZero() && !lifetime.isNegative(),
+                "Authorization code lifetime must be greater than 0");
+        return lifetime;
+    }
+
+    /**
+     * Set the lifetime of authz code.
+     * 
+     * @param lifetime lifetime of authz code
+     */
+    public void setAuthorizeCodeLifetime(@Positive @Nonnull final Duration lifetime) {
+        Constraint.isTrue(lifetime != null && !lifetime.isZero() && !lifetime.isNegative(),
+                "Authorization code lifetime must be greater than 0");
+        
+        authorizeCodeLifetimeLookupStrategy = FunctionSupport.constant(lifetime);
+    }
+    
+    /**
+     * Set a lookup strategy for the authz code lifetime.
+     *
+     * @param strategy lookup strategy
+     */
+    public void setAuthorizeCodeLifetimeLookupStrategy(
+            @Nonnull final Function<ProfileRequestContext,Duration> strategy) {
+        authorizeCodeLifetimeLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
+    }
+    
     /**
      * Set a lookup strategy to determine the HTTP request method for an authentication request.
      * 

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


More information about the commits mailing list