[java-identity-provider COMMIT] in /trunk: idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans...

noreply at shibboleth.net noreply at shibboleth.net
Thu Nov 20 23:31:36 EST 2014


Author: tzeller
Date: Thu Nov 20 23:31:35 2014
New Revision: 6980

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6980&view=rev
Log:
Move function to logic package and its test.

Added:
    trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/AttributeReleaseConsentFunction.java
      - copied, changed from r6967, trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/flow/ar/AttributeReleaseConsentFunction.java
    trunk/idp-consent/src/test/java/net/shibboleth/idp/consent/logic/AttributeReleaseConsentFunctionTest.java   (with props)
Modified:
    trunk/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml
    trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/flow/ar/AttributeReleaseConsentFunction.java

Modified: trunk/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml?rev=6980&r1=6979&r2=6980&view=diff
==============================================================================
--- trunk/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml (original)
+++ trunk/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml Thu Nov 20 23:31:35 2014
@@ -17,7 +17,7 @@
     <import resource="../../../conf/intercept/consent-intercept-config.xml" />
 
     <bean id="AttributeReleaseConsentFunction"
-        class="net.shibboleth.idp.consent.flow.ar.AttributeReleaseConsentFunction" scope="prototype" />
+        class="net.shibboleth.idp.consent.logic.AttributeReleaseConsentFunction" scope="prototype" />
 
     <bean id="AttributeConsentFlowDescriptorLookupStrategy"
         class="net.shibboleth.idp.consent.logic.FlowDescriptorLookupFunction"

Copied: trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/AttributeReleaseConsentFunction.java (from r6967, trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/flow/ar/AttributeReleaseConsentFunction.java)
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/AttributeReleaseConsentFunction.java?p2=trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/AttributeReleaseConsentFunction.java&p1=trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/flow/ar/AttributeReleaseConsentFunction.java&r1=6967&r2=6980&rev=6980&view=diff
==============================================================================
--- trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/flow/ar/AttributeReleaseConsentFunction.java (original)
+++ trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/AttributeReleaseConsentFunction.java Thu Nov 20 23:31:35 2014
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package net.shibboleth.idp.consent.flow.ar;
+package net.shibboleth.idp.consent.logic;
 
 import java.util.Collection;
 import java.util.LinkedHashMap;
@@ -31,8 +31,6 @@
 import net.shibboleth.idp.consent.context.AttributeReleaseContext;
 import net.shibboleth.idp.consent.context.ConsentContext;
 import net.shibboleth.idp.consent.flow.ConsentFlowDescriptor;
-import net.shibboleth.idp.consent.logic.AttributeValuesHashFunction;
-import net.shibboleth.idp.consent.logic.FlowDescriptorLookupFunction;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
@@ -43,7 +41,8 @@
 /**
  * Function that returns a map of consent objects representing consent to attribute release. Each consent object
  * represents consent to an attribute. The id of each consent object is an attribute id, and the value of each consent
- * object is a hash of the attribute's values.
+ * object is a hash of the attribute's values. A consent object is created for every consentable attribute in the
+ * attribute release context.
  */
 public class AttributeReleaseConsentFunction implements Function<ProfileRequestContext, Map<String, Consent>> {
 
@@ -145,8 +144,14 @@
 
             // Remember previous choice.
             final Consent previousConsent = consentContext.getPreviousConsents().get(consent.getId());
-            if (previousConsent != null && Objects.equals(consent.getValue(), previousConsent.getValue())) {
-                consent.setApproved(previousConsent.isApproved());
+            if (previousConsent != null) {
+                if (consentFlowDescriptor.compareValues()) {
+                    if (Objects.equals(consent.getValue(), previousConsent.getValue())) {
+                        consent.setApproved(previousConsent.isApproved());
+                    }
+                } else {
+                    consent.setApproved(previousConsent.isApproved());
+                }
             }
 
             currentConsents.put(consent.getId(), consent);



More information about the commits mailing list