[java-identity-provider COMMIT] in /trunk: idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPa...

noreply at shibboleth.net noreply at shibboleth.net
Sat Mar 15 16:06:28 EDT 2014


Author: scantor
Date: Sat Mar 15 16:06:28 2014
New Revision: 5582

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5582&view=rev
Log:
Implement anonymity signaling on RP context and predicate to check it.

Added:
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/logic/
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/logic/AbstractRelyingPartyPredicate.java   (with props)
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/logic/package-info.java   (with props)
Modified:
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/logic/AnonymousProfilePredicate.java
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/logic/RelyingPartyIdPredicate.java

Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java?rev=5582&r1=5581&r2=5582&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java (original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/context/RelyingPartyContext.java Sat Mar 15 16:06:28 2014
@@ -34,12 +34,18 @@
  */
 public final class RelyingPartyContext extends BaseContext {
 
+    /** Optional flag indicating anonymity. */
+    @Nullable private Boolean anonymous; 
+    
     /** The identifier for the relying party. */
     @Nullable private String relyingPartyId;
 
     /** A pointer to a context tree containing identifying material for the relying party. */
     @Nullable private BaseContext relyingPartyIdContextTree;
-    
+
+    /** A lookup strategy for deriving anonymity based on contained information. */
+    @Nullable private ContextDataLookupFunction<RelyingPartyContext,Boolean> anonymityLookupStrategy;
+
     /** A lookup strategy for deriving a relying party ID based on contained information. */
     @Nullable private ContextDataLookupFunction<RelyingPartyContext,String> relyingPartyIdLookupStrategy;
     
@@ -48,6 +54,35 @@
 
     /** Profile configuration that is in use. */
     @Nullable private ProfileConfiguration profileConfiguration;
+    
+    /**
+     * Get whether the relying party is securely identified.
+     * 
+     * @return  true iff the relying party's identity was not securely established
+     */
+    public boolean isAnonymous() {
+        if (anonymous != null) {
+            return anonymous;
+        } else if (anonymityLookupStrategy != null) {
+            final Boolean flag = anonymityLookupStrategy.apply(this);
+            if (flag != null) {
+                return flag;
+            }
+        }
+        return true;
+    }
+    
+    /**
+     * Set whether the relying party is securely identified.
+     * 
+     * @param flag  explicit value for the anonymity setting
+     * 
+     * @return this context
+     */
+    @Nonnull public RelyingPartyContext setAnonymous(@Nullable final Boolean flag) {
+        anonymous = flag;
+        return this;
+    }
 
     /**
      * Get the unique identifier of the relying party.
@@ -70,9 +105,12 @@
      * Set the unique identifier of the relying party.
      * 
      * @param rpId the relying party identifier, or null
-     */
-    public void setRelyingPartyId(@Nullable final String rpId) {
+     * 
+     * @return this context
+     */
+    @Nonnull public RelyingPartyContext setRelyingPartyId(@Nullable final String rpId) {
         relyingPartyId = StringSupport.trimOrNull(rpId);
+        return this;
     }
 
     /**
@@ -92,9 +130,34 @@
      * <p>The subtree root may, but need not, be an actual subcontext of this context.</p>
      * 
      * @param root  root of context tree
-     */
-    public void setRelyingPartyIdContextTree(@Nullable final BaseContext root) {
+     * 
+     * @return this context
+     */
+    @Nonnull public RelyingPartyContext setRelyingPartyIdContextTree(@Nullable final BaseContext root) {
         relyingPartyIdContextTree = root;
+        return this;
+    }
+    
+    /**
+     * Get the lookup strategy for a non-explicit anonymity determination.
+     * 
+     * @return lookup strategy
+     */
+    @Nullable ContextDataLookupFunction<RelyingPartyContext,Boolean> getAnonymityLookupStrategy() {
+        return anonymityLookupStrategy;
+    }
+    
+    /**
+     * Set the lookup strategy for a non-explicit anonymity determination.
+     * 
+     * @param strategy  lookup strategy
+     * 
+     * @return this context
+     */
+    @Nonnull public RelyingPartyContext setAnonymityLookupStrategy(
+            @Nonnull final ContextDataLookupFunction<RelyingPartyContext,Boolean> strategy) {
+        anonymityLookupStrategy = Constraint.isNotNull(strategy, "Lookup strategy cannot be null");
+        return this;
     }
     
     /**

[... 161 lines stripped ...]


More information about the commits mailing list