Author: andreas
Date: Tue Apr 1 05:15:54 2008
New Revision: 643372
URL: http://svn.apache.org/viewvc?rev=643372&view=rev
Log:
Use only authority part of proxy URL for Shibboleth Shire URL.
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/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=643372&r1=643371&r2=643372&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 Tue Apr 1 05:15:54 2008
@@ -75,7 +75,7 @@
* code.
*/
String getLanguageParamName();
-
+
/**
* @return The provider ID for this shibboleth resource.
*/
@@ -90,21 +90,24 @@
* @return The Shibboleth metadata object.
*/
Metadata getMetadata();
-
+
/**
* @return The URL of the WAYF server (without query string).
*/
String getWayfServerUrl();
-
+
/**
- * @param baseUrl The URL to append the shire URL to.
+ * @param baseUrl The URL to append the shire URL to. If the shire URL
+ * starts with a slash, only the authority part
+ * (protocol://host[:port]) is used.
* @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.
+ * @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/ShibbolethModuleImpl.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/shibboleth/impl/ShibbolethModuleImpl.java?rev=643372&r1=643371&r2=643372&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 Tue Apr 1 05:15:54 2008
@@ -365,9 +365,37 @@
}
public String getShireUrl(String baseUrl) {
- return baseUrl + this.shire;
+ StringBuffer shireUrl = new StringBuffer();
+ if (this.shire.startsWith("/") && containsAuthority(baseUrl)) {
+ URL url = toUrl(baseUrl);
+ shireUrl.append(url.getProtocol());
+ shireUrl.append("://");
+ shireUrl.append(url.getAuthority());
+ }
+ else {
+ shireUrl.append(baseUrl);
+ if (!baseUrl.endsWith("/")) {
+ shireUrl.append("/");
+ }
+ }
+ shireUrl.append(this.shire);
+ return shireUrl.toString();
+ }
+
+ protected URL toUrl(String urlString) {
+ URL url;
+ try {
+ url = new URL(urlString);
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ return url;
}
+ protected boolean containsAuthority(String url) {
+ return url.startsWith("http://") || url.startsWith("https://");
+ }
+
public String getTargetBaseUrl(String targetUrl){
try {
URL url = new URL(targetUrl);
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.