[java-identity-provider COMMIT] /trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttribut...

noreply at shibboleth.net noreply at shibboleth.net
Fri Mar 25 13:39:34 EDT 2016


Author: scantor
Date: Fri Mar 25 13:39:33 2016
New Revision: 8179

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=8179&view=rev
Log:
Relax some constraints on population of resolution context.

Modified:
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java

Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java?rev=8179&r1=8178&r2=8179&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java	(original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/ResolveAttributes.java	Fri Mar 25 13:39:33 2016
@@ -75,12 +75,12 @@
     @Nullable private Function<ProfileRequestContext,String> recipientLookupStrategy;
     
     /** Strategy used to locate the principal name associated with the attribute resolution. */
-    @Nonnull private Function<ProfileRequestContext,String> principalNameLookupStrategy;
+    @Nullable private Function<ProfileRequestContext,String> principalNameLookupStrategy;
 
     /**
      * Strategy used to locate an {@link AuthenticationContext} associated with a given {@link ProfileRequestContext}.
      */
-    @Nonnull private Function<ProfileRequestContext,AuthenticationContext> authnContextLookupStrategy;
+    @Nullable private Function<ProfileRequestContext,AuthenticationContext> authnContextLookupStrategy;
 
     /** Strategy used to locate or create the {@link AttributeContext} to populate. */
     @Nonnull private Function<ProfileRequestContext,AttributeContext> attributeContextCreationStrategy;
@@ -147,10 +147,10 @@
      * 
      * @param strategy lookup strategy
      */
-    public void setPrincipalNameLookupStrategy(@Nonnull final Function<ProfileRequestContext,String> strategy) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-
-        principalNameLookupStrategy = Constraint.isNotNull(strategy, "Principal name lookup strategy cannot be null");
+    public void setPrincipalNameLookupStrategy(@Nullable final Function<ProfileRequestContext,String> strategy) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+        principalNameLookupStrategy = strategy;
     }
 
     /**
@@ -161,11 +161,10 @@
      *            {@link ProfileRequestContext}
      */
     public void setAuthenticationContextLookupStrategy(
-            @Nonnull final Function<ProfileRequestContext,AuthenticationContext> strategy) {
-        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-
-        authnContextLookupStrategy =
-                Constraint.isNotNull(strategy, "AuthenticationContext lookup strategy cannot be null");
+            @Nullable final Function<ProfileRequestContext,AuthenticationContext> strategy) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+        authnContextLookupStrategy = strategy;
     }
     
     /**
@@ -214,7 +213,10 @@
             return false;
         }
         
-        authenticationContext = authnContextLookupStrategy.apply(profileRequestContext);
+        if (authnContextLookupStrategy != null) {
+            authenticationContext = authnContextLookupStrategy.apply(profileRequestContext);
+        }
+        
         if (authenticationContext == null) {
             log.debug("{} No authentication context available.", getLogPrefix());
         }
@@ -280,7 +282,11 @@
             resolutionContext.setRequestedIdPAttributeNames(attributesToResolve);
         }
         
-        resolutionContext.setPrincipal(principalNameLookupStrategy.apply(profileRequestContext));
+        if (null != principalNameLookupStrategy) {
+            resolutionContext.setPrincipal(principalNameLookupStrategy.apply(profileRequestContext));
+        } else {
+            resolutionContext.setPrincipal(null);
+        }
         
         resolutionContext.setPrincipalAuthenticationMethod(null);
         if (null != authenticationContext) {



More information about the commits mailing list