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/03 12:19:55 UTC

svn commit: r581556 - in /lenya/branches/branch_1_2_x_shibboleth/src: java/org/apache/lenya/ac/shibboleth/ java/org/apache/shibboleth/ java/org/apache/shibboleth/impl/ webapp/WEB-INF/

Author: jann
Date: Wed Oct  3 03:19:54 2007
New Revision: 581556

URL: http://svn.apache.org/viewvc?rev=581556&view=rev
Log:
Configure shire in cocoon.xconf

Modified:
    lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java
    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
    lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl

Modified: lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java?rev=581556&r1=581555&r2=581556&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/java/org/apache/lenya/ac/shibboleth/ShibbolethModule.java Wed Oct  3 03:19:54 2007
@@ -40,7 +40,7 @@
             throws ConfigurationException {
 
         // attributes to get from the org.apache.shibboleth.ShibbolethModule
-        String[] shibModuleAttrs = { ATTR_WAYF_SERVER, ATTR_PROVIDER_ID };
+        String[] shibModuleAttrs = { ATTR_WAYF_SERVER, ATTR_PROVIDER_ID, ATTR_SHIRE };
         if (Arrays.asList(shibModuleAttrs).contains(name)) {
             org.apache.shibboleth.ShibbolethModule shibModule = null;
             try {
@@ -51,6 +51,8 @@
                     return shibModule.getWayfServerUrl();
                 } else if (name.equals(ATTR_PROVIDER_ID)) {
                     return shibModule.getProviderId();
+                } else if (name.equals(ATTR_SHIRE)) {
+                	    return shibModule.getShire();
                 } else {
                     throw new ConfigurationException("Attribute [" + name + "] not supported!");
                 }
@@ -75,10 +77,8 @@
                 outgoingUrl = serverUrl + outgoingUrl;
             }
 
-            if (name.equals(ATTR_SHIRE)) {
-                return outgoingUrl + "?lenya.usecase=login&lenya.step=login";
-            } else if (name.equals(ATTR_TARGET)) {
-                return outgoingUrl;
+            if (name.equals(ATTR_TARGET)) {
+                return outgoingUrl; // + "?lenya.usecase=login&lenya.step=login";
             } else {
                 throw new ConfigurationException("Attribute [" + name + "] not supported!");
             }

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=581556&r1=581555&r2=581556&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  3 03:19:54 2007
@@ -95,4 +95,9 @@
      * @return The URL of the WAYF server (without query string).
      */
     String getWayfServerUrl();
+    
+    /**
+     * @return The shire URL.
+     */
+    String getShire();
 }

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=581556&r1=581555&r2=581556&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  3 03:19:54 2007
@@ -92,12 +92,11 @@
      */
     public BrowserProfileResponse processRequest(HttpServletRequest req) throws SAMLException {
         SAMLBrowserProfile profile = SAMLBrowserProfileFactory.getInstance();
+        ShibbolethModule module = getShibbolethModule();
 
         StringBuffer issuer = new StringBuffer();
         BrowserProfileRequest bpr = getBrowserProfileRequest(req);
-        String handlerURL = getCompleteUrl(req);
-
-        ShibbolethModule module = getShibbolethModule();
+        String handlerURL = module.getShire();
 
         BrowserProfileResponse profileResponse = profile.receive(issuer, bpr, handlerURL, module
                 .getReplayCache(), module.getArtifactMapper(), 1);
@@ -145,7 +144,7 @@
      */
     private void checkRecipient(BrowserProfileResponse profileResponse) {
         String recipient = profileResponse.response.getRecipient();
-        if (recipient != null && !recipient.equals(getShireUrl())) {
+        if (recipient != null && !recipient.equals(getShibbolethModule().getShire())) {
             throw new RuntimeException("Rejecting SAML authentication with unknown Recipient: "
                     + profileResponse.response.getRecipient(), null);
         }
@@ -216,13 +215,15 @@
                         + idpSite.getName(), null);
             buffer.append(handleService);
             buffer.append("?");
+            
+            ShibbolethModule module = getShibbolethModule();
 
             // send language if configured
             // this parameter is passed to the login.jsp on shibboleth idP side,
             // thus must be on the same
             // parameter level as the SHIB_ATTR_TARGET parameter.
-            if (getShibbolethModule().useLanguageInReq()) {
-                String paramNam = getShibbolethModule().getLanguageParamName();
+            if (module.useLanguageInReq()) {
+                String paramNam = module.getLanguageParamName();
                 if (paramNam != null) {
                     buffer.append(paramNam).append("=").append(locale.toString()).append("&");
                 }
@@ -233,10 +234,10 @@
 
             // shire
             buffer.append("&" + SHIB_ATTR_SHIRE + "=");
-            buffer.append(URLEncoder.encode(getShireUrl(), CHARSET));
+            buffer.append(URLEncoder.encode(module.getShire(), CHARSET));
 
             // providerId (if any)
-            String providerId = getShibbolethModule().getProviderId();
+            String providerId = module.getProviderId();
             if (providerId != null) {
                 buffer.append("&" + SHIB_ATTR_PROVIDERID + "=");
                 buffer.append(URLEncoder.encode(providerId, CHARSET));
@@ -267,15 +268,6 @@
      */
 
     protected String getTarget() {
-        return getShireUrl();
-    }
-
-    /**
-     * Return the URL to the SHIRE (that's us)
-     * @param shibbolethPath The shibboleth path.
-     * @return The complete SHIRE URL
-     */
-    protected String getShireUrl() {
         Map objectModel = ContextHelper.getObjectModel(this.context);
         HttpServletRequest req = (HttpServletRequest) objectModel
                 .get(HttpEnvironment.HTTP_REQUEST_OBJECT);

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=581556&r1=581555&r2=581556&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  3 03:19:54 2007
@@ -62,6 +62,7 @@
 
     private static final String WAYF_SERVER = "WayfServer";
     private static final String CONF_PROVIDER_ID = "ProviderId";
+	private static final String CONF_SHIRE = "Shire";
     private static final String CONF_METADATA = "Metadata";
     private static final String CONF_AAP = "AAP";
     private static final String CONF_CHECK_CERTIFICATES = "CheckCertificateValidity";
@@ -73,6 +74,7 @@
     private boolean checkCertificates = false;
     private boolean checkIssuerIP = true;
     private String providerId;
+    private String shire;
 
     private XMLMetadata metadata;
     private XMLAAP aap;
@@ -189,6 +191,8 @@
             getLogger().info("Using providerId: " + providerId);
         else
             getLogger().info("Not using any providerId.");
+        
+        shire = config.getChild(CONF_SHIRE).getValue();
 
         // use language parameter
         String sUseLanguageInReq = config.getChild(CONF_USELANGUAGEINREQ).getValue();
@@ -362,5 +366,9 @@
     public String getWayfServerUrl() {
         return this.wayfServerUrl;
     }
+
+	public String getShire() {
+		return this.shire;
+	}
 
 }

Modified: lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl
URL: http://svn.apache.org/viewvc/lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl?rev=581556&r1=581555&r2=581556&view=diff
==============================================================================
--- lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl (original)
+++ lenya/branches/branch_1_2_x_shibboleth/src/webapp/WEB-INF/cocoon-xconf.xsl Wed Oct  3 03:19:54 2007
@@ -269,6 +269,9 @@
     
     <!-- Please fill-in your providerId. For Shibboleth 1.1, leave providerId empty. -->
     <ProviderId>http://sp.shibtest.org:8080/shibboleth</ProviderId>
+    
+    <!-- The shire or assertion consumer service URL. -->
+    <Shire>http://sp.shibtest.org/default/authoring/index.html?lenya.usecase=login&lenya.step=login</Shire>
     <!-- 
       Location of your list of your supported Home Organisations. May be either an absolute file,
       a file relative to the webapp root or an URI to a file on a web server.



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