cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [3/5] cxf-fediz git commit: Fixing tests
Date Wed, 09 Aug 2017 14:27:32 GMT
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/110cac03
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/110cac03
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/110cac03

Branch: refs/heads/master
Commit: 110cac03b7b57e6a1c6d2d50cacafe5e3470a5eb
Parents: cd97dae
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 12:39:19 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/110cac03/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/110cac03/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/110cac03/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>


Mime
View raw message