[java-identity-provider] 01/01: IDP-1817 Deprecate old Display methods in IdPAttribute
Rod Widdowson
rdw at steadingsoftware.com
Wed May 5 16:10:57 UTC 2021
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch dev/IDP-1811
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=23dcb60bf3924318f128887383d900c04360b0ff
commit 23dcb60bf3924318f128887383d900c04360b0ff
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed May 5 16:39:50 2021 +0100
IDP-1817 Deprecate old Display methods in IdPAttribute
https://issues.shibboleth.net/jira/browse/IDP-1817
Also deprecate a few up stream methods in the attribute resolver.
---
.../java/net/shibboleth/idp/attribute/IdPAttribute.java | 12 ++++++++++--
.../attribute/resolver/AbstractAttributeDefinition.java | 1 +
.../idp/attribute/resolver/AbstractResolverPlugin.java | 2 ++
.../attribute/resolver/impl/AttributeResolverImpl.java | 1 +
.../AttributeDisplayNameDescriptionFunctionTest.java | 17 ++++++++---------
5 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
index 4eaaf6aee..7fd8293c8 100644
--- a/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
+++ b/idp-attribute-api/src/main/java/net/shibboleth/idp/attribute/IdPAttribute.java
@@ -74,7 +74,7 @@ public class IdPAttribute implements Comparable<IdPAttribute>, Cloneable {
return new Entry<>() {
private String val = Constraint.isNotNull(StringSupport.trimOrNull(t.getValue()),
"Values must not be null");
- private Locale key = Constraint.isNotNull(t.getKey(), "Key must not be null");
+ private Locale key = Constraint.isNotNull(t.getKey(), "Locale must not be null");
public Locale getKey() {
return key;
}
@@ -156,10 +156,12 @@ public class IdPAttribute implements Comparable<IdPAttribute>, Cloneable {
/**
* Gets the localized human readable name of the attribute.
+ * @deprecated These values should be calculated at point of use
*
* @return human readable name of the attribute
*/
- @Nonnull @NonnullElements @Unmodifiable public Map<Locale, String> getDisplayNames() {
+ @Deprecated(forRemoval = true, since = "4.2") @Nonnull @NonnullElements @Unmodifiable
+ public Map<Locale, String> getDisplayNames() {
return displayNames;
}
@@ -183,9 +185,11 @@ public class IdPAttribute implements Comparable<IdPAttribute>, Cloneable {
/**
* Replaces the existing display names for this attribute with the given ones.
+ * @deprecated These values should be calculated at point of use
*
* @param newNames the new names for this attribute
*/
+ @Deprecated(forRemoval = true, since = "4.2")
public void setDisplayNames(@Nonnull @NonnullElements final Map<Locale, String> newNames) {
displayNames = checkedNamesFrom(
Constraint.isNotNull(newNames, "Display Names should not be null"));
@@ -193,18 +197,22 @@ public class IdPAttribute implements Comparable<IdPAttribute>, Cloneable {
/**
* Gets the localized human readable description of attribute.
+ * @deprecated These values should be calculated at point of use
*
* @return human readable description of attribute
*/
+ @Deprecated(forRemoval = true, since = "4.2")
@Nonnull @NonnullElements @Unmodifiable public Map<Locale, String> getDisplayDescriptions() {
return displayDescriptions;
}
/**
* Replaces the existing display descriptions for this attribute with the given ones.
+ * @deprecated These values should be calculated at point of use
*
* @param newDescriptions the new descriptions for this attribute
*/
+ @Deprecated(forRemoval = true, since = "4.2")
public void setDisplayDescriptions(@Nonnull @NonnullElements final Map<Locale, String> newDescriptions) {
displayDescriptions = checkedNamesFrom(
Constraint.isNotNull(newDescriptions, "Display Descriptions should not be null"));
diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
index 53c03833c..15578d234 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
@@ -122,6 +122,7 @@ public abstract class AbstractAttributeDefinition extends AbstractResolverPlugin
* Afterwards, if null was not returned, this method will attach the registered display names, descriptions,
* and encoders to the resultant attribute.
*/
+ @SuppressWarnings("removal")
@Override
@Nullable protected IdPAttribute doResolve(@Nonnull final AttributeResolutionContext resolutionContext,
@Nonnull final AttributeResolverWorkContext workContext) throws ResolutionException {
diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java
index 8f5571f1a..05e61d4b4 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java
@@ -284,11 +284,13 @@ public abstract class AbstractResolverPlugin<ResolvedType> extends AbstractIdent
/** Look at the resolution context for an attribute registry and use it to garnish the
* attribute.
+ * @deprecated These values should be calculated at point of use
*
* Controllable via the {@link AbstractResolverPlugin#isSuppressDisplayInformation()} method.
* @param resolutionContext where to get the registry from
* @param attribute what to garnish
*/
+ @Deprecated(since = "4.2", forRemoval = true)
public void addDisplayInformation(@Nonnull final AttributeResolutionContext resolutionContext,
@Nonnull final IdPAttribute attribute) {
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java
index 50b2fb841..5a41b9bbb 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java
@@ -562,6 +562,7 @@ public class AttributeResolverImpl extends AbstractServiceableComponent<Attribut
* @param workContext context to extract attributes from
*/
// CheckStyle: CyclomaticComplexity OFF
+ @SuppressWarnings("removal")
private void collectExportingDataConnectors(final Map<String, IdPAttribute> resolvedAttributes,
final AttributeResolutionContext resolutionContext,
final AttributeResolverWorkContext workContext) {
diff --git a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameDescriptionFunctionTest.java b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameDescriptionFunctionTest.java
index db5dc86ed..ad53f7913 100644
--- a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameDescriptionFunctionTest.java
+++ b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributeDisplayNameDescriptionFunctionTest.java
@@ -50,22 +50,21 @@ public class AttributeDisplayNameDescriptionFunctionTest {
private MockService service = new MockService();
+ private final Map<Locale, String> names = new HashMap<>(3);
+
+ private final Map<Locale, String> descriptions = new HashMap<>(3);
+
@BeforeClass public void constructAttribute() {
final IdPAttribute attr = new IdPAttribute("What");
- final Map<Locale, String> names = new HashMap<>(3);
names.put(new Locale("en"), "EN locale Name");
names.put(new Locale("fr"), "FR locale Name");
names.put(new Locale("de"), "DE locale Name");
- final Map<Locale, String> descriptions = new HashMap<>(3);
descriptions.put(new Locale("en"), "EN locale Description");
descriptions.put(new Locale("fr"), "FR locale Description");
descriptions.put(new Locale("de"), "DE locale Description");
-
- attr.setDisplayNames(names);
- attr.setDisplayDescriptions(descriptions);
-
+
testAttribute = attr;
}
@@ -131,7 +130,7 @@ public class AttributeDisplayNameDescriptionFunctionTest {
Assert.assertEquals(descFunc.apply(testAttribute), "FR locale Description");
}
- private final static class MockService implements
+ private final class MockService implements
ReloadableService<AttributeTranscoderRegistry>,
ServiceableComponent<AttributeTranscoderRegistry>,
AttributeTranscoderRegistry
@@ -177,12 +176,12 @@ public class AttributeDisplayNameDescriptionFunctionTest {
/** {@inheritDoc} */
public Map<Locale, String> getDisplayNames(IdPAttribute attribute) {
- return attribute.getDisplayNames();
+ return names;
}
/** {@inheritDoc} */
public Map<Locale, String> getDescriptions(IdPAttribute attribute) {
- return attribute.getDisplayDescriptions();
+ return descriptions;
}
/** {@inheritDoc} */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list