[java-shib-attribute] 02/03: IDP-1959 IdPAttributes to stop carrying Display Information
Rod Widdowson
rdw at steadingsoftware.com
Sun Jul 17 14:13:57 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-shib-attribute.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=ff4d43328738e378510813911dee80187b09711a
commit ff4d43328738e378510813911dee80187b09711a
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Jul 17 13:42:35 2022 +0100
IDP-1959 IdPAttributes to stop carrying Display Information
https://shibboleth.atlassian.net/browse/IDP-1959
Stop collecting DisplayInformation during the resolution
process.
---
.../resolver/AbstractAttributeDefinition.java | 4 --
.../attribute/resolver/AbstractResolverPlugin.java | 74 ----------------------
.../resolver/impl/AttributeResolverImpl.java | 36 -----------
3 files changed, 114 deletions(-)
diff --git a/shib-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java b/shib-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
index 59dfb7d4b..73365fdef 100644
--- a/shib-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
+++ b/shib-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinition.java
@@ -119,7 +119,6 @@ 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 {
@@ -137,9 +136,6 @@ public abstract class AbstractAttributeDefinition extends AbstractResolverPlugin
log.debug("{} produced an attribute with the following values {}", getLogPrefix(),
resolvedAttribute.getValues());
}
-
- addDisplayInformation(resolutionContext, resolvedAttribute);
-
return resolvedAttribute;
}
diff --git a/shib-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java b/shib-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java
index 16a75a0cf..834fa4170 100644
--- a/shib-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java
+++ b/shib-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AbstractResolverPlugin.java
@@ -34,19 +34,15 @@ import org.springframework.beans.factory.DisposableBean;
import com.google.common.base.Predicates;
-import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.resolver.context.AttributeResolutionContext;
import net.shibboleth.idp.attribute.resolver.context.AttributeResolverWorkContext;
-import net.shibboleth.idp.attribute.transcoding.AttributeTranscoderRegistry;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullAfterInit;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
import net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
-import net.shibboleth.utilities.java.support.service.ServiceableComponent;
/**
* Base class for all {@link ResolverPlugin}s.
@@ -63,9 +59,6 @@ public abstract class AbstractResolverPlugin<ResolvedType> extends AbstractIdent
/** Whether an {@link AttributeResolutionContext} that occurred resolving attributes will be re-thrown. */
private boolean propagateResolutionExceptions = true;
- /** Whether we add DisplayInformation to derived attributes. */
- private boolean suppressDisplayInformation;
-
/** Criterion that must be met for this plugin to be active for the given request. */
@Nullable private Predicate<ProfileRequestContext> activationCondition;
@@ -81,26 +74,6 @@ public abstract class AbstractResolverPlugin<ResolvedType> extends AbstractIdent
dataConnectorDependencies = Collections.emptySet();
}
- /** Does this plugin allow addition of Display Information?
- * @return whether we are suppressing
- * */
- public boolean isSuppressDisplayInformation() {
- return suppressDisplayInformation;
- }
-
- /**
- * Set whether we suppress addition of Display Information.
- * @deprecated Display Information should be consulted at point of use
-
- * @param what true if we suppress the addition.
- */
- @Deprecated(forRemoval = true, since = "4.2")
- public void setSuppressDisplayInformation(final boolean what) {
- ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
-
- suppressDisplayInformation = what;
- }
-
/** {@inheritDoc} */
public boolean isPropagateResolutionExceptions() {
return propagateResolutionExceptions;
@@ -249,53 +222,6 @@ 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) {
-
- if (isSuppressDisplayInformation()) {
- log.trace("{} no display information added", getLogPrefix());
- } else if (resolutionContext.getTranscoderRegistry() != null) {
- ServiceableComponent<AttributeTranscoderRegistry> component = null;
- try {
- component = resolutionContext.getTranscoderRegistry().getServiceableComponent();
- if (component != null) {
-
- if (attribute.getDisplayNames().isEmpty()) {
- attribute.setDisplayNames(
- component.getComponent().getDisplayNames(attribute));
- log.trace("{} associated display names with the resolved attribute: {}", getLogPrefix(),
- attribute.getDisplayNames());
- }
-
- if (attribute.getDisplayDescriptions().isEmpty()) {
- attribute.setDisplayDescriptions(
- component.getComponent().getDescriptions(attribute));
- log.trace("{} associated descriptions with the resolved attribute: {}", getLogPrefix(),
- attribute.getDisplayDescriptions());
- }
-
- } else {
- log.warn("No transcoder registry available, unable to attach displayName/description metadata");
- }
- } finally {
- if (component != null) {
- component.unpinComponent();
- }
- }
- } else {
- log.debug("No transcoder registry supplied, unable to attach displayName/description metadata");
- }
- }
-
/** {@inheritDoc} */
@Override protected void doDestroy() {
activationCondition = Predicates.alwaysFalse();
diff --git a/shib-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java b/shib-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java
index 5d600c096..0fcd4ff39 100644
--- a/shib-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java
+++ b/shib-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImpl.java
@@ -46,7 +46,6 @@ import net.shibboleth.idp.attribute.EmptyAttributeValue;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
import net.shibboleth.idp.attribute.context.AttributeContext;
-import net.shibboleth.idp.attribute.resolver.AbstractResolverPlugin;
import net.shibboleth.idp.attribute.resolver.AttributeDefinition;
import net.shibboleth.idp.attribute.resolver.AttributeResolver;
import net.shibboleth.idp.attribute.resolver.DataConnector;
@@ -65,7 +64,6 @@ import net.shibboleth.utilities.java.support.annotation.constraint.Unmodifiable;
import net.shibboleth.utilities.java.support.collection.LazyList;
import net.shibboleth.utilities.java.support.collection.LazyMap;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
/**
@@ -99,9 +97,6 @@ public class AttributeResolverImpl extends AbstractServiceableComponent<Attribut
/** Whether to strip null attribute values. */
private boolean stripNulls;
- /** Whether to attach DisplayInfo to attributes. */
- private boolean suppressDisplayInformation;
-
/** Strategy to get the {@link ProfileRequestContext}. */
@Nonnull private Function<AttributeResolutionContext,ProfileRequestContext> profileContextStrategy;
@@ -186,26 +181,6 @@ public class AttributeResolverImpl extends AbstractServiceableComponent<Attribut
stripNulls = doStripNulls;
}
- /** Do we allow addition of Display Information?
- * @return whether we are suppressing
- */
- public boolean isSuppressDisplayInformation() {
- return suppressDisplayInformation;
- }
-
- /**
- * Set whether we suppress addition of Display Information.
- * @deprecated Display Information should be consulted at point of use
- *
- * @param what true if we suppress the addition.
- */
- @Deprecated(forRemoval = true, since = "4.2")
- public void setSuppressDisplayInformation(final boolean what) {
- ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
-
- suppressDisplayInformation = what;
- }
-
/**
* Set the mechanism to obtain the {@link ProfileRequestContext}.
*
@@ -561,7 +536,6 @@ 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) {
@@ -595,9 +569,6 @@ public class AttributeResolverImpl extends AbstractServiceableComponent<Attribut
}
final IdPAttribute newAttr = new IdPAttribute(attribute.getId());
newAttr.setValues(values);
- if (!isSuppressDisplayInformation()) {
- dataConnector.addDisplayInformation(resolutionContext, newAttr);
- }
resolvedAttributes.put(attribute.getId(), newAttr);
}
}
@@ -661,7 +632,6 @@ public class AttributeResolverImpl extends AbstractServiceableComponent<Attribut
}
/** {@inheritDoc} */
- @SuppressWarnings("removal")
@Override protected void doInitialize() throws ComponentInitializationException {
logPrefix = new StringBuilder("Attribute Resolver '").append(getId()).append("':").toString();
@@ -683,17 +653,11 @@ public class AttributeResolverImpl extends AbstractServiceableComponent<Attribut
for (final DataConnector plugin : dataConnectors.values()) {
log.debug("{} Checking if data connector '{}' has a circular dependency", logPrefix, plugin.getId());
checkPlugInDependencies(plugin.getId(), plugin, dependencyVerifiedPlugins);
- if (plugin instanceof AbstractResolverPlugin<?>) {
- ((AbstractResolverPlugin<?>) plugin).setSuppressDisplayInformation(isSuppressDisplayInformation());
- }
}
for (final AttributeDefinition plugin : attributeDefinitions.values()) {
log.debug("{} Checking if attribute definition '{}' has a circular dependency", logPrefix, plugin.getId());
checkPlugInDependencies(plugin.getId(), plugin, dependencyVerifiedPlugins);
- if (plugin instanceof AbstractResolverPlugin<?>) {
- ((AbstractResolverPlugin<?>) plugin).setSuppressDisplayInformation(isSuppressDisplayInformation());
- }
}
super.doInitialize();
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list