[java-oidc-common] branch main updated: Add maxAuthenticationAgeLookupStrategy to profile config

Phil Smart philip.smart at jisc.ac.uk
Mon Dec 19 15:08:21 UTC 2022


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=dd7fea89b9806c4f21e71ad45815f6028817fca6

The following commit(s) were added to refs/heads/main by this push:
     new dd7fea8  Add maxAuthenticationAgeLookupStrategy to profile config
dd7fea8 is described below

commit dd7fea89b9806c4f21e71ad45815f6028817fca6
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Mon Dec 19 15:08:18 2022 +0000

    Add maxAuthenticationAgeLookupStrategy to profile config
---
 .../config/OIDCAuthorizationConfiguration.java     | 45 +++++++++++++++++++++-
 1 file changed, 44 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 5b59885..39f511a 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
@@ -148,6 +148,9 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
     @Nonnull
     private Function<ProfileRequestContext,BiFunction<ProfileRequestContext,Map<String,Object>,Map<String,Object>>>
         authorizationCodeClaimsSetManipulationStrategyLookupStrategy;
+    
+    /** Lookup function to determine the max_age of an authentication request. */
+    @Nonnull private Function<ProfileRequestContext,Duration> maxAuthenticationAgeLookupStrategy;
 
     /**
      * Constructor.
@@ -189,6 +192,7 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
         includeIssuerInResponsePredicate = Predicates.alwaysFalse();
 
         authorizationCodeClaimsSetManipulationStrategyLookupStrategy = FunctionSupport.constant(null);
+        maxAuthenticationAgeLookupStrategy = FunctionSupport.constant(null);
     }
 
     /**
@@ -914,6 +918,45 @@ public class OIDCAuthorizationConfiguration extends AbstractOIDCSSOConfiguration
     public void setProxiedAuthnInstant(final boolean flag) {
         proxiedAuthnInstantPredicate = flag ? Predicates.alwaysTrue() : Predicates.alwaysFalse();
     }
-   
+    
+    /**
+     * Get the max authentication age.
+     *
+     * @param profileRequestContext profile request context
+     *
+     * @return max authentication age
+     * 
+     * @since 2.2.0
+     */
+    @Nullable
+    public Duration getMaxAuthenticationAge(@Nullable final ProfileRequestContext profileRequestContext) {
+        return maxAuthenticationAgeLookupStrategy.apply(profileRequestContext);
+    }
+
+    /**
+     * Set the max authentication age.
+     *
+     * @param age the max authentication age
+     * 
+     * @since 2.2.0
+     */
+    public void setMaxAuthenticationAge(@Positive @Nonnull final Duration age) {
+        Constraint.isTrue(age != null && !age.isZero() && !age.isNegative(),
+                "Max age must be greater than 0");
+
+        maxAuthenticationAgeLookupStrategy = FunctionSupport.constant(age);
+    }
+    
+    /**
+     * Set a lookup strategy for the max authentication age.
+     *
+     * @param strategy lookup strategy
+     * 
+     * @since 2.2.0
+     */
+    public void setMaxAuthenticationAgeLookupStrategy(
+            @Nonnull final Function<ProfileRequestContext,Duration> strategy) {
+        maxAuthenticationAgeLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
+    }
 
 }

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


More information about the commits mailing list