[java-identity-provider] 05/06: IDP-1121 Attribute Values are no longer generic. Stage 4
Rod Widdowson
rdw at steadingsoftware.com
Fri May 17 09:10:03 EDT 2019
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=dc856451c37218e96312a9620e334178e286a5b8
commit dc856451c37218e96312a9620e334178e286a5b8
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Fri May 17 13:39:09 2019 +0100
IDP-1121 Attribute Values are no longer generic. Stage 4
https://issues.shibboleth.net/jira/browse/IDP-1121
IdpAttributeValue looses the getValue() method which must now
be implemented by the parents, and gains getNativeValue() for
the template case and a few outliers
---
.../idp/attribute/ByteAttributeValue.java | 10 +++++++++-
.../idp/attribute/EmptyAttributeValue.java | 10 +++++++++-
.../shibboleth/idp/attribute/IdPAttributeValue.java | 10 +++++++---
.../idp/attribute/ScopedStringAttributeValue.java | 7 +++++++
.../idp/attribute/StringAttributeValue.java | 8 ++++++++
.../idp/attribute/XMLObjectAttributeValue.java | 8 ++++++++
.../matcher/impl/AttributeValueRegexpMatcher.java | 2 +-
.../matcher/impl/AttributeValueStringMatcher.java | 4 ++--
.../attribute/filter/matcher/impl/DataSources.java | 2 +-
.../attribute/transcoding/impl/PairTranscoder.java | 2 +-
.../resolver/dc/http/impl/TemplatedBodyBuilder.java | 8 ++------
.../resolver/dc/http/impl/TemplatedURLBuilder.java | 2 +-
.../ParameterizedExecutableSearchFilterBuilder.java | 4 ++--
.../TemplatedExecutableSearchFilterBuilder.java | 2 +-
.../impl/FormatExecutableStatementBuilder.java | 6 +++---
.../impl/TemplatedExecutableStatementBuilder.java | 2 +-
.../impl/PrepareTicketValidationResponseAction.java | 2 +-
.../CASScopedStringAttributeTranscoderTest.java | 2 +-
.../impl/CASStringAttributeTranscoderTest.java | 2 +-
.../logic/impl/AttributeValuesHashFunction.java | 21 +++++++++++----------
.../impl/AbstractPersistentIdDataConnector.java | 4 ++--
.../impl/SAML1ByteAttributeTranscoderTest.java | 2 +-
.../SAML1ScopedStringAttributeTranscoderTest.java | 2 +-
.../impl/SAML1StringAttributeTranscoderTest.java | 2 +-
.../impl/SAML2ByteAttributeTranscoderTest.java | 2 +-
.../SAML2ScopedStringAttributeTranscoderTest.java | 2 +-
.../impl/SAML2StringAttributeTranscoderTest.java | 2 +-
.../impl/SAML2XMLObjectAttributeTranscoderTest.java | 2 +-
...buteSourcedSAML1NameIdentifierGeneratorTest.java | 2 +-
.../AttributeSourcedSAML2NameIDGeneratorTest.java | 2 +-
30 files changed, 88 insertions(+), 48 deletions(-)
diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java
index b267b97..32d975a 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ByteAttributeValue.java
@@ -46,8 +46,16 @@ public class ByteAttributeValue implements IdPAttributeValue {
value = Constraint.isNotEmpty(attributeValue, "Attribute value cannot be null or empty");
}
+ /** Return the value.
+ * @return the value
+ */
+ public byte[] getValue() {
+ return value;
+ }
+
/** {@inheritDoc} */
- public final byte[] getValue() {
+ @Override
+ public Object getNativeValue() {
return value;
}
diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/EmptyAttributeValue.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/EmptyAttributeValue.java
index 4de863c..14125db 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/EmptyAttributeValue.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/EmptyAttributeValue.java
@@ -62,7 +62,15 @@ public class EmptyAttributeValue implements IdPAttributeValue {
}
/** {@inheritDoc} */
- @Nonnull public EmptyType getValue() {
+ @Override
+ public Object getNativeValue() {
+ return value;
+ }
+
+ /** Return the value.
+ * @return the value
+ */
+ public EmptyType getValue() {
return value;
}
diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttributeValue.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttributeValue.java
index 0339f74..5d0bdac 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttributeValue.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttributeValue.java
@@ -28,16 +28,20 @@ import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
* Implementations of this interface <strong>MUST</strong> implement an appropriate {@link Object#equals(Object)} and
* {@link Object#hashCode()} method. They should also implement {@link Object#toString()} such that useful
* representations may be written out in log messages.
+ * <p>
+ * Implementations are expected to implement a natively typed getValue() method. This will usually be like the
+ * {@link #getNativeValue()} the outlier being the {@link ScopedStringAttributeValue} which for legacy reasons returns
+ * only the head part of the value for getValue().
* </p>
*/
public interface IdPAttributeValue {
/**
- * Get the value of this attribute.
+ * Get the native representation of the value of this attribute.
*
- * @return the attribute value
+ * @return the attribute value in native format.
*/
- @Nonnull Object getValue();
+ @Nonnull Object getNativeValue();
/**
* Get a displayable form of the value for user interfaces and similar purposes.
diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ScopedStringAttributeValue.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ScopedStringAttributeValue.java
index cfb3be9..6ca9d56 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ScopedStringAttributeValue.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/ScopedStringAttributeValue.java
@@ -23,6 +23,7 @@ import javax.annotation.concurrent.ThreadSafe;
import net.shibboleth.utilities.java.support.annotation.ParameterName;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.collection.Pair;
import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
@@ -49,6 +50,12 @@ public class ScopedStringAttributeValue extends StringAttributeValue {
scope = Constraint.isNotNull(StringSupport.trimOrNull(valueScope), "Scope cannot be null or empty");
}
+ /** {@inheritDoc} */
+ @Override
+ public Object getNativeValue() {
+ return new Pair<String, String>(getValue(), scope);
+ }
+
/**
* Get the scope of the value.
*
diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/StringAttributeValue.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/StringAttributeValue.java
index 44e75f7..94fc655 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/StringAttributeValue.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/StringAttributeValue.java
@@ -44,6 +44,14 @@ public class StringAttributeValue implements IdPAttributeValue {
}
/** {@inheritDoc} */
+ @Override
+ public Object getNativeValue() {
+ return value;
+ }
+
+ /** Return the value.
+ * @return the value
+ */
@Nonnull @NotEmpty public final String getValue() {
return value;
}
diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/XMLObjectAttributeValue.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/XMLObjectAttributeValue.java
index c790dd0..5360e39 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/XMLObjectAttributeValue.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/XMLObjectAttributeValue.java
@@ -45,6 +45,14 @@ public class XMLObjectAttributeValue implements IdPAttributeValue {
}
/** {@inheritDoc} */
+ @Override
+ public Object getNativeValue() {
+ return value;
+ }
+
+ /** Return the value.
+ * @return the value
+ */
public final XMLObject getValue() {
return value;
}
diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueRegexpMatcher.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueRegexpMatcher.java
index ac97fa3..5ea81b1 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueRegexpMatcher.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueRegexpMatcher.java
@@ -47,7 +47,7 @@ public class AttributeValueRegexpMatcher extends AbstractRegexpStringMatcher {
return regexpCompare(((StringAttributeValue) value).getValue());
} else {
- final String valueAsString = value.getValue().toString();
+ final String valueAsString = value.getNativeValue().toString();
log.warn("{} Object supplied to StringAttributeValue comparison"
+ " was of class {}, not StringAttributeValue, comparing with {}", new Object[] {
getLogPrefix(), value.getClass().getName(), valueAsString,});
diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueStringMatcher.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueStringMatcher.java
index f7ec0c2..8e556de 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueStringMatcher.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AttributeValueStringMatcher.java
@@ -49,13 +49,13 @@ public class AttributeValueStringMatcher extends AbstractStringMatcher {
case ZERO_LENGTH_VALUE:
return super.stringCompare("");
default:
- throw new IllegalArgumentException("Unknown empty attribute value type " + value.getValue());
+ throw new IllegalArgumentException("Unknown empty attribute value type " + value.getNativeValue());
}
} else if (value instanceof StringAttributeValue) {
return super.stringCompare(((StringAttributeValue) value).getValue());
} else {
- final String valueAsString = value.getValue().toString();
+ final String valueAsString = value.getNativeValue().toString();
log.warn("{} Object supplied to StringAttributeValue comparison"
+ " was of class {}, not StringAttributeValue, comparing with {}", new Object[] {getLogPrefix(),
value.getClass().getName(), valueAsString,});
diff --git a/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/DataSources.java b/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/DataSources.java
index 58d25e3..166f91b 100644
--- a/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/DataSources.java
+++ b/idp-attribute-filter-impl/src/test/java/net/shibboleth/idp/attribute/filter/matcher/impl/DataSources.java
@@ -58,7 +58,7 @@ public abstract class DataSources {
public final static IdPAttributeValue OTHER_VALUE = new IdPAttributeValue() {
- @Override @Nonnull public Object getValue() {
+ @Override @Nonnull public Object getNativeValue() {
return TEST_STRING;
}
public String getDisplayValue() {
diff --git a/idp-attribute-impl/src/test/java/net/shibboleth/idp/attribute/transcoding/impl/PairTranscoder.java b/idp-attribute-impl/src/test/java/net/shibboleth/idp/attribute/transcoding/impl/PairTranscoder.java
index abe4e10..e7b0f3a 100644
--- a/idp-attribute-impl/src/test/java/net/shibboleth/idp/attribute/transcoding/impl/PairTranscoder.java
+++ b/idp-attribute-impl/src/test/java/net/shibboleth/idp/attribute/transcoding/impl/PairTranscoder.java
@@ -67,7 +67,7 @@ public class PairTranscoder extends AbstractAttributeTranscoder<Pair> {
if (attribute.getValues().isEmpty() || !canEncodeValue(attribute, attribute.getValues().get(0))) {
return to.getDeclaredConstructor(Object.class, Object.class).newInstance(name, null);
} else {
- return to.getDeclaredConstructor(Object.class, Object.class).newInstance(name, attribute.getValues().get(0).getValue());
+ return to.getDeclaredConstructor(Object.class, Object.class).newInstance(name, attribute.getValues().get(0).getNativeValue());
}
} catch (final InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedBodyBuilder.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedBodyBuilder.java
index 742774b..d20cc00 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedBodyBuilder.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedBodyBuilder.java
@@ -349,11 +349,7 @@ public class TemplatedBodyBuilder extends AbstractHTTPSearchBuilder {
for (final Map.Entry<String, List<IdPAttributeValue>> entry : dependencyAttributes.entrySet()) {
final List<Object> values = new ArrayList<>(entry.getValue().size());
for (final IdPAttributeValue value : entry.getValue()) {
- if (value instanceof String) {
- String new_name = (String) value;
-
- }
- values.add(value.getValue());
+ values.add(value.getNativeValue());
}
log.trace("Adding dependency {} to context with {} value(s)", entry.getKey(), values.size());
context.put(entry.getKey(), values);
@@ -410,7 +406,7 @@ public class TemplatedBodyBuilder extends AbstractHTTPSearchBuilder {
for (final Map.Entry<String, List<IdPAttributeValue>> entry : dependencyAttributes.entrySet()) {
final List<Object> values = new ArrayList<>(entry.getValue().size());
for (final IdPAttributeValue value : entry.getValue()) {
- values.add(value.getValue());
+ values.add(value.getNativeValue());
}
log.trace("Adding dependency {} to context with {} value(s)", entry.getKey(), values.size());
context.put(entry.getKey(), values);
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedURLBuilder.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedURLBuilder.java
index 65bed22..f6f4547 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedURLBuilder.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/http/impl/TemplatedURLBuilder.java
@@ -194,7 +194,7 @@ public class TemplatedURLBuilder extends AbstractHTTPSearchBuilder {
for (final Map.Entry<String, List<IdPAttributeValue>> entry : dependencyAttributes.entrySet()) {
final List<Object> values = new ArrayList<>(entry.getValue().size());
for (final IdPAttributeValue value : entry.getValue()) {
- values.add(value.getValue());
+ values.add(value.getNativeValue());
}
log.trace("Adding dependency {} to context with {} value(s)", entry.getKey(), values.size());
context.put(entry.getKey(), values);
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/ParameterizedExecutableSearchFilterBuilder.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/ParameterizedExecutableSearchFilterBuilder.java
index 550a28a..8029e92 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/ParameterizedExecutableSearchFilterBuilder.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/ParameterizedExecutableSearchFilterBuilder.java
@@ -76,9 +76,9 @@ public class ParameterizedExecutableSearchFilterBuilder extends AbstractExecutab
int i = 0;
for (final IdPAttributeValue value : entry.getValue()) {
if (i == 0) {
- sf.setParameter(String.format("%s", entry.getKey(), i), value.getValue());
+ sf.setParameter(String.format("%s", entry.getKey(), i), value.getNativeValue());
}
- sf.setParameter(String.format("%s[%s]", entry.getKey(), i++), value.getValue());
+ sf.setParameter(String.format("%s[%s]", entry.getKey(), i++), value.getNativeValue());
}
}
}
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/TemplatedExecutableSearchFilterBuilder.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/TemplatedExecutableSearchFilterBuilder.java
index 1401a4f..65fc97a 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/TemplatedExecutableSearchFilterBuilder.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/TemplatedExecutableSearchFilterBuilder.java
@@ -176,7 +176,7 @@ public class TemplatedExecutableSearchFilterBuilder extends AbstractExecutableSe
for (final Map.Entry<String, List<IdPAttributeValue>> entry : dependencyAttributes.entrySet()) {
final List<Object> values = new ArrayList<>(entry.getValue().size());
for (final IdPAttributeValue value : entry.getValue()) {
- values.add(value.getValue());
+ values.add(value.getNativeValue());
}
log.trace("Adding dependency {} to context with {} value(s)", entry.getKey(), values.size());
context.put(entry.getKey(), values);
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/FormatExecutableStatementBuilder.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/FormatExecutableStatementBuilder.java
index 1482dd7..1c48552 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/FormatExecutableStatementBuilder.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/FormatExecutableStatementBuilder.java
@@ -64,10 +64,10 @@ public class FormatExecutableStatementBuilder extends AbstractExecutableStatemen
if (dependencyAttributes != null && !dependencyAttributes.isEmpty()) {
for (final Map.Entry<String, List<IdPAttributeValue>> entry : dependencyAttributes.entrySet()) {
for (final IdPAttributeValue value : entry.getValue()) {
- if (value.getValue() instanceof String){
- args.add(((String) value.getValue()).replace("'", "''"));
+ if (value.getNativeValue() instanceof String){
+ args.add(((String) value.getNativeValue()).replace("'", "''"));
} else {
- args.add(value.getValue());
+ args.add(value.getNativeValue());
}
}
}
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/TemplatedExecutableStatementBuilder.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/TemplatedExecutableStatementBuilder.java
index 75295bc..01a060d 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/TemplatedExecutableStatementBuilder.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/rdbms/impl/TemplatedExecutableStatementBuilder.java
@@ -190,7 +190,7 @@ public class TemplatedExecutableStatementBuilder extends AbstractExecutableState
for (final Map.Entry<String, List<IdPAttributeValue>> entry : dependencyAttributes.entrySet()) {
final List<Object> values = new ArrayList<>(entry.getValue().size());
for (final IdPAttributeValue value : entry.getValue()) {
- values.add(value.getValue());
+ values.add(value.getNativeValue());
}
log.trace("Adding dependency {} to context with {} value(s)", entry.getKey(), values.size());
context.put(entry.getKey(), values);
diff --git a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/PrepareTicketValidationResponseAction.java b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/PrepareTicketValidationResponseAction.java
index 337bd4f..387b096 100644
--- a/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/PrepareTicketValidationResponseAction.java
+++ b/idp-cas-impl/src/main/java/net/shibboleth/idp/cas/flow/impl/PrepareTicketValidationResponseAction.java
@@ -159,7 +159,7 @@ public class PrepareTicketValidationResponseAction extends
} else {
log.warn("Use of attribute value type {} from attribute {}",
value.getClass(), attribute.getId());
- principal = value.getValue().toString();
+ principal = value.getNativeValue().toString();
}
} else {
log.debug("Filtered attribute {} has no value", userAttributeName);
diff --git a/idp-cas-impl/src/test/java/net/shibboleth/idp/cas/attribute/transcoding/impl/CASScopedStringAttributeTranscoderTest.java b/idp-cas-impl/src/test/java/net/shibboleth/idp/cas/attribute/transcoding/impl/CASScopedStringAttributeTranscoderTest.java
index 57d00dd..5c58fa4 100644
--- a/idp-cas-impl/src/test/java/net/shibboleth/idp/cas/attribute/transcoding/impl/CASScopedStringAttributeTranscoderTest.java
+++ b/idp-cas-impl/src/test/java/net/shibboleth/idp/cas/attribute/transcoding/impl/CASScopedStringAttributeTranscoderTest.java
@@ -118,7 +118,7 @@ public class CASScopedStringAttributeTranscoderTest {
final Collection<IdPAttributeValue> values =
Arrays.asList(new ByteAttributeValue(new byte[] {1, 2, 3,}), new IdPAttributeValue() {
@Override
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
@Override
diff --git a/idp-cas-impl/src/test/java/net/shibboleth/idp/cas/attribute/transcoding/impl/CASStringAttributeTranscoderTest.java b/idp-cas-impl/src/test/java/net/shibboleth/idp/cas/attribute/transcoding/impl/CASStringAttributeTranscoderTest.java
index 63a1829..3ab3892 100644
--- a/idp-cas-impl/src/test/java/net/shibboleth/idp/cas/attribute/transcoding/impl/CASStringAttributeTranscoderTest.java
+++ b/idp-cas-impl/src/test/java/net/shibboleth/idp/cas/attribute/transcoding/impl/CASStringAttributeTranscoderTest.java
@@ -113,7 +113,7 @@ public class CASStringAttributeTranscoderTest {
final Collection<IdPAttributeValue> values =
Arrays.asList(new ByteAttributeValue(new byte[] {1, 2, 3,}), new IdPAttributeValue() {
@Override
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
@Override
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValuesHashFunction.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValuesHashFunction.java
index 6e75299..9e086d9 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValuesHashFunction.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributeValuesHashFunction.java
@@ -26,13 +26,6 @@ import java.util.function.Function;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import net.shibboleth.idp.attribute.IdPAttributeValue;
-import net.shibboleth.idp.attribute.ScopedStringAttributeValue;
-import net.shibboleth.idp.attribute.StringAttributeValue;
-import net.shibboleth.idp.attribute.XMLObjectAttributeValue;
-import net.shibboleth.utilities.java.support.annotation.constraint.NullableElements;
-import net.shibboleth.utilities.java.support.xml.SerializeSupport;
-
import org.cryptacular.util.CodecUtil;
import org.cryptacular.util.HashUtil;
import org.opensaml.core.xml.XMLObject;
@@ -45,6 +38,13 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.Predicates;
import com.google.common.collect.Collections2;
+import net.shibboleth.idp.attribute.IdPAttributeValue;
+import net.shibboleth.idp.attribute.ScopedStringAttributeValue;
+import net.shibboleth.idp.attribute.StringAttributeValue;
+import net.shibboleth.idp.attribute.XMLObjectAttributeValue;
+import net.shibboleth.utilities.java.support.annotation.constraint.NullableElements;
+import net.shibboleth.utilities.java.support.xml.SerializeSupport;
+
/**
* Function to calculate the hash of the values of an IdP attribute.
*
@@ -58,6 +58,7 @@ public class AttributeValuesHashFunction implements Function<Collection<IdPAttri
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(AttributeValuesHashFunction.class);
+ // CheckStyle: CyclomaticComplexity OFF
/** {@inheritDoc} */
@Nullable public String apply(@Nullable @NullableElements final Collection<IdPAttributeValue> input) {
@@ -95,8 +96,8 @@ public class AttributeValuesHashFunction implements Function<Collection<IdPAttri
} else if (value instanceof StringAttributeValue) {
objectOutputStream.writeObject(((StringAttributeValue)value).getValue());
- } else if (value.getValue() != null) {
- objectOutputStream.writeObject(value.getValue());
+ } else if (value.getNativeValue() != null) {
+ objectOutputStream.writeObject(value.getNativeValue());
}
}
@@ -111,5 +112,5 @@ public class AttributeValuesHashFunction implements Function<Collection<IdPAttri
return null;
}
}
-
+ // CheckStyle: CyclomaticComplexity ON
}
diff --git a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/resolver/impl/AbstractPersistentIdDataConnector.java b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/resolver/impl/AbstractPersistentIdDataConnector.java
index b5702db..391048e 100644
--- a/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/resolver/impl/AbstractPersistentIdDataConnector.java
+++ b/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/attribute/resolver/impl/AbstractPersistentIdDataConnector.java
@@ -181,12 +181,12 @@ public abstract class AbstractPersistentIdDataConnector extends AbstractDataConn
final String val;
if (attributeValue instanceof StringAttributeValue) {
- if (StringSupport.trimOrNull((String) attributeValue.getValue()) == null) {
+ val = ((StringAttributeValue) attributeValue).getValue();
+ if (StringSupport.trimOrNull(val) == null) {
log.warn("{} Source attribute {} for connector {} was all-whitespace", getLogPrefix(),
getSourceAttributeInformation(), getId());
return null;
}
- val = (String) attributeValue.getValue();
} else if (attributeValue instanceof EmptyAttributeValue) {
final EmptyAttributeValue emptyVal = (EmptyAttributeValue) attributeValue;
log.warn("{} Source attribute {} value for connector {} was an empty value of type {}", getLogPrefix(),
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1ByteAttributeTranscoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1ByteAttributeTranscoderTest.java
index b1c3e4b..852e78d 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1ByteAttributeTranscoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1ByteAttributeTranscoderTest.java
@@ -177,7 +177,7 @@ public class SAML1ByteAttributeTranscoderTest extends OpenSAMLInitBaseTestCase {
final Collection<IdPAttributeValue> values =
Arrays.asList(new StringAttributeValue("foo"), new ScopedStringAttributeValue("foo", "bar"),
new IdPAttributeValue() {
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
public String getDisplayValue() {
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1ScopedStringAttributeTranscoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1ScopedStringAttributeTranscoderTest.java
index 209926f..2fc70a2 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1ScopedStringAttributeTranscoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1ScopedStringAttributeTranscoderTest.java
@@ -170,7 +170,7 @@ public class SAML1ScopedStringAttributeTranscoderTest extends OpenSAMLInitBaseTe
final Collection<IdPAttributeValue> values =
Arrays.asList(new ByteAttributeValue(new byte[] {1, 2, 3,}), new IdPAttributeValue() {
@Override
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
@Override
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1StringAttributeTranscoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1StringAttributeTranscoderTest.java
index 8c3d572..ee194b1 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1StringAttributeTranscoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML1StringAttributeTranscoderTest.java
@@ -174,7 +174,7 @@ public class SAML1StringAttributeTranscoderTest extends OpenSAMLInitBaseTestCase
final Collection<IdPAttributeValue> values =
Arrays.asList(new ByteAttributeValue(new byte[] {1, 2, 3,}), new IdPAttributeValue() {
@Override
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
@Override
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2ByteAttributeTranscoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2ByteAttributeTranscoderTest.java
index 7493ab4..57afb3f 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2ByteAttributeTranscoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2ByteAttributeTranscoderTest.java
@@ -170,7 +170,7 @@ public class SAML2ByteAttributeTranscoderTest extends OpenSAMLInitBaseTestCase {
final Collection<IdPAttributeValue> values =
Arrays.asList(new StringAttributeValue("foo"), new ScopedStringAttributeValue("foo", "bar"),
new IdPAttributeValue() {
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
public String getDisplayValue() {
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2ScopedStringAttributeTranscoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2ScopedStringAttributeTranscoderTest.java
index 40be875..1dc66fb 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2ScopedStringAttributeTranscoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2ScopedStringAttributeTranscoderTest.java
@@ -172,7 +172,7 @@ public class SAML2ScopedStringAttributeTranscoderTest extends OpenSAMLInitBaseTe
final Collection<IdPAttributeValue> values =
Arrays.asList(new ByteAttributeValue(new byte[] {1, 2, 3,}), new IdPAttributeValue() {
@Override
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
@Override
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2StringAttributeTranscoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2StringAttributeTranscoderTest.java
index 4062799..15156bd 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2StringAttributeTranscoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2StringAttributeTranscoderTest.java
@@ -167,7 +167,7 @@ public class SAML2StringAttributeTranscoderTest extends OpenSAMLInitBaseTestCase
final Collection<IdPAttributeValue> values =
Arrays.asList(new ByteAttributeValue(new byte[] {1, 2, 3,}), new IdPAttributeValue() {
@Override
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
@Override
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2XMLObjectAttributeTranscoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2XMLObjectAttributeTranscoderTest.java
index 6f495e9..fca9ef2 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2XMLObjectAttributeTranscoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/attribute/transcoding/impl/SAML2XMLObjectAttributeTranscoderTest.java
@@ -174,7 +174,7 @@ public class SAML2XMLObjectAttributeTranscoderTest extends OpenSAMLInitBaseTestC
final Collection<IdPAttributeValue> values =
Arrays.asList(new ByteAttributeValue(new byte[] {1, 2, 3,}), new IdPAttributeValue() {
@Override
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
@Override
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGeneratorTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGeneratorTest.java
index 34e8b00..da5cb3d 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGeneratorTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML1NameIdentifierGeneratorTest.java
@@ -110,7 +110,7 @@ public class AttributeSourcedSAML1NameIdentifierGeneratorTest extends OpenSAMLIn
@Test public void testWrongType() throws Exception {
final int[] intArray = {1, 2, 3, 4};
final List<IdPAttributeValue> values = List.of(new IdPAttributeValue() {
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
public String getDisplayValue() {
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGeneratorTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGeneratorTest.java
index 381f4f1..7ffd23a 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGeneratorTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/nameid/impl/AttributeSourcedSAML2NameIDGeneratorTest.java
@@ -109,7 +109,7 @@ public class AttributeSourcedSAML2NameIDGeneratorTest extends OpenSAMLInitBaseTe
@Test public void testWrongType() throws Exception {
final int[] intArray = {1, 2, 3, 4};
final var values = List.of(new IdPAttributeValue() {
- public Object getValue() {
+ public Object getNativeValue() {
return intArray;
}
public String getDisplayValue() {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list