[java-identity-provider] branch main updated: Add a defined hook for adding resolution material.

Scott Cantor cantor.2 at osu.edu
Wed Jan 12 20:26:23 UTC 2022


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

scantor pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=21c0178903ae51859d2c9b3997967a6d3876770c

The following commit(s) were added to refs/heads/main by this push:
     new 21c017890 Add a defined hook for adding resolution material.
21c017890 is described below

commit 21c0178903ae51859d2c9b3997967a6d3876770c
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jan 12 15:26:20 2022 -0500

    Add a defined hook for adding resolution material.
---
 .../idp/profile/impl/ResolveAttributes.java        | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
index 6007bcca1..218fec879 100644
--- a/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
+++ b/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
@@ -19,6 +19,7 @@ package net.shibboleth.idp.profile.impl;
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.function.Consumer;
 import java.util.function.Function;
 
 import javax.annotation.Nonnull;
@@ -86,6 +87,9 @@ public final class ResolveAttributes extends AbstractProfileAction {
     /** Strategy used to determine the attributes to resolve. */
     @Nonnull private Function<ProfileRequestContext,Collection<String>> attributesLookupStrategy;
     
+    /** Hook for adjusting/adding to resolution context. */
+    @Nullable private Consumer<AttributeResolutionContext> resolutionContextDecorator;
+    
     /** Whether to treat resolver errors as equivalent to resolving no attributes. */
     private boolean maskFailures;
     
@@ -201,6 +205,19 @@ public final class ResolveAttributes extends AbstractProfileAction {
         attributesLookupStrategy = FunctionSupport.constant(StringSupport.normalizeStringCollection(attributeIds));
     }
     
+    /**
+     * Set optional hook for decorating or adding to resolution context.
+     * 
+     * @param decorator decorator hook
+     * 
+     * @since 4.2.0
+     */
+    public void setResolutionContextDecorator(@Nullable final Consumer<AttributeResolutionContext> decorator) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+        
+        resolutionContextDecorator = decorator;
+    }
+    
     /**
      * Set whether to treat resolution failure as equivalent to resolving no attributes.
      * 
@@ -314,7 +331,7 @@ public final class ResolveAttributes extends AbstractProfileAction {
      * @param profileRequestContext current profile request context
      * @param resolutionContext context to populate
      */
-    protected void populateResolutionContext(@Nonnull final ProfileRequestContext profileRequestContext,
+    private void populateResolutionContext(@Nonnull final ProfileRequestContext profileRequestContext,
             @Nonnull final AttributeResolutionContext resolutionContext) {
 
         resolutionContext
@@ -344,6 +361,10 @@ public final class ResolveAttributes extends AbstractProfileAction {
         } else {
             resolutionContext.setAttributeIssuerID(null);
         }
+        
+        if (resolutionContextDecorator != null) {
+            resolutionContextDecorator.accept(resolutionContext);
+        }
     }
     
 }
\ 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