You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2018/02/28 15:29:43 UTC
[cxf-fediz] branch 1.4.x-fixes updated: Adding a test for a SAML
Subject with a comment
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch 1.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git
The following commit(s) were added to refs/heads/1.4.x-fixes by this push:
new dd7a77d Adding a test for a SAML Subject with a comment
dd7a77d is described below
commit dd7a77d6691857fef0f1b326e7ecea01509d7294
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Wed Feb 28 13:02:10 2018 +0000
Adding a test for a SAML Subject with a comment
---
.../core/federation/FederationResponseTest.java | 37 ++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java
index a4e159d..e51415a 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/federation/FederationResponseTest.java
@@ -362,6 +362,43 @@ public class FederationResponseTest {
Assert.assertEquals("Audience wrong", TEST_AUDIENCE, wfRes.getAudience());
}
+ @org.junit.Test
+ public void validateSAML2TokenSubjectWithComment() throws Exception {
+ SAML2CallbackHandler callbackHandler = new SAML2CallbackHandler();
+ callbackHandler.setStatement(SAML2CallbackHandler.Statement.ATTR);
+ callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER);
+ callbackHandler.setIssuer(TEST_RSTR_ISSUER);
+ String subject = "alice<!---->o=example.com";
+ callbackHandler.setSubjectName(subject);
+ ConditionsBean cp = new ConditionsBean();
+ AudienceRestrictionBean audienceRestriction = new AudienceRestrictionBean();
+ audienceRestriction.getAudienceURIs().add(TEST_AUDIENCE);
+ cp.setAudienceRestrictions(Collections.singletonList(audienceRestriction));
+ callbackHandler.setConditions(cp);
+
+ SAMLCallback samlCallback = new SAMLCallback();
+ SAMLUtil.doSAMLCallback(callbackHandler, samlCallback);
+ SamlAssertionWrapper assertion = new SamlAssertionWrapper(samlCallback);
+ String rstr = createSamlToken(assertion, "mystskey", true, STSUtil.SAMPLE_RSTR_MSG);
+
+ FedizRequest wfReq = new FedizRequest();
+ wfReq.setAction(FederationConstants.ACTION_SIGNIN);
+ wfReq.setResponseToken(rstr);
+
+ configurator = null;
+ FedizContext config = getFederationConfigurator().getFedizContext("ROOT");
+
+ FedizProcessor wfProc = new FederationProcessorImpl();
+ FedizResponse wfRes = wfProc.processRequest(wfReq, config);
+
+ Assert.assertEquals("Principal name wrong", subject,
+ wfRes.getUsername());
+ Assert.assertEquals("Issuer wrong", TEST_RSTR_ISSUER, wfRes.getIssuer());
+ Assert.assertEquals("Two roles must be found", 2, wfRes.getRoles()
+ .size());
+ Assert.assertEquals("Audience wrong", TEST_AUDIENCE, wfRes.getAudience());
+ }
+
/**
* Validate SAML 2 token which doesn't include the role SAML attribute
*/
--
To stop receiving notification emails like this one, please contact
coheigea@apache.org.