You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ja...@apache.org on 2007/10/17 12:29:31 UTC

svn commit: r585437 - in /lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth: ShibbolethModule.java impl/AssertionConsumerServiceImpl.java impl/ShibbolethModuleImpl.java

Author: jann
Date: Wed Oct 17 03:29:22 2007
New Revision: 585437

URL: http://svn.apache.org/viewvc?rev=585437&view=rev
Log:
We need to get the baseURL from the target. Otherwise it might not correspond to the AssertionCosumerURL and we did not get any attributes

Modified:
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/ShibbolethModule.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/AssertionConsumerServiceImpl.java
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/ShibbolethModuleImpl.java

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/ShibbolethModule.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/ShibbolethModule.java?rev=585437&r1=585436&r2=585437&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/ShibbolethModule.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/ShibbolethModule.java Wed Oct 17 03:29:22 2007
@@ -101,4 +101,11 @@
      * @return The shire URL.
      */
     String getShireUrl(String baseUrl);
+    
+    /**
+     * @param targetUrl the target URL the user is send to after authentication. 
+     * @return The base Part of the targetUrl i.e. the scheme and the authority part of the URI.
+     */
+    String getTargetBaseUrl(String targetUrl);
+
 }

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/AssertionConsumerServiceImpl.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/AssertionConsumerServiceImpl.java?rev=585437&r1=585436&r2=585437&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/AssertionConsumerServiceImpl.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/AssertionConsumerServiceImpl.java Wed Oct 17 03:29:22 2007
@@ -100,8 +100,11 @@
 
         StringBuffer issuer = new StringBuffer();
         BrowserProfileRequest bpr = getBrowserProfileRequest(req);
+        String targetBaseURL = module.getTargetBaseUrl(bpr.TARGET);
+        if (targetBaseURL != null) baseUrl = targetBaseURL;
+        
         String handlerURL = module.getShireUrl(baseUrl);
-
+        
         BrowserProfileResponse profileResponse = profile.receive(issuer, bpr, handlerURL, module
                 .getReplayCache(), module.getArtifactMapper(), 1);
         checkIssueInstant(profileResponse);
@@ -176,7 +179,6 @@
             return;
         SAMLAuthenticationStatement authStatement = getSAMLAuthenticationStatement(profileResponse);
         // check remote address
-        remoteIP = "130.60.112.120";
         if (!authStatement.getSubjectIP().equals(remoteIP))
             throw new RuntimeException("Rejecting SAML authentication claiming IP: "
                     + authStatement.getSubjectIP() + ", coming from: " + remoteIP, null);

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/ShibbolethModuleImpl.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/ShibbolethModuleImpl.java?rev=585437&r1=585436&r2=585437&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/ShibbolethModuleImpl.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/ShibbolethModuleImpl.java Wed Oct 17 03:29:22 2007
@@ -18,6 +18,8 @@
 package org.apache.shibboleth.impl;
 
 import java.io.File;
+import java.net.URL;
+import java.net.MalformedURLException;
 
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
@@ -369,6 +371,16 @@
 
 	public String getShireUrl(String baseUrl) {
 		return baseUrl + this.shire;
+	}
+	
+	public String getTargetBaseUrl(String targetUrl){
+		try {
+            URL url = new URL(targetUrl);
+            return url.getProtocol() + "://" + url.getAuthority();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        return null;
 	}
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org