[java-identity-provider] branch master updated: IDP-1121 - V4 Deprecation work - Attribute Resolver
Scott Cantor
cantor.2 at osu.edu
Wed Feb 6 17:32:09 EST 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=6f713cf9ebfb0966c7c4003627c64357ab0ffb53
The following commit(s) were added to refs/heads/master by this push:
new 6f713cf IDP-1121 - V4 Deprecation work - Attribute Resolver
6f713cf is described below
commit 6f713cf9ebfb0966c7c4003627c64357ab0ffb53
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Feb 6 17:32:06 2019 -0500
IDP-1121 - V4 Deprecation work - Attribute Resolver
https://issues.shibboleth.net/jira/browse/IDP-1121
Fix tests to account for removal of Transient attribute defs.
---
.../shibboleth/idp/test/flows/c14n/TestC14N.java | 8 +--
.../test/flows/c14n/actions/SetupForSAML1C14N.java | 50 ++++++++++---------
.../test/flows/c14n/actions/SetupForSAML2C14N.java | 47 ++++++++++--------
.../src/test/resources/c14n/webflows/beans.xml | 57 ++++++++++++++++++----
.../c14n/webflows/cryptoTransientNameID-flow.xml | 1 -
.../cryptoTransientNameIdentifier-flow.xml | 1 -
.../c14n/webflows/transientNameID-flow.xml | 1 -
.../c14n/webflows/transientNameIdentifier-flow.xml | 1 -
8 files changed, 105 insertions(+), 61 deletions(-)
diff --git a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/TestC14N.java b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/TestC14N.java
index 499c279..3a72b32 100644
--- a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/TestC14N.java
+++ b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/TestC14N.java
@@ -36,7 +36,7 @@ public class TestC14N extends AbstractFlowTest {
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(TestC14N.class);
- @Test(enabled=false) public void testTransientNameID() {
+ @Test public void testTransientNameID() {
final FlowExecutionResult result = flowExecutor.launchExecution("transientNameID", null, externalContext);
@@ -44,7 +44,7 @@ public class TestC14N extends AbstractFlowTest {
assertFlowExecutionOutcome(result.getOutcome());
}
- @Test(enabled=false) public void testCryptoTransientNameID() {
+ @Test public void testCryptoTransientNameID() {
final FlowExecutionResult result = flowExecutor.launchExecution("cryptoTransientNameID", null, externalContext);
@@ -60,7 +60,7 @@ public class TestC14N extends AbstractFlowTest {
assertFlowExecutionOutcome(result.getOutcome());
}
- @Test(enabled=false) public void testTransientNameIdentifier() {
+ @Test public void testTransientNameIdentifier() {
final FlowExecutionResult result =
flowExecutor.launchExecution("transientNameIdentifier", null, externalContext);
@@ -69,7 +69,7 @@ public class TestC14N extends AbstractFlowTest {
assertFlowExecutionOutcome(result.getOutcome());
}
- @Test(enabled=false) public void testCryptoTransientNameIdentifier() {
+ @Test public void testCryptoTransientNameIdentifier() {
final FlowExecutionResult result =
flowExecutor.launchExecution("cryptoTransientNameIdentifier", null, externalContext);
diff --git a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/actions/SetupForSAML1C14N.java b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/actions/SetupForSAML1C14N.java
index 07d7527..00c2587 100644
--- a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/actions/SetupForSAML1C14N.java
+++ b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/actions/SetupForSAML1C14N.java
@@ -20,12 +20,14 @@ package net.shibboleth.idp.test.flows.c14n.actions;
import java.util.Collection;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.security.auth.Subject;
import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
import org.opensaml.profile.action.ActionSupport;
import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.saml.common.SAMLException;
import org.opensaml.saml.common.SAMLObjectBuilder;
import org.opensaml.saml.saml1.core.NameIdentifier;
@@ -36,6 +38,8 @@ import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
import net.shibboleth.idp.profile.AbstractProfileAction;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.saml.authn.principal.NameIdentifierPrincipal;
+import net.shibboleth.idp.saml.nameid.impl.TransientSAML1NameIdentifierGenerator;
+import net.shibboleth.idp.saml.xml.SAMLConstants;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
/**
@@ -45,20 +49,16 @@ public class SetupForSAML1C14N extends AbstractProfileAction {
private String attributeName;
- /**
- * @return Returns the attributeName.
- */
- public String getAttributeName() {
- return attributeName;
- }
-
- /**
- * @param attributeName The attributeName to set.
- */
- public void setAttributeName(String attributeName) {
+ private TransientSAML1NameIdentifierGenerator generator;
+
+ public void setAttributeName(@Nullable final String attributeName) {
this.attributeName = attributeName;
}
+ public void setGenerator(@Nullable final TransientSAML1NameIdentifierGenerator gen) {
+ generator = gen;
+ }
+
private NameIdentifier encode(IdPAttribute attribute) {
final Collection<IdPAttributeValue<?>> attributeValues = attribute.getValues();
if (attributeValues == null || attributeValues.isEmpty()) {
@@ -69,13 +69,7 @@ public class SetupForSAML1C14N extends AbstractProfileAction {
NameIdentifier.DEFAULT_ELEMENT_NAME);
final NameIdentifier nameId = identifierBuilder.buildObject();
- final String format;
- if ("Principal".equals(attributeName)) {
- format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified";
- } else {
- format="urn:mace:shibboleth:1.0:nameIdentifier";
- }
- nameId.setFormat(format);
+ nameId.setFormat(NameIdentifier.UNSPECIFIED);
for (final IdPAttributeValue attrValue : attributeValues) {
if (attrValue == null || attrValue.getValue() == null) {
continue;
@@ -98,9 +92,20 @@ public class SetupForSAML1C14N extends AbstractProfileAction {
@Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
final RelyingPartyContext rpc = profileRequestContext.getSubcontext(RelyingPartyContext.class);
-
- final AttributeContext ac = rpc.getSubcontext(AttributeContext.class, false);
- final NameIdentifier nid = encode(ac.getIdPAttributes().get(getAttributeName()));
+
+ NameIdentifier nid = null;
+
+ if (generator != null) {
+ try {
+ nid = generator.generate(profileRequestContext, SAMLConstants.SAML1_NAMEID_TRANSIENT);
+ } catch (final SAMLException e) {
+
+ }
+ } else {
+ final AttributeContext ac = rpc.getSubcontext(AttributeContext.class);
+ nid = encode(ac.getIdPAttributes().get(attributeName));
+ }
+
if (nid == null) {
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
return;
@@ -116,4 +121,5 @@ public class SetupForSAML1C14N extends AbstractProfileAction {
scc.setRequesterId(rpc.getRelyingPartyId());
scc.setResponderId(rpc.getConfiguration().getResponderId());
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/actions/SetupForSAML2C14N.java b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/actions/SetupForSAML2C14N.java
index b392373..c8136c4 100644
--- a/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/actions/SetupForSAML2C14N.java
+++ b/idp-conf/src/test/java/net/shibboleth/idp/test/flows/c14n/actions/SetupForSAML2C14N.java
@@ -20,14 +20,17 @@ package net.shibboleth.idp.test.flows.c14n.actions;
import java.util.Collection;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.security.auth.Subject;
import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
import org.opensaml.profile.action.ActionSupport;
import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.saml.common.SAMLException;
import org.opensaml.saml.common.SAMLObjectBuilder;
import org.opensaml.saml.saml2.core.NameID;
+import org.opensaml.saml.saml2.core.NameIDType;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.IdPAttributeValue;
@@ -36,26 +39,23 @@ import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
import net.shibboleth.idp.profile.AbstractProfileAction;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.saml.authn.principal.NameIDPrincipal;
+import net.shibboleth.idp.saml.nameid.impl.TransientSAML2NameIDGenerator;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
/**
- *
+ * Action to mock up a Subject for C14N.
*/
public class SetupForSAML2C14N extends AbstractProfileAction {
private String attributeName;
- /**
- * @return Returns the attributeName.
- */
- public String getAttributeName() {
- return attributeName;
+ private TransientSAML2NameIDGenerator generator;
+
+ public void setGenerator(@Nullable final TransientSAML2NameIDGenerator gen) {
+ generator = gen;
}
- /**
- * @param attributeName The attributeName to set.
- */
- public void setAttributeName(String attributeName) {
+ public void setAttributeName(@Nullable final String attributeName) {
this.attributeName = attributeName;
}
@@ -68,13 +68,7 @@ public class SetupForSAML2C14N extends AbstractProfileAction {
final SAMLObjectBuilder<NameID> identifierBuilder = (SAMLObjectBuilder<NameID>)
XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(NameID.DEFAULT_ELEMENT_NAME);
final NameID nameId = identifierBuilder.buildObject();
- final String format;
- if ("Principal".equals(attributeName)) {
- format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified";
- } else {
- format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient";
- }
- nameId.setFormat(format);
+ nameId.setFormat(NameIDType.UNSPECIFIED);
for (final IdPAttributeValue attrValue : attributeValues) {
if (attrValue == null || attrValue.getValue() == null) {
continue;
@@ -98,9 +92,19 @@ public class SetupForSAML2C14N extends AbstractProfileAction {
@Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
final RelyingPartyContext rpc = profileRequestContext.getSubcontext(RelyingPartyContext.class);
-
- final AttributeContext ac = rpc.getSubcontext(AttributeContext.class, false);
- final NameID nid = encode(ac.getIdPAttributes().get(getAttributeName()));
+ final AttributeContext ac = rpc.getSubcontext(AttributeContext.class);
+
+ NameID nid = null;
+
+ if (generator != null) {
+ try {
+ nid = generator.generate(profileRequestContext, NameIDType.TRANSIENT);
+ } catch (SAMLException e) {
+
+ }
+ } else {
+ nid = encode(ac.getIdPAttributes().get(attributeName));
+ }
if (nid == null) {
ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_PROFILE_CTX);
@@ -117,4 +121,5 @@ public class SetupForSAML2C14N extends AbstractProfileAction {
scc.setRequesterId(rpc.getRelyingPartyId());
scc.setResponderId(rpc.getConfiguration().getResponderId());
}
-}
+
+}
\ No newline at end of file
diff --git a/idp-conf/src/test/resources/c14n/webflows/beans.xml b/idp-conf/src/test/resources/c14n/webflows/beans.xml
index 4442797..f841ff2 100644
--- a/idp-conf/src/test/resources/c14n/webflows/beans.xml
+++ b/idp-conf/src/test/resources/c14n/webflows/beans.xml
@@ -10,20 +10,57 @@
<bean class="net.shibboleth.ext.spring.config.IdentifiableBeanPostProcessor" />
+ <bean id="StoredTransientIdStrategy"
+ class="net.shibboleth.idp.saml.nameid.impl.StoredTransientIdGenerationStrategy"
+ p:idStore-ref="shibboleth.StorageService" />
+
+ <bean id="CryptoTransientIdStrategy"
+ class="net.shibboleth.idp.saml.nameid.impl.CryptoTransientIdGenerationStrategy"
+ p:dataSealer-ref="shibboleth.DataSealer" />
+
+ <bean id="StoredSAML1TransientGenerator"
+ class="net.shibboleth.idp.saml.nameid.impl.TransientSAML1NameIdentifierGenerator"
+ p:transientIdGenerator-ref="StoredTransientIdStrategy" />
+
+ <bean id="CryptoSAML1TransientGenerator"
+ class="net.shibboleth.idp.saml.nameid.impl.TransientSAML1NameIdentifierGenerator"
+ p:transientIdGenerator-ref="CryptoTransientIdStrategy" />
+
+ <bean id="StoredSAML2TransientGenerator"
+ class="net.shibboleth.idp.saml.nameid.impl.TransientSAML2NameIDGenerator"
+ p:transientIdGenerator-ref="StoredTransientIdStrategy" />
+
+ <bean id="CryptoSAML2TransientGenerator"
+ class="net.shibboleth.idp.saml.nameid.impl.TransientSAML2NameIDGenerator"
+ p:transientIdGenerator-ref="CryptoTransientIdStrategy" />
+
<bean id="InitializeProfileRequestContext"
class="net.shibboleth.idp.profile.impl.InitializeProfileRequestContext"
scope="prototype" p:profileId="test_flow" />
- <bean id="PopulateResolution" class = "net.shibboleth.idp.test.flows.SetupForResolver" scope="prototype" />
- <bean id="ResolveAttributes" class="net.shibboleth.idp.profile.impl.ResolveAttributes" c:resolverService-ref="shibboleth.AttributeResolverService" scope="prototype" />
- <bean id="PopulateSAML2C14N" class = "net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML2C14N" scope="prototype" p:attributeName="transientId" />
- <bean id="PopulateSAML2C14NCrypto" class = "net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML2C14N" scope="prototype" p:attributeName="cryptoTransientId" />
- <bean id="PopulateSAML2C14NTransform" class = "net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML2C14N" scope="prototype" p:attributeName="Principal" />
- <bean id="TestAfterC14N" class = "net.shibboleth.idp.test.flows.c14n.actions.TestAfterC14N" scope="prototype" />
-
- <bean id="PopulateSAML1C14N" class = "net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML1C14N" scope="prototype" p:attributeName="transientId" />
- <bean id="PopulateSAML1C14NCrypto" class = "net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML1C14N" scope="prototype" p:attributeName="cryptoTransientId" />
- <bean id="PopulateSAML1C14NTransform" class = "net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML1C14N" scope="prototype" p:attributeName="Principal" />
+ <bean id="PopulateResolution" class="net.shibboleth.idp.test.flows.SetupForResolver" scope="prototype" />
+ <bean id="ResolveAttributes" class="net.shibboleth.idp.profile.impl.ResolveAttributes"
+ c:resolverService-ref="shibboleth.AttributeResolverService" scope="prototype" />
+
+ <bean id="PopulateSAML2C14N" class="net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML2C14N" scope="prototype"
+ p:generator-ref="StoredSAML2TransientGenerator" />
+
+ <bean id="PopulateSAML2C14NCrypto" class="net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML2C14N" scope="prototype"
+ p:generator-ref="CryptoSAML2TransientGenerator" />
+
+ <bean id="PopulateSAML2C14NTransform" class="net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML2C14N" scope="prototype"
+ p:attributeName="Principal" />
+
+ <bean id="TestAfterC14N" class="net.shibboleth.idp.test.flows.c14n.actions.TestAfterC14N" scope="prototype" />
+
+ <bean id="PopulateSAML1C14N" class="net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML1C14N" scope="prototype"
+ p:generator-ref="StoredSAML1TransientGenerator" />
+
+ <bean id="PopulateSAML1C14NCrypto" class="net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML1C14N" scope="prototype"
+ p:generator-ref="CryptoSAML1TransientGenerator" />
+
+ <bean id="PopulateSAML1C14NTransform" class="net.shibboleth.idp.test.flows.c14n.actions.SetupForSAML1C14N" scope="prototype"
+ p:attributeName="Principal" />
<bean id="PopulateSubjectCanonicalizationContext"
class="net.shibboleth.idp.authn.impl.PopulateSubjectCanonicalizationContext" scope="prototype"
diff --git a/idp-conf/src/test/resources/c14n/webflows/cryptoTransientNameID-flow.xml b/idp-conf/src/test/resources/c14n/webflows/cryptoTransientNameID-flow.xml
index 9258dd8..18f0d73 100644
--- a/idp-conf/src/test/resources/c14n/webflows/cryptoTransientNameID-flow.xml
+++ b/idp-conf/src/test/resources/c14n/webflows/cryptoTransientNameID-flow.xml
@@ -7,7 +7,6 @@
<action-state id="PopulateResolution">
<evaluate expression="PopulateResolution" />
- <evaluate expression="ResolveAttributes" />
<evaluate expression="PopulateSAML2C14NCrypto" />
<evaluate expression="PopulateSubjectCanonicalizationContext" />
<evaluate expression="'proceed'" />
diff --git a/idp-conf/src/test/resources/c14n/webflows/cryptoTransientNameIdentifier-flow.xml b/idp-conf/src/test/resources/c14n/webflows/cryptoTransientNameIdentifier-flow.xml
index 5a4b140..53671cb 100644
--- a/idp-conf/src/test/resources/c14n/webflows/cryptoTransientNameIdentifier-flow.xml
+++ b/idp-conf/src/test/resources/c14n/webflows/cryptoTransientNameIdentifier-flow.xml
@@ -7,7 +7,6 @@
<action-state id="PopulateResolution">
<evaluate expression="PopulateResolution" />
- <evaluate expression="ResolveAttributes" />
<evaluate expression="PopulateSAML1C14NCrypto" />
<evaluate expression="PopulateSubjectCanonicalizationContext" />
<evaluate expression="'proceed'" />
diff --git a/idp-conf/src/test/resources/c14n/webflows/transientNameID-flow.xml b/idp-conf/src/test/resources/c14n/webflows/transientNameID-flow.xml
index fbaa309..3d787b1 100644
--- a/idp-conf/src/test/resources/c14n/webflows/transientNameID-flow.xml
+++ b/idp-conf/src/test/resources/c14n/webflows/transientNameID-flow.xml
@@ -7,7 +7,6 @@
<action-state id="PopulateResolution">
<evaluate expression="PopulateResolution" />
- <evaluate expression="ResolveAttributes" />
<evaluate expression="PopulateSAML2C14N" />
<evaluate expression="PopulateSubjectCanonicalizationContext" />
<evaluate expression="'proceed'" />
diff --git a/idp-conf/src/test/resources/c14n/webflows/transientNameIdentifier-flow.xml b/idp-conf/src/test/resources/c14n/webflows/transientNameIdentifier-flow.xml
index 9b1017b..74b96b4 100644
--- a/idp-conf/src/test/resources/c14n/webflows/transientNameIdentifier-flow.xml
+++ b/idp-conf/src/test/resources/c14n/webflows/transientNameIdentifier-flow.xml
@@ -7,7 +7,6 @@
<action-state id="PopulateResolution">
<evaluate expression="PopulateResolution" />
- <evaluate expression="ResolveAttributes" />
<evaluate expression="PopulateSAML1C14N" />
<evaluate expression="PopulateSubjectCanonicalizationContext" />
<evaluate expression="'proceed'" />
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list