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

noreply at shibboleth.net noreply at shibboleth.net
Sat Jun 14 21:48:01 EDT 2014


Author: scantor
Date: Sat Jun 14 21:48:01 2014
New Revision: 6086

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6086&view=rev
Log:
IDP-366 - use lookup for attribute context

Modified:
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java
    trunk/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/impl/FilterAttributesTest.java

Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java?rev=6086&r1=6085&r2=6086&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/FilterAttributes.java Sat Jun 14 21:48:01 2014
@@ -71,27 +71,30 @@
     /**
      * Strategy used to locate the {@link RelyingPartyContext} associated with a given {@link ProfileRequestContext}.
      */
-    @Nonnull private Function<ProfileRequestContext, RelyingPartyContext> relyingPartyContextLookupStrategy;
-
+    @Nonnull private Function<ProfileRequestContext,RelyingPartyContext> relyingPartyContextLookupStrategy;
+
+    /** Strategy used to locate the {@link AttributeContext} to filter. */
+    @Nonnull private Function<ProfileRequestContext,AttributeContext> attributeContextLookupStrategy;
+    
     /**
      * Strategy used to locate the {@link SubjectContext} associated with a given {@link ProfileRequestContext}.
      */
-    @Nonnull private Function<ProfileRequestContext, SubjectContext> subjectContextLookupStrategy;
+    @Nonnull private Function<ProfileRequestContext,SubjectContext> subjectContextLookupStrategy;
 
     /**
      * Strategy used to locate the {@link AuthenticationContext} associated with a given {@link ProfileRequestContext}.
      */
-    @Nonnull private Function<ProfileRequestContext, AuthenticationContext> authnContextLookupStrategy;
+    @Nonnull private Function<ProfileRequestContext,AuthenticationContext> authnContextLookupStrategy;
 
     /**
      * Strategy used to locate the {@link SAMLMetadataContext} associated with a given {@link ProfileRequestContext}.
      */
-    @Nonnull private Function<ProfileRequestContext, SAMLMetadataContext> metadataContextLookupStrategy;
+    @Nonnull private Function<ProfileRequestContext,SAMLMetadataContext> metadataContextLookupStrategy;
     
     /**
      * Strategy used to locate the {@link SAMLMetadataContext} associated with a given {@link AttributeFilterContext}.
      */
-    @Nonnull private Function<AttributeFilterContext, SAMLMetadataContext> metadataFromFilterLookupStrategy;
+    @Nonnull private Function<AttributeFilterContext,SAMLMetadataContext> metadataFromFilterLookupStrategy;
 
     /** RelyingPartyContext to operate on. */
     @Nullable private RelyingPartyContext rpContext;
@@ -116,6 +119,8 @@
     public FilterAttributes(@Nonnull final ReloadableService<AttributeFilter> filterService) {
         attributeFilterService = Constraint.isNotNull(filterService, "Service cannot be null");
         relyingPartyContextLookupStrategy = new ChildContextLookup<>(RelyingPartyContext.class, false);
+        attributeContextLookupStrategy = Functions.compose(new ChildContextLookup<>(AttributeContext.class),
+                new ChildContextLookup<ProfileRequestContext,RelyingPartyContext>(RelyingPartyContext.class));
         subjectContextLookupStrategy = new ChildContextLookup<>(SubjectContext.class, false);
         authnContextLookupStrategy = new ChildContextLookup<>(AuthenticationContext.class, false);
         
@@ -143,7 +148,7 @@
      *            {@link ProfileRequestContext}
      */
     public void setRelyingPartyContextLookupStrategy(
-            @Nonnull final Function<ProfileRequestContext, RelyingPartyContext> strategy) {
+            @Nonnull final Function<ProfileRequestContext,RelyingPartyContext> strategy) {
         ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
 
         relyingPartyContextLookupStrategy =
@@ -151,13 +156,28 @@
     }
 
     /**
+     * Set the strategy used to locate the {@link AttributeContext} associated with a given
+     * {@link ProfileRequestContext}.
+     * 
+     * @param strategy strategy used to locate the {@link AttributeContext} associated with a given
+     *            {@link ProfileRequestContext}
+     */
+    public void setAttributeContextLookupStrategy(
+            @Nonnull final Function<ProfileRequestContext,AttributeContext> strategy) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+
+        attributeContextLookupStrategy =
+                Constraint.isNotNull(strategy, "AttributeContext lookup strategy cannot be null");
+    }
+    
+    /**
      * Set the strategy used to locate the {@link SubjectContext} associated with a given {@link ProfileRequestContext}.
      * 

[... 112 lines stripped ...]


More information about the commits mailing list