[java-identity-provider COMMIT] in /trunk/idp-consent/src: main/java/net/shibboleth/idp/consent/logic/HashFunction.ja...
noreply at shibboleth.net
noreply at shibboleth.net
Thu Nov 20 14:42:42 EST 2014
Author: tzeller
Date: Thu Nov 20 14:42:42 2014
New Revision: 6970
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=6970&view=rev
Log:
Checkpoint consent cleanup and tests.
Added:
trunk/idp-consent/src/test/java/net/shibboleth/idp/consent/logic/FlowIdLookupFunctionTest.java (with props)
trunk/idp-consent/src/test/java/net/shibboleth/idp/consent/logic/GlobalAttributeConsentPredicateTest.java (with props)
trunk/idp-consent/src/test/java/net/shibboleth/idp/consent/logic/HashFunctionTest.java (with props)
trunk/idp-consent/src/test/java/net/shibboleth/idp/consent/logic/IsConsentRequiredPredicateTest.java (with props)
Modified:
trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/HashFunction.java
trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/IsConsentRequiredPredicate.java
Modified: trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/HashFunction.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/HashFunction.java?rev=6970&r1=6969&r2=6970&view=diff
==============================================================================
--- trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/HashFunction.java (original)
+++ trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/HashFunction.java Thu Nov 20 14:42:42 2014
@@ -27,6 +27,10 @@
/**
* Function whose output value is a hash of the input value.
+ *
+ * Returns <code>null</code> for a <code>null</code> input.
+ *
+ * The hash returned is the Base64 encoded representation of the SHA-256 digest.
*/
public class HashFunction implements Function<String, String> {
Modified: trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/IsConsentRequiredPredicate.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/IsConsentRequiredPredicate.java?rev=6970&r1=6969&r2=6970&view=diff
==============================================================================
--- trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/IsConsentRequiredPredicate.java (original)
+++ trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/IsConsentRequiredPredicate.java Thu Nov 20 14:42:42 2014
@@ -40,11 +40,10 @@
* Predicate that returns whether consent is required by comparing the previous and current consents from the consent
* context.
*/
-// TODO tests
public class IsConsentRequiredPredicate implements Predicate<ProfileRequestContext> {
/** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(IsConsentRequiredPredicate.class);
+ @Nonnull private final Logger log = LoggerFactory.getLogger(IsConsentRequiredPredicateTest.class);
/** Consent context lookup strategy. */
@Nonnull private Function<ProfileRequestContext, ConsentContext> consentContextLookupStrategy;
@@ -81,8 +80,7 @@
}
/** {@inheritDoc} */
- @Override
- @Nullable public boolean apply(@Nullable final ProfileRequestContext input) {
+ @Override @Nullable public boolean apply(@Nullable final ProfileRequestContext input) {
if (input == null) {
log.debug("Consent is not required, no profile request context");
return false;
@@ -107,6 +105,11 @@
}
final Map<String, Consent> currentConsents = consentContext.getCurrentConsents();
+ if (currentConsents.isEmpty()) {
+ log.debug("Consent is not required, there are no current consents");
+ return false;
+ }
+
for (final Consent currentConsent : currentConsents.values()) {
final Consent previousConsent = previousConsents.get(currentConsent.getId());
if (previousConsent == null) {
@@ -121,7 +124,7 @@
}
}
- log.debug("Consent is not required, previous consents match");
+ log.debug("Consent is not required, previous consents match current consents");
return false;
}
More information about the commits
mailing list