Fixing tests
Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/ee592a79
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/ee592a79
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/ee592a79
Branch: refs/heads/1.4.x-fixes
Commit: ee592a79e0d701ba336e5918457d2ae492e86550
Parents: f11cd17
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Wed Aug 9 12:39:19 2017 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Wed Aug 9 15:28:54 2017 +0100
----------------------------------------------------------------------
.../idp/beans/samlsso/SamlResponseCreator.java | 15 +++++++++++++--
.../src/test/resources/realmb/idp-servlet.xml | 4 ++++
.../wsfed/src/test/resources/realmb/idp-servlet.xml | 4 ++++
3 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/ee592a79/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java
----------------------------------------------------------------------
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java
b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java
index d5a13a2..6824202 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/beans/samlsso/SamlResponseCreator.java
@@ -66,6 +66,7 @@ public class SamlResponseCreator {
private static final Logger LOG = LoggerFactory.getLogger(SamlResponseCreator.class);
private boolean supportDeflateEncoding;
+ private boolean useRealmForIssuer;
public String createSAMLResponse(RequestContext context, Idp idp, Element rpToken,
String consumerURL, String requestId, String requestIssuer)
@@ -100,7 +101,8 @@ public class SamlResponseCreator {
String remoteAddr, String racs) throws Exception
{
// Create an AuthenticationAssertion
SAML2CallbackHandler callbackHandler = new SAML2CallbackHandler();
- callbackHandler.setIssuer(idp.getIdpUrl().toString());
+ String issuer = useRealmForIssuer ? idp.getRealm() : idp.getIdpUrl().toString();
+ callbackHandler.setIssuer(issuer);
callbackHandler.setSubject(receivedToken.getSaml2().getSubject());
// Test Subject against received Subject (if applicable)
@@ -153,8 +155,9 @@ public class SamlResponseCreator {
SAML2PResponseComponentBuilder.createStatus(
"urn:oasis:names:tc:SAML:2.0:status:Success", null
);
+ String issuer = useRealmForIssuer ? idp.getRealm() : idp.getIdpUrl().toString();
Response response =
- SAML2PResponseComponentBuilder.createSAMLResponse(requestID, idp.getIdpUrl().toString(),
status);
+ SAML2PResponseComponentBuilder.createSAMLResponse(requestID, issuer, status);
response.getAssertions().add(assertion);
@@ -185,4 +188,12 @@ public class SamlResponseCreator {
public void setSupportDeflateEncoding(boolean supportDeflateEncoding) {
this.supportDeflateEncoding = supportDeflateEncoding;
}
+
+ public boolean isUseRealmForIssuer() {
+ return useRealmForIssuer;
+ }
+
+ public void setUseRealmForIssuer(boolean useRealmForIssuer) {
+ this.useRealmForIssuer = useRealmForIssuer;
+ }
}
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/ee592a79/systests/federation/samlsso/src/test/resources/realmb/idp-servlet.xml
----------------------------------------------------------------------
diff --git a/systests/federation/samlsso/src/test/resources/realmb/idp-servlet.xml b/systests/federation/samlsso/src/test/resources/realmb/idp-servlet.xml
index c556808..479c493 100644
--- a/systests/federation/samlsso/src/test/resources/realmb/idp-servlet.xml
+++ b/systests/federation/samlsso/src/test/resources/realmb/idp-servlet.xml
@@ -36,5 +36,9 @@
<property name="wsdlEndpoint" value="Transport_Port" />
<property name="tokenType" value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
/>
</bean>
+
+ <bean id="samlResponseCreator" class="org.apache.cxf.fediz.service.idp.beans.samlsso.SamlResponseCreator">
+ <property name="useRealmForIssuer" value="true"/>
+ </bean>
</beans>
http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/ee592a79/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml
----------------------------------------------------------------------
diff --git a/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml b/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml
index c556808..8c44885 100644
--- a/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml
+++ b/systests/federation/wsfed/src/test/resources/realmb/idp-servlet.xml
@@ -37,4 +37,8 @@
<property name="tokenType" value="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
/>
</bean>
+ <bean id="samlResponseCreator" class="org.apache.cxf.fediz.service.idp.beans.samlsso.SamlResponseCreator">
+ <property name="useRealmForIssuer" value="true"/>
+ </bean>
+
</beans>
|