[java-identity-provider] branch master updated: Revert "IDP-1235 Add support to pre-resolve attributes"
Scott Cantor
cantor.2 at osu.edu
Wed Sep 25 10:01:44 EDT 2019
This is an automated email from the git hooks/post-receive script.
scantor 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=8a6a6abb345c079179777f122aeb589408d3cdbb
The following commit(s) were added to refs/heads/master by this push:
new 8a6a6ab Revert "IDP-1235 Add support to pre-resolve attributes"
8a6a6ab is described below
commit 8a6a6abb345c079179777f122aeb589408d3cdbb
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Sep 25 10:01:17 2019 -0400
Revert "IDP-1235 Add support to pre-resolve attributes"
This reverts commit 048928c21c086b24e4f026fe17be672dbd0e2ef6.
---
.../resolver/AbstractAttributeDefinition.java | 18 ------------------
.../attribute/resolver/AttributeDefinition.java | 6 ------
.../resolver/AbstractAttributeDefinitionTest.java | 13 +++++--------
.../resolver/impl/AttributeResolverImpl.java | 22 +++++++++++++++++-----
.../resolver/impl/AttributeResolverImplTest.java | 6 ++----
idp-conf/src/main/resources/conf/logback.xml | 2 +-
6 files changed, 25 insertions(+), 42 deletions(-)
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 741dc09..38d707c 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
@@ -46,9 +46,6 @@ public abstract class AbstractAttributeDefinition extends AbstractResolverPlugin
/** Whether this attribute definition is only a dependency and thus its values should never be released. */
private boolean dependencyOnly;
- /** Whether this attribute definition is to be pre-resolved. */
- private boolean preRequested;
-
/** cache for the log prefix - to save multiple recalculations. */
@Nullable private String logPrefix;
@@ -78,21 +75,6 @@ public abstract class AbstractAttributeDefinition extends AbstractResolverPlugin
/** {@inheritDoc} */
@Override
- public boolean isPreRequested() {
- return preRequested;
- }
-
- /** Sets whether this definition (and its dependencies) are to be pre-resolved.
- * @param value what to set
- */
- public void setPreRequested(final boolean value) {
- ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
- ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
- preRequested = value;
- }
-
- /** {@inheritDoc} */
- @Override
protected void doInitialize() throws ComponentInitializationException {
// Set up the dependencies first. Then the initialize in the parent
diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeDefinition.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeDefinition.java
index c2d1228..f49e296 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeDefinition.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/AttributeDefinition.java
@@ -33,10 +33,4 @@ public interface AttributeDefinition extends ResolverPlugin<IdPAttribute> {
*/
boolean isDependencyOnly();
- /**
- * Gets whether this attribute definition has to be resolved prior in a first pass (in order to prime
- * contexts which can be used in the "main pass").
- * @return true if this is a definition to be done "first"
- */
- boolean isPreRequested();
}
\ No newline at end of file
diff --git a/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinitionTest.java b/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinitionTest.java
index 5323348..ecf5796 100644
--- a/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinitionTest.java
+++ b/idp-attribute-resolver-api/src/test/java/net/shibboleth/idp/attribute/resolver/AbstractAttributeDefinitionTest.java
@@ -44,28 +44,25 @@ public class AbstractAttributeDefinitionTest {
Assert.assertEquals(definition.getId(), "foo");
Assert.assertFalse(definition.isDependencyOnly());
- Assert.assertFalse(definition.isPreRequested());
}
/** Tests setting and retrieving the dependency only option. */
@Test
- public void booleanTests() {
+ public void dependencyOnly() {
MockAttributeDefinition definition = new MockAttributeDefinition("foo", null);
Assert.assertFalse(definition.isDependencyOnly());
- Assert.assertFalse(definition.isDependencyOnly());
definition.setDependencyOnly(true);
Assert.assertTrue(definition.isDependencyOnly());
- Assert.assertFalse(definition.isPreRequested());
- definition.setPreRequested(true);
- Assert.assertTrue(definition.isPreRequested());
+ definition.setDependencyOnly(true);
+ Assert.assertTrue(definition.isDependencyOnly());
definition.setDependencyOnly(false);
Assert.assertFalse(definition.isDependencyOnly());
- definition.setPreRequested(false);
- Assert.assertFalse(definition.isPreRequested());
+ definition.setDependencyOnly(false);
+ Assert.assertFalse(definition.isDependencyOnly());
}
/** Test resolve an 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 6e02ddd..e96eb9e 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
@@ -29,7 +29,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Function;
-import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -133,6 +132,13 @@ public class AttributeResolverImpl extends AbstractServiceableComponent<Attribut
attributeDefinitions = ImmutableMap.copyOf(checkedDefinitions);
}
+ /** Sets the Attributes to be resolved "first" for this resolver.
+ * @param attrs what to set.
+ */
+ public void setPreRequestedAttributes(final List<String> attrs) {
+ preRequestedAttributes = Collections.unmodifiableList(attrs);
+ }
+
/**
* Gets the collection of attribute definitions for this resolver.
*
@@ -655,10 +661,16 @@ public class AttributeResolverImpl extends AbstractServiceableComponent<Attribut
throw new ComponentInitializationException("No Data Connectors provided");
}
- preRequestedAttributes = attributeDefinitions.entrySet().stream().
- filter(e -> e.getValue().isPreRequested()).
- map(Entry::getKey).
- collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
+ if (null == preRequestedAttributes) {
+ preRequestedAttributes = Collections.emptyList();
+ } else {
+ for (final String requested : preRequestedAttributes) {
+ if (!attributeDefinitions.containsKey(requested)) {
+ throw new ComponentInitializationException("Definition for prerequested attribute '"
+ + requested + "' not present");
+ }
+ }
+ }
final HashSet<String> dependencyVerifiedPlugins = new HashSet<>();
for (final DataConnector plugin : dataConnectors.values()) {
diff --git a/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java b/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java
index 40a77dd..5b095a9 100644
--- a/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java
+++ b/idp-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/impl/AttributeResolverImplTest.java
@@ -253,16 +253,14 @@ public class AttributeResolverImplTest {
attribute2.setValues(Collections.singletonList(new StringAttributeValue("value2")));
final LazySet<AttributeDefinition> definitions = new LazySet<>();
- final AbstractAttributeDefinition ad1 = new MockAttributeDefinition("ad1", attribute);
- ad1.setPreRequested(true);
- definitions.add(ad1);
+ definitions.add(new MockAttributeDefinition("ad1", attribute));
definitions.add(new PreDefinedCheckingMockAttributeDefinition("ad2", attribute2, "ad1"));
-
for (AttributeDefinition defn:definitions) {
defn.initialize();
}
final AttributeResolverImpl resolver = newAttributeResolverImpl("foo", definitions, null);
+ resolver.setPreRequestedAttributes(List.of("ad1"));
resolver.initialize();
AttributeResolutionContext context = new AttributeResolutionContext();
diff --git a/idp-conf/src/main/resources/conf/logback.xml b/idp-conf/src/main/resources/conf/logback.xml
index ca540c5..eeaecf4 100644
--- a/idp-conf/src/main/resources/conf/logback.xml
+++ b/idp-conf/src/main/resources/conf/logback.xml
@@ -14,7 +14,7 @@
<!-- Location and retention. -->
- <variable name="idp.logfiles" value="H:/Perforce/Juno/New/logs}" />
+ <variable name="idp.logfiles" value="${idp.home}/logs}" />
<variable name="idp.loghistory" value="${idp.loghistory:-180}" />
<!-- Much higher performance if you operate on DEBUG. -->
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list