rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpie...@apache.org
Subject svn commit: r1174365 - in /incubator/rave/sandbox/science-gateways/rave-cilogon-extensions: ./ src/main/java/org/apache/rave/portal/ src/main/java/org/apache/rave/portal/service/ src/main/java/org/apache/rave/portal/service/impl/ src/main/java/org/apac...
Date Thu, 22 Sep 2011 20:11:02 GMT
Author: mpierce
Date: Thu Sep 22 20:11:01 2011
New Revision: 1174365

URL: http://svn.apache.org/viewvc?rev=1174365&view=rev
Log:
(Rave-277) Updates to rave CILogon project, importing code from the gadget container and doing initial modifications to make work with Rave.

Added:
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/portal/
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/portal/service/
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/portal/service/impl/
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/portal/service/impl/CILogonUserService.java
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonServlet.java
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonSuccessServlet.java
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/utils/
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/utils/X509CertUtil.java
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/file.xml
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/memory.xml
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/postgres.xml
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/applicationContext-security.xml
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/web.xml
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp~
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setup.jsp
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupBasic.jsp
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupDone.jsp
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupErrorPage.jsp
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupFileStore.jsp
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresAdmin.jsp
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresStore.jsp
Modified:
    incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/pom.xml

Modified: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/pom.xml
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/pom.xml?rev=1174365&r1=1174364&r2=1174365&view=diff
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/pom.xml (original)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/pom.xml Thu Sep 22 20:11:01 2011
@@ -164,6 +164,18 @@
 		<version>20090211</version>
 	 </dependency>
 
+	 <dependency>
+		<groupId>org.cilogon</groupId>
+		<artifactId>cilogon-portal-servlet</artifactId>
+		<version>1.0</version>
+		<exclusions>
+		  <exclusion>
+			 <groupId>javax.servlet</groupId>
+			 <artifactId>servlet-api</artifactId>
+		  </exclusion>
+		</exclusions>
+	 </dependency>
+
   </dependencies>
   
   <profiles>
@@ -221,14 +233,13 @@
             <overlay>
               <groupId>org.apache.rave</groupId>
               <artifactId>rave-portal-resources</artifactId>
-              <!-- Example exclusions for files we overrides
+              <!-- Example exclusions for files we override
                    This isn't technically required (as we overlay) but made explicit this way
 						 You can also use this to specify files you plan to omit, such as log4j config
 						 files.
               -->
               <excludes>
 					 <exclude>WEB-INF/applicationContext-security.xml</exclude>
-					 <exclude>WEB-INF/classes/log4j.xmlM</exclude>
               </excludes>
             </overlay>
           </overlays>			 
@@ -241,11 +252,6 @@
 					 <include>*.properties</include>
 				  </includes>
 				</resource>
-				<resource>
-				  <directory>${basedir}/src/main/resources/org/globus/gridshib/resource</directory>
-				  <targetPath>WEB-INF/classes/org/globus/gridshib/resource</targetPath>
-				  <filtering>true</filtering>
-				</resource>
 			 </webResources>
 		  </configuration>
 		</plugin>

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/portal/service/impl/CILogonUserService.java
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/portal/service/impl/CILogonUserService.java?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/portal/service/impl/CILogonUserService.java (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/portal/service/impl/CILogonUserService.java Thu Sep 22 20:11:01 2011
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.rave.portal.service.impl;
+
+import java.util.Date;
+
+import org.apache.rave.portal.model.User;
+import org.apache.rave.portal.repository.UserRepository;
+import org.apache.rave.portal.service.UserService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataAccessException;
+import org.springframework.security.authentication.AbstractAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.context.SecurityContext;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.context.SecurityContextImpl;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+//GSI security imports
+import java.security.cert.X509Certificate;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSException;
+import org.globus.gsi.CertUtil;
+import org.globus.gsi.GlobusCredential;
+import org.globus.gsi.GlobusCredentialException;
+import org.globus.gsi.TrustedCertificates;
+import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
+import org.globus.myproxy.MyProxy;
+import org.globus.myproxy.MyProxyException;
+
+//ProxyManager imports
+import xportlets.proxymanager.ProxyManager;
+import xportlets.proxymanager.ProxyStorageException;
+
+
+/**
+ */
+@Service(value = "cilogonUserService")
+public class CILogonUserService extends DefaultUserService {
+    private static int defaultPort = 7512;
+    private static int defaultLifeTime = 60*24*100;
+	 private static String defaultServer="myproxy.teragrid.org";
+
+    protected static final Logger logger = LoggerFactory.getLogger(CILogonUserService.class);
+    protected UserRepository userRepository;
+
+    // public static String trustedCertsFile = "trustedCAs";
+    private String trustedCertsFile;
+    private X509Certificate[] trustedCertificates = null;
+    private GSSCredential gssCredential = null;
+    protected String myproxyHostname;
+    protected String myproxyUserName;
+    protected String myproxyPassword;
+    protected int myproxyPortNumber;
+    protected int myproxyLifeTime ;    
+	 private String communityCredFile=null;
+
+    @Autowired
+    public CILogonUserService(UserRepository userRepository) {
+		  super(userRepository);
+		  this.userRepository = userRepository;
+		  myproxyHostname=defaultServer;
+		  myproxyLifeTime=defaultLifeTime;
+		  myproxyPortNumber=defaultPort;
+    }
+
+    @Override
+	 public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
+		  //TODO: logger isn't working properly.
+        logger.debug("loadUserByUsername called with: " + username);
+		  logger.info("Running GSI login");
+        final User user = userRepository.getByUsername(username);
+        if(user == null) {
+            throw new UsernameNotFoundException("User with username '" + username + "' was not found!");
+        }
+		  //Do specific CILogon things below
+
+        return user;
+
+	 }
+}
\ No newline at end of file

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonServlet.java
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonServlet.java?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonServlet.java (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonServlet.java Thu Sep 22 20:11:01 2011
@@ -0,0 +1,34 @@
+/**
+ * 
+ */
+package org.apache.rave.security.servlets;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.cilogon.portal.servlets.WelcomeServlet;
+
+/**
+ * @author gerald
+ *
+ */
+public class RaveCILogonServlet extends WelcomeServlet {
+    protected void doIt(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Throwable {
+        PrintWriter writer = httpServletResponse.getWriter();
+        httpServletResponse.setContentType("text/html");
+        writer.println("<html><head><title>Sample Java Delegation Portal</title></head>");
+        writer.println(" <body><H1>A Sample Java Delegation Portal</h1>");
+        // Next line is the important one. Just set the context path and point this to the the startRequest servlet
+        writer.println("<form name=\"input\" action=\""+ httpServletRequest.getContextPath() + "/startRequest\" method=\"get\">");
+        writer.println("Click to request a credential<br><br><input type=\"submit\" value=\"Submit\" />");
+        writer.println("</form>");
+        
+        writer.println("<form action=\"" + httpServletRequest.getContextPath() + "/setup.jsp\" method=\"get\">");
+        writer.println("<input type=\"submit\" value=\"Set up\" />");
+        writer.println("</form>");
+        
+        writer.println("</body></html>");
+    }   
+}

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonSuccessServlet.java
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonSuccessServlet.java?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonSuccessServlet.java (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/servlets/RaveCILogonSuccessServlet.java Thu Sep 22 20:11:01 2011
@@ -0,0 +1,91 @@
+package org.apache.rave.security.servlets;
+
+import java.io.ByteArrayInputStream;
+import java.net.URLDecoder;
+import java.security.Security;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.jce.provider.X509CertificateObject;
+import org.cilogon.portal.CILogonService;
+import org.cilogon.portal.servlets.SuccessServlet;
+import org.cilogon.portal.util.PortalCredentials;
+import org.cilogon.util.CILogon;
+import org.globus.gsi.GlobusCredential;
+import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
+import org.ietf.jgss.GSSCredential;
+
+import xportlets.proxymanager.ProxyManager;
+
+//Rave imports
+import org.apache.rave.portal.service.UserService;
+import org.apache.rave.security.utils.X509CertUtil;
+
+
+public class RaveCILogonSuccessServlet extends SuccessServlet {
+ 
+	 @Autowired
+	 private UserService userService;  //this is the CILogonUser service
+
+	static {
+		if (Security.getProvider("BC") == null)
+			Security.addProvider(new BouncyCastleProvider());
+	}   
+    
+    protected void doIt(HttpServletRequest request, HttpServletResponse response) throws Throwable {
+        Cookie[] cookies = request.getCookies();
+        String identifier = null;
+        for (Cookie cookie : cookies) {
+            if (cookie.getName().equals(CILogon.CERT_REQUEST_ID)) {
+                identifier = cookie.getValue();
+            }
+        }
+        if (identifier == null) {
+            throw new ServletException("Error: No identifier for this delegation request was found. ");
+        }
+
+		  //--------------------------------------------------
+		  // This code should probably go in the CILogonUserService, not here.
+		  //--------------------------------------------------
+        CILogonService cis = new CILogonService();
+        // some configuration
+        cis.setPortalParameters(getPortalParameters());
+        cis.setTStore(getStore());
+        PortalCredentials credential = cis.getCredential(identifier);
+        X509Certificate x509Cert = credential.getX509Certificate();
+        
+        byte[] encodedX509Cert = x509Cert.getEncoded();
+        CertificateFactory certFac = CertificateFactory.getInstance("X.509", "BC");
+        ByteArrayInputStream bais = new ByteArrayInputStream(encodedX509Cert);
+        x509Cert = (X509Certificate)certFac.generateCertificate(bais);
+        bais.close();
+        
+        if (x509Cert instanceof X509CertificateObject) {
+        	System.out.println("got a X509CertificateObject");
+        } else {
+        	System.out.println("not a X509CertificateObject");
+        }
+        System.out.println("ClassLoader is:" +
+        		x509Cert.getClass().getClassLoader().getClass().getSimpleName());
+        
+        GlobusCredential globusCred = new GlobusCredential(credential.getPrivateKey(), new X509Certificate[]{x509Cert});
+        GSSCredential gssCred = new GlobusGSSCredentialImpl(globusCred, GSSCredential.INITIATE_AND_ACCEPT);
+        
+        // TODO: handle incommons as well
+        String openid = X509CertUtil.extractCN(x509Cert);
+		  openid = URLDecoder.decode(openid, "utf-8");
+		  //Store the cilogon proxy with the openid url as the key.
+		  ProxyManager.addProxy(openid, gssCred);
+        
+		  //Should redirect to home.jsp if everything else is ok. 
+    }
+}
+

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/utils/X509CertUtil.java
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/utils/X509CertUtil.java?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/utils/X509CertUtil.java (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/java/org/apache/rave/security/utils/X509CertUtil.java Thu Sep 22 20:11:01 2011
@@ -0,0 +1,31 @@
+/**
+ * 
+ */
+package org.apache.rave.security.utils;
+
+import java.security.cert.X509Certificate;
+
+import javax.security.auth.x500.X500Principal;
+
+/**
+ * @author gerald
+ * This extracts the principal embedded in the X.509 certificate
+ */
+public class X509CertUtil {
+	public static String extractCN(X509Certificate cert) {
+		X500Principal principal = cert.getSubjectX500Principal();
+        String rfc2253dn = principal.getName(X500Principal.RFC2253);
+        String parts[] = rfc2253dn.split(",");
+        for (int i = 0; i < parts.length; ++i) {
+        	String part = parts[i];
+        	String keyvalue[] = part.split("=");
+        	if (keyvalue == null || keyvalue.length != 2)
+        		continue;
+        	String key = keyvalue[0], value = keyvalue[1];
+        	if (key.equalsIgnoreCase("CN")) {
+        		return value;
+        	}
+        }
+        return null;
+	}
+}

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/file.xml
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/file.xml?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/file.xml (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/file.xml Thu Sep 22 20:11:01 2011
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+         xmlns:a="ncsa:cilogon.org,2010:/1.0/configuration/"
+         xmlns:b="ncsa:cilogon.org,2010:/1.0/configuration/ssl/"
+         xmlns:c="ncsa:cilogon.org,2010:/1.0/configuration/fileStore/" 
+         xmlns:d="ncsa:cilogon.org,2010:/1.0/configuration/portal/"
+         xmlns:e="ncsa:cilogon.org,2010:/1.0/configuration/portal#"
+         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
+
+  <rdf:Description rdf:about="ncsa:cilogon.org,2010:/1.0/configuration/rootname#default%20configuration">
+    <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/root/"/>
+    <rdfs:label>default configuration</rdfs:label>
+    <a:hasSSL>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:4366b83d25fad59ecd5e226f13081a02">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/ssl/"/>
+        <b:hostCred>/etc/grid-security/hostcred.pem</b:hostCred>
+        <b:hostKey>/etc/grid-security/hostkey.pem</b:hostKey>
+        <b:keyManagerFactory>SunX509</b:keyManagerFactory>
+        <b:keyStore>/var/www/config/hostcred.p12</b:keyStore>
+        <b:keyStorePassword>keyStorePassword</b:keyStorePassword>
+        <b:keyStoreType>pkcs12</b:keyStoreType>
+        <b:trustRootPath>/etc/grid-security/certificates</b:trustRootPath>
+      </rdf:Description>
+    </a:hasSSL>
+    <a:hasStore>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:3132773a288705127c03889f035dafff">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/fileStore/"/>
+        <c:dataPath>/my/path/to/data</c:dataPath>
+        <c:lookupPath>/my/path/to/lookups</c:lookupPath>
+      </rdf:Description>
+    </a:hasStore>
+    <d:hasPortalParameters>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:3ed7835b25a173c9483bba3313184b69">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/portal/"/>
+        <e:callbackUri>http://sample.portal.org/ready</e:callbackUri>
+        <e:failureUri>http://sample.portal.org/failure</e:failureUri>
+        <e:portalName>Sample delegation portal</e:portalName>
+        <e:successUri>http://sample.portal.org/success</e:successUri>
+        <e:tempDirectory>none</e:tempDirectory>
+      </rdf:Description>
+    </d:hasPortalParameters>
+  </rdf:Description>
+</rdf:RDF>
\ No newline at end of file

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/memory.xml
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/memory.xml?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/memory.xml (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/memory.xml Thu Sep 22 20:11:01 2011
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:a="ncsa:cilogon.org,2010:/1.0/configuration/" xmlns:b="ncsa:cilogon.org,2010:/1.0/configuration/ssl/" xmlns:c="ncsa:cilogon.org,2010:/1.0/configuration/portal/" xmlns:d="ncsa:cilogon.org,2010:/1.0/configuration/portal#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
+  <rdf:Description rdf:about="ncsa:cilogon.org,2010:/1.0/configuration/rootname#default%20configuration">
+    <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/root/"/>
+    <rdfs:label>default configuration</rdfs:label>
+    <a:hasSSL>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:39454cd36a14fada4d39f05f0395462e">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/ssl/"/>
+        <b:hostCred>/etc/grid-security/hostcred.pem</b:hostCred>
+        <b:hostKey>/etc/grid-security/hostkey.pem</b:hostKey>
+        <b:keyManagerFactory>SunX509</b:keyManagerFactory>
+        <b:keyStore>/var/www/config/hostcred.p12</b:keyStore>
+        <b:keyStorePassword>keyStorePassword</b:keyStorePassword>
+        <b:keyStoreType>pkcs12</b:keyStoreType>
+        <b:trustRootPath>/etc/grid-security/certificates</b:trustRootPath>
+      </rdf:Description>
+    </a:hasSSL>
+    <a:hasStore>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:3370394d7ce8888d12de4096ac8d319e">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/memory/"/>
+      </rdf:Description>
+    </a:hasStore>
+    <c:hasPortalParameters>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:206d23fd4830174408e16c649f6d4a06">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/portal/"/>
+        <d:callbackUri>http://sample.portal.org/ready</d:callbackUri>
+        <d:failureUri>http://sample.portal.org/failure</d:failureUri>
+        <d:portalName>Sample delegation portal</d:portalName>
+        <d:successUri>http://sample.portal.org/success</d:successUri>
+        <d:tempDirectory>none</d:tempDirectory>
+      </rdf:Description>
+    </c:hasPortalParameters>
+  </rdf:Description>
+</rdf:RDF>
\ No newline at end of file

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/postgres.xml
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/postgres.xml?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/postgres.xml (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/resources/postgres.xml Thu Sep 22 20:11:01 2011
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:a="ncsa:cilogon.org,2010:/1.0/configuration/" xmlns:b="ncsa:cilogon.org,2010:/1.0/configuration/ssl/" xmlns:c="ncsa:cilogon.org,2010:/1.0/configuration/sqlStore/connection/" xmlns:d="ncsa:cilogon.org,2010:/1.0/configuration/sqlStore/database/" xmlns:e="ncsa:cilogon.org,2010:/1.0/configuration/sqlTable/" xmlns:f="ncsa:cilogon.org,2010:/1.0/configuration/portal/" xmlns:g="ncsa:cilogon.org,2010:/1.0/configuration/portal#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
+  <rdf:Description rdf:about="ncsa:cilogon.org,2010:/1.0/configuration/rootname#default%20configuration">
+    <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/root/"/>
+    <rdfs:label>default configuration</rdfs:label>
+    <a:hasSSL>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:7e5c38fe2bf3f923de277349ff9fbc52">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/ssl/"/>
+        <b:hostCred>/etc/grid-security/hostcred.pem</b:hostCred>
+        <b:hostKey>/etc/grid-security/hostkey.pem</b:hostKey>
+        <b:keyManagerFactory>SunX509</b:keyManagerFactory>
+        <b:keyStore>/var/www/config/hostcred.p12</b:keyStore>
+        <b:keyStorePassword>keyStorePassword</b:keyStorePassword>
+        <b:keyStoreType>pkcs12</b:keyStoreType>
+        <b:trustRootPath>/etc/grid-security/certificates</b:trustRootPath>
+      </rdf:Description>
+    </a:hasSSL>
+    <a:hasStore>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:6c5587a86b8be2dcfcf24346f7cafb7a">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/postgreStore/"/>
+        <a:hasAdminConnection>
+          <rdf:Description rdf:about="ncsa:cilogon.org,2010:7cfea30d6dbef0a0ea90c1ff395de3b6">
+            <c:adminHost>localhost</c:adminHost>
+            <c:adminJdbcDriver>org.postgresql.Driver</c:adminJdbcDriver>
+            <c:adminPassword>changeme</c:adminPassword>
+            <c:adminPort rdf:datatype="http://www.w3.org/2001/XMLSchema#int">5432</c:adminPort>
+            <c:adminUsername>cilogon_admin</c:adminUsername>
+            <c:username>cilogon</c:username>
+          </rdf:Description>
+        </a:hasAdminConnection>
+        <a:hasConnection>
+          <rdf:Description rdf:about="ncsa:cilogon.org,2010:4d86fa15d1f85ed6847abd173a4affe3">
+            <c:host>localhost</c:host>
+            <c:jdbcDriver>org.postgresql.Driver</c:jdbcDriver>
+            <c:password>changeme</c:password>
+            <c:port rdf:datatype="http://www.w3.org/2001/XMLSchema#int">5432</c:port>
+            <c:username>cilogon</c:username>
+          </rdf:Description>
+        </a:hasConnection>
+        <a:hasDatabase>
+          <d:database rdf:about="ncsa:cilogon.org,2010:3db0046580a9ee0fa53f2b0127946a8a">
+            <a:hasTransactionTable>
+              <rdf:Description rdf:about="ncsa:cilogon.org,2010:2a308533f8ffaa152177f63c34f3f186">
+                <e:name>transactions</e:name>
+                <e:prefix>portal</e:prefix>
+              </rdf:Description>
+            </a:hasTransactionTable>
+            <d:databaseName>csd</d:databaseName>
+            <d:schema>cilogon_portal</d:schema>
+          </d:database>
+        </a:hasDatabase>
+      </rdf:Description>
+    </a:hasStore>
+    <f:hasPortalParameters>
+      <rdf:Description rdf:about="ncsa:cilogon.org,2010:64fea90df4655d0bf77bbaf40be427e1">
+        <rdf:type rdf:resource="ncsa:cilogon.org,2010:/1.0/configuration/portal/"/>
+        <g:callbackUri>http://sample.portal.org/ready</g:callbackUri>
+        <g:failureUri>http://sample.portal.org/failure</g:failureUri>
+        <g:portalName>Sample delegation portal</g:portalName>
+        <g:successUri>http://sample.portal.org/success</g:successUri>
+        <g:tempDirectory>none</g:tempDirectory>
+      </rdf:Description>
+    </f:hasPortalParameters>
+  </rdf:Description>
+</rdf:RDF>
\ No newline at end of file

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/applicationContext-security.xml
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/applicationContext-security.xml?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/applicationContext-security.xml (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/applicationContext-security.xml Thu Sep 22 20:11:01 2011
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in
+  ~ compliance with the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+
+<!--
+	This security file uses the default spring simple form login
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:security="http://www.springframework.org/schema/security"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+			    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
+
+  <security:http auto-config="true" use-expressions="true" disable-url-rewriting="true">
+	 <security:intercept-url pattern="/newaccount.jsp*" access="permitAll"/>
+	 <security:intercept-url pattern="/app/newaccount*" access="permitAll"/>
+	 <security:intercept-url pattern="/login.jsp*" filters="none" />
+	 <security:intercept-url pattern="/css/**" access="permitAll"/>
+	 <security:intercept-url pattern="/images/**" access="permitAll"/>
+	 <security:intercept-url pattern="/script/**" access="permitAll"/>
+	 <security:intercept-url pattern="/app/api/rest/callback/*" access="permitAll"/>
+	 
+	 <!-- These are additional open URLs needed by CILogon -->
+	 <security:intercept-url pattern="/ready" access="permitAll"/>
+	 <security:intercept-url pattern="/startRequest" access="permitAll"/>
+	 <security:intercept-url pattern="/success" access="permitAll"/>
+	 <security:intercept-url pattern="/failure" access="permitAll"/>
+	 <security:intercept-url pattern="/cilogon" access="permitAll"/>
+
+	 <!-- all other urls must be authenticated -->
+	 <security:intercept-url pattern="/**"
+									 access="isAuthenticated()"/>
+	 <!-- Set the user service ref here to the implementation you want to use.  The name is
+			defined in the @Service annotation of the corresponding service source code.
+	 -->
+	 <security:openid-login user-service-ref="cilogonUserService">
+		<security:attribute-exchange>
+		  <!-- Supported by MyOpenID.com -->
+		  <security:openid-attribute name="firstName" type="http://schema.openid.net/namePerson/first"/>
+		  <security:openid-attribute name="lastName" type="http://schema.openid.net/namePerson/last"/>
+		  <security:openid-attribute name="email" type="http://schema.openid.net/contact/email" required="true"/>
+		  <!-- security:openid-attribute name="language" type="http://schema.openid.net/language/pref"/>
+				 <security:openid-attribute name="birthDate" type="http://schema.openid.net/birthDate"/>
+				 <security:openid-attribute name="namePerson" type="http://schema.openid.net/namePerson" required="true"/>
+				 <security:openid-attribute name="nickname" type="http://schema.openid.net/namePerson/friendly" required="true"/>
+				 <security:openid-attribute name="country" type="http://schema.openid.net/contact/country/home"/>
+		  -->
+		</security:attribute-exchange>
+	 </security:openid-login>
+	 <security:form-login login-page="/login.jsp" />
+	 <security:logout/>
+  </security:http>
+  
+  <security:authentication-manager>
+	 <!-- Set the user service ref here to the implementation you want to use.  The name is
+			defined in the @Service annotation of the corresponding service source code.
+	 -->
+	 <security:authentication-provider user-service-ref="cilogonUserService">
+		<security:password-encoder ref="passwordEncoder">
+		  <security:salt-source ref="saltSource"/>
+		</security:password-encoder>
+	 </security:authentication-provider>
+  </security:authentication-manager>
+</beans>

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/web.xml?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/WEB-INF/web.xml Thu Sep 22 20:11:01 2011
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  
+  $Id: web.xml 1153583 2011-08-03 17:02:45Z jcian $
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         id="Shindig"
+         version="2.5">
+
+    <display-name>Rave Portal</display-name>
+
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            /WEB-INF/dataContext.xml
+            /WEB-INF/applicationContext.xml
+            /WEB-INF/applicationContext-security.xml
+        </param-value>
+    </context-param>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+
+	 <!-- 
+			This is needed to populate the RequestContextHolder needed by CommunityUserService to
+			get the client's IP address.
+	 -->
+	 <listener>
+		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
+	 </listener>
+
+    <filter>
+        <filter-name>springSecurityFilterChain</filter-name>
+        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+    </filter>
+    <filter-mapping>
+        <filter-name>springSecurityFilterChain</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
+    <!-- Handles all requests into the application -->
+    <servlet>
+        <servlet-name>dispatcher</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+	 <!-- Spring MVC dispatcher servlet mappings -->
+    <servlet-mapping>
+        <servlet-name>dispatcher</servlet-name>
+        <url-pattern>/app/*</url-pattern>
+    </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>dispatcher</servlet-name>
+        <url-pattern>/index.html</url-pattern>
+    </servlet-mapping>
+
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+
+	 <!--Additional servlet mappings required by CILogon-->
+   <servlet>
+        <description>Callback servlet</description>
+        <servlet-name>ready</servlet-name>
+        <servlet-class>org.cilogon.portal.servlets.ReadyServlet</servlet-class>
+        <load-on-startup>0</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>ready</servlet-name>
+        <url-pattern>/ready</url-pattern>
+    </servlet-mapping>
+    
+    <servlet>
+        <description>Request a certificate</description>
+        <display-name>startRequest</display-name>
+        <servlet-name>startRequest</servlet-name>
+        <servlet-class>org.cilogon.portal.servlets.StartRequest</servlet-class>
+        <load-on-startup>0</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>startRequest</servlet-name>
+        <url-pattern>/startRequest</url-pattern>
+    </servlet-mapping>
+     
+    <servlet>
+        <description>Servlet to display success page</description>
+        <display-name>success</display-name>
+        <servlet-name>success</servlet-name>
+        <servlet-class>org.apache.rave.security.servlets.RaveCILogonSuccessServlet</servlet-class>
+        <load-on-startup>0</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>success</servlet-name>
+        <url-pattern>/success</url-pattern>
+    </servlet-mapping>
+     
+    <servlet>
+        <description>failure page</description>
+        <display-name>failure</display-name>
+        <servlet-name>failureServlet</servlet-name>
+        <servlet-class>org.cilogon.portal.servlets.FailureServlet</servlet-class>
+        <load-on-startup>0</load-on-startup>
+    </servlet>
+        <servlet-mapping>
+        <servlet-name>failureServlet</servlet-name>
+        <url-pattern>/failure</url-pattern>
+    </servlet-mapping>
+
+    <servlet>
+        <display-name>weclome</display-name>
+        <servlet-name>welcomeServlet</servlet-name>
+        <servlet-class>org.apache.rave.security.servlets.RaveCILogonServlet</servlet-class>
+        <load-on-startup>0</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>welcomeServlet</servlet-name>
+        <url-pattern>/cilogon</url-pattern>
+    </servlet-mapping>
+
+
+</web-app>
+

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp Thu Sep 22 20:11:01 2011
@@ -0,0 +1,97 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib tagdir="/WEB-INF/tags" prefix="rave"%>
+<fmt:setBundle basename="messages"/>
+
+<fmt:message key="page.login.title" var="pagetitle"/>
+
+<rave:rave_generic_page pageTitle="${pagetitle}">
+<div id="content">
+
+    <h1>${pagetitle}</h1>
+
+    <h2><fmt:message key="page.login.usernamepassword"/></h2>
+	 <a href="cilogon">Use CILogon</a>
+    <form id="loginForm" name="loginForm" action="j_spring_security_check" method="post">
+        <c:if test="${param['authfail'] eq 'form'}">
+            <p class="error"><fmt:message key="page.login.usernamepassword.fail"/></p>
+        </c:if>
+        <fieldset>
+            <p>
+                <label for="usernameField"><fmt:message key="page.general.username"/></label>
+                <input id="usernameField" type="text" name="j_username" autofocus="autofocus"/>
+            </p>
+
+            <p>
+                <label for="passwordField"><fmt:message key="page.general.password"/></label>
+                <input id="passwordField" type="password" name="j_password"/>
+            </p>
+            <p>
+                <label for="remember_me" class="checkboxLabel">
+                    <input type='checkbox' name='_spring_security_remember_me' id="remember_me"
+                           value="true"/>
+                    <fmt:message key="page.login.rememberme"/>
+                </label>
+            </p>
+        </fieldset>
+        <fieldset>
+          <fmt:message key="page.login.usernamepassword.login" var="loginButtonText"/>
+            <input type="submit" value="${loginButtonText}"/>
+        </fieldset>
+    </form>
+    
+    <h2><fmt:message key="page.login.createaccount"/></h2>
+    <form id="newAccount" action="<c:url value="/app/newaccount.jsp"/>" method="get">
+        <fieldset>
+            <p>
+              <label for="createNewAccountButton"><fmt:message key="page.login.createaccount.label"/></label>
+              <fmt:message key="page.login.createaccount.button" var="createAccountButtonText"/>
+              <input id="createNewAccountButton" type="submit" value="${createAccountButtonText}" />
+            </p>
+        </fieldset>
+    </form>
+    
+    <h2><fmt:message key="page.login.openid"/></h2>
+    <form id="oidForm" name='oidf' action='j_spring_openid_security_check' method='POST'>
+        <c:if test="${param['authfail'] eq 'openid'}">
+            <p class="error"><fmt:message key="page.login.openid.fail"/></p>
+        </c:if>
+        <fieldset>
+            <p>
+                <label for="openid_identifier"><fmt:message key="page.login.openid.identifier"/></label>
+                <input type='text' id="openid_identifier" name='openid_identifier' class="long"/>
+            </p>
+            <p>
+                <label for="remember_me_openid" class="checkboxLabel">
+                    <input type='checkbox' name='_spring_security_remember_me' id="remember_me_openid"
+                           value="true"/>
+                  <fmt:message key="page.login.rememberme"/>
+                </label>
+            </p>
+        </fieldset>
+        <fieldset>
+          <fmt:message key="page.login.openid.button" var="openidButtonText"/>
+            <input type="submit" value="${openidButtonText}"/>
+        </fieldset>
+
+    </form>
+</div>
+</rave:rave_generic_page>

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp~
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp%7E?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp~ (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/login.jsp~ Thu Sep 22 20:11:01 2011
@@ -0,0 +1,96 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib tagdir="/WEB-INF/tags" prefix="rave"%>
+<fmt:setBundle basename="messages"/>
+
+<fmt:message key="page.login.title" var="pagetitle"/>
+
+<rave:rave_generic_page pageTitle="${pagetitle}">
+<div id="content">
+
+    <h1>${pagetitle}</h1>
+
+    <h2><fmt:message key="page.login.usernamepassword"/></h2>
+    <form id="loginForm" name="loginForm" action="j_spring_security_check" method="post">
+        <c:if test="${param['authfail'] eq 'form'}">
+            <p class="error"><fmt:message key="page.login.usernamepassword.fail"/></p>
+        </c:if>
+        <fieldset>
+            <p>
+                <label for="usernameField"><fmt:message key="page.general.username"/></label>
+                <input id="usernameField" type="text" name="j_username" autofocus="autofocus"/>
+            </p>
+
+            <p>
+                <label for="passwordField"><fmt:message key="page.general.password"/></label>
+                <input id="passwordField" type="password" name="j_password"/>
+            </p>
+            <p>
+                <label for="remember_me" class="checkboxLabel">
+                    <input type='checkbox' name='_spring_security_remember_me' id="remember_me"
+                           value="true"/>
+                    <fmt:message key="page.login.rememberme"/>
+                </label>
+            </p>
+        </fieldset>
+        <fieldset>
+          <fmt:message key="page.login.usernamepassword.login" var="loginButtonText"/>
+            <input type="submit" value="${loginButtonText}"/>
+        </fieldset>
+    </form>
+    
+    <h2><fmt:message key="page.login.createaccount"/></h2>
+    <form id="newAccount" action="<c:url value="/app/newaccount.jsp"/>" method="get">
+        <fieldset>
+            <p>
+              <label for="createNewAccountButton"><fmt:message key="page.login.createaccount.label"/></label>
+              <fmt:message key="page.login.createaccount.button" var="createAccountButtonText"/>
+              <input id="createNewAccountButton" type="submit" value="${createAccountButtonText}" />
+            </p>
+        </fieldset>
+    </form>
+    
+    <h2><fmt:message key="page.login.openid"/></h2>
+    <form id="oidForm" name='oidf' action='j_spring_openid_security_check' method='POST'>
+        <c:if test="${param['authfail'] eq 'openid'}">
+            <p class="error"><fmt:message key="page.login.openid.fail"/></p>
+        </c:if>
+        <fieldset>
+            <p>
+                <label for="openid_identifier"><fmt:message key="page.login.openid.identifier"/></label>
+                <input type='text' id="openid_identifier" name='openid_identifier' class="long"/>
+            </p>
+            <p>
+                <label for="remember_me_openid" class="checkboxLabel">
+                    <input type='checkbox' name='_spring_security_remember_me' id="remember_me_openid"
+                           value="true"/>
+                  <fmt:message key="page.login.rememberme"/>
+                </label>
+            </p>
+        </fieldset>
+        <fieldset>
+          <fmt:message key="page.login.openid.button" var="openidButtonText"/>
+            <input type="submit" value="${openidButtonText}"/>
+        </fieldset>
+
+    </form>
+</div>
+</rave:rave_generic_page>

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setup.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setup.jsp?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setup.jsp (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setup.jsp Thu Sep 22 20:11:01 2011
@@ -0,0 +1,250 @@
+<%--
+  Date: Aug 4, 2010
+  Time: 9:14:58 AM
+--%>
+<%@ page errorPage="setupErrorPage.jsp" %>
+
+<%@ page import="org.cilogon.config.models.SSLConfigurationModel" %>
+<%@ page import="org.cilogon.portal.config.PortalConfiguration" %>
+<%@ page import="org.cilogon.portal.config.PortalRoot" %>
+<%@ page import="org.cilogon.portal.config.models.PortalParametersModel" %>
+<%@ page import="org.cilogon.portal.storage.PortalStoreFactory" %>
+<%@ page import="org.cilogon.storage.sql.SQLAdmin" %>
+<%@ page import="static org.cilogon.util.AbstractIdentifierFactory.uriRef" %>
+<%@ page import="static org.cilogon.portal.config.PortalVocabulary.HAS_PORTAL_PARAMETERS" %>
+<%@ page import="static org.cilogon.portal.config.PortalVocabulary.PORTAL_CALLBACK_URI" %>
+<%@ page import="static org.cilogon.portal.config.PortalVocabulary.*" %>
+<%@ page import="static org.cilogon.config.Vocabulary.HAS_SSL_CONFIGURATION" %>
+<%@ page import="static org.cilogon.config.Vocabulary.SSL_HOST_CRED" %>
+<%@ page import="static org.cilogon.config.Vocabulary.*" %>
+<%@ page import="static org.cilogon.portal.servlets.ConfigConstants.*" %>
+<%@ page import="static org.cilogon.portal.config.PortalVocabulary.*" %>
+<%@ page import="org.tupeloproject.kernel.OperatorException" %>
+<%@ page import="org.tupeloproject.rdf.Resource" %>
+<%@ page import="java.io.File" %>
+<%@ page import="java.io.IOException" %>
+<%@ page import="java.util.Date" %>
+<%@ page import="java.util.logging.Logger" %>
+
+<%!
+    protected String getParam(HttpServletRequest request, Resource key) {
+        return request.getParameter(key.toString());
+    }
+
+    protected PortalConfiguration getConfig(ServletContext context) throws IOException, OperatorException {
+        File f = new File(context.getRealPath(CONFIG_FILE_PATH + CONFIG_FILE_NAME));
+        //InputStream inputStream = context.getResourceAsStream(CONFIG_FILE_PATH + CONFIG_FILE_NAME);
+        PortalConfiguration portalConfiguration = null;
+        if (f.exists()) {
+            portalConfiguration = new PortalConfiguration(f);
+        } else {
+            portalConfiguration = new PortalConfiguration();
+        }
+        if (portalConfiguration.getRoot() == null) {
+            portalConfiguration.createRoot(uriRef());
+        }
+        return portalConfiguration;
+    }
+
+    protected void saveConfig(ServletContext context, PortalConfiguration portalConfiguration) throws Exception {
+        portalConfiguration.save(); // save it to the context before serializing!!!
+        File f = new File(context.getRealPath(CONFIG_FILE_PATH + CONFIG_FILE_NAME));
+        portalConfiguration.serialize(f);
+    }
+
+    Logger logger;
+
+    public Logger getLogger() {
+        if (logger == null) {
+            logger = Logger.getLogger(getClass().getName());
+        }
+        return logger;
+    }
+
+    public void setLogger(Logger logger) {
+        this.logger = logger;
+    }
+
+    public void say(String x) {
+        String out = getClass().getName() + "(" + (new Date()) + "): " + x;
+        getLogger().info(out);
+
+    }
+%>
+<%
+    PortalConfiguration portalConfiguration = getConfig(application);
+    // Hack to get Tomcat5 to work with java 1.6.
+    System.setProperty("javax.xml.transform.TransformerFactory", "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
+    PortalParametersModel ppm = null;
+    SSLConfigurationModel sslcm = null;
+    PostgresStoreModel postgresStoreModel = null;
+    DatabaseModel currentDatabase = null;
+
+    PortalTransactionTableModel tt = null;
+
+    PortalRoot root = (PortalRoot) portalConfiguration.getRoot();
+    say("got configuration, root = " + root);
+
+    String x = request.getParameter(CONFIG_STATUS);
+    int operation = -1;
+    if (x != null) {
+        operation = Integer.parseInt(x);
+    }
+    // read off the portal's path and point all form actions back to this jsp page.
+    String actionToTake = request.getContextPath() + "/setup.jsp";
+    String setupDoneAction = request.getContextPath() + "/startRequest";
+
+
+    switch (operation) {
+        default:
+        case NO_OP:
+            // Nothing has been done yet, so start with the base page
+%>
+<%@ include file="setupBasic.jsp" %>
+<%
+        break;
+    case BASIC:
+        if (request.getParameter(STORE_TYPE) == null) {
+            // FIXME no store selected.
+        }
+
+        // Basic setup (portal parameters) has been done. Store results, move on to next
+        ppm = root.getPortalParametersModel();
+        ppm.setCallback(getParam(request, PORTAL_CALLBACK_URI));
+        ppm.setSuccess(getParam(request, PORTAL_SUCCESS_URI));
+        ppm.setFailure(getParam(request, PORTAL_FAILURE_URI));
+        ppm.setName(getParam(request, PORTAL_NAME));
+
+        sslcm = root.getSSLConfiguration();
+        if (getParam(request, SSL_HOST_CRED) != null) {
+            sslcm.setHostCred(getParam(request, SSL_HOST_CRED));
+        }
+        if (getParam(request, SSL_HOST_KEY) != null) {
+            sslcm.setHostKey(getParam(request, SSL_HOST_KEY));
+        }
+        if (getParam(request, SSL_TRUST_ROOT_PATH) != null) {
+            sslcm.setTrustRootPath(getParam(request, SSL_TRUST_ROOT_PATH));
+        }
+        sslcm.setKeyManagerFactory(getParam(request, SSL_KEY_MANAGER_FACTORY));
+        sslcm.setKeyStore(getParam(request, SSL_KEYSTORE));
+        sslcm.setKeyStorePassword(getParam(request, SSL_KEYSTORE_PASSWORD));
+        sslcm.setKeyStoreType(getParam(request, SSL_KEYSTORE_TYPE));
+        saveConfig(application, portalConfiguration);
+
+
+        // Saved basic state. Now see if we have to configure a store. Check the store type the user selected.
+        if (request.getParameter(STORE_TYPE).equals(PortalVocabulary.POSTGRES_STORE_TYPE.toString())) {
+%>
+<%@ include file="setupPostgresStore.jsp" %>
+<%
+    }
+
+    if (request.getParameter(STORE_TYPE).equals(PortalVocabulary.FILE_STORE_TYPE.toString())) {
+        say("Starting file store config");
+%>
+<%@ include file="setupFileStore.jsp" %>
+<%
+    }
+
+    if (request.getParameter(STORE_TYPE).equals(PortalVocabulary.MEMORY_STORE_TYPE.toString())) {
+        // FIXME if it has some other type fo store, replace it with a memory store.
+        StoreModel sm0 = root.getStore();
+        boolean createMemoryStore = true;
+        if (sm0 != null) {
+            if (!sm0.isA(MEMORY_STORE_TYPE)) {
+                root.removeStore(sm0);
+                createMemoryStore = true;
+            } else {
+                createMemoryStore = false;
+            }
+        }
+        if (createMemoryStore) {
+            MemoryStoreModel msm = portalConfiguration.createMemoryStore();
+            root.setStore(msm);
+        }
+
+        saveConfig(application, portalConfiguration);
+%>
+<%@ include file="setupDone.jsp" %>
+<%
+        }
+
+
+        break;
+    case POSTGRES_STORE_SETUP:
+        // Case is that the user has configured a postgres store. Save the information.
+        postgresStoreModel = new PostgresStoreModel(root.getStore());
+        ConnectionParametersModel cpm = postgresStoreModel.getConnectionParametersModel();
+        cpm.setUserName(getParam(request, CONNECTION_USERNAME));
+        cpm.setPassword(getParam(request, CONNECTION_PASSWORD));
+        cpm.setHost(getParam(request, CONNECTION_HOST));
+        String tempInt = getParam(request, CONNECTION_PORT);
+        if (tempInt != null) {
+            try {
+                cpm.setPort(Integer.parseInt(tempInt));
+            } catch (NumberFormatException nfe) {
+                // can't do anything...
+            }
+        }
+        cpm.setDriver(getParam(request, CONNECTION_DRIVER));
+
+        AdminConnectionParametersModel acpm = postgresStoreModel.getAdminConnectionParametersModel();
+        acpm.setAdminUserName(getParam(request, CONNECTION_ADMIN_USERNAME));
+        acpm.setAdminPassword(getParam(request, CONNECTION_ADMIN_PASSWORD));
+        acpm.setAdminHost(getParam(request, CONNECTION_ADMIN_HOST));
+        tempInt = getParam(request, CONNECTION_ADMIN_PORT);
+        if (tempInt != null) {
+            try {
+                acpm.setAdminPort(Integer.parseInt(tempInt));
+            } catch (NumberFormatException nfe) {
+                // can't do anything...
+            }
+        }
+
+        acpm.setAdminUserName(getParam(request, CONNECTION_ADMIN_USERNAME));
+        acpm.setDriver(getParam(request, CONNECTION_ADMIN_DRIVER));
+        saveConfig(application, portalConfiguration);
+%>
+<%@ include file="setupPostgresAdmin.jsp" %>
+<%
+
+        break;
+    case POSTGRES_ADMIN:
+        PortalStoreFactory portalStoreFactory = PortalStoreFactory.INSTANCE;
+        portalStoreFactory.setConfiguration(portalConfiguration);
+        SQLAdmin ppa = portalStoreFactory.getPortalAdmin();
+        String pgAdminAction = request.getParameter(ConfigConstants.POSTGRES_ADMIN_ACTION);
+        if (pgAdminAction == null || pgAdminAction.length() == 0) {
+            // Nothing selected.
+            // do nothing
+        } else {
+            if (pgAdminAction.equals(POSTGRES_ADMIN_CLEAR)) {
+                ppa.init();
+            }
+            if (pgAdminAction.equals(POSTGRES_ADMIN_DESTROY)) {
+                ppa.destroy();
+            }
+
+            if (pgAdminAction.equals(POSTGRES_ADMIN_INITIALIZE)) {
+                ppa.init();
+            }
+        }
+
+%>
+<%@ include file="setupDone.jsp" %>
+<%
+
+        break;
+    case FILE_STORE_SETUP:
+        FileStoreModel fsm = new FileStoreModel(root.getStore());
+        fsm.setDataPath(getParam(request, FILE_DATA_PATH));
+        fsm.setLookup(getParam(request, FILE_LOOKUP_PATH));
+        saveConfig(application, portalConfiguration);
+%>
+<%@ include file="setupDone.jsp" %>
+<%
+            break;
+
+    }
+%>
+

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupBasic.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupBasic.jsp?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupBasic.jsp (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupBasic.jsp Thu Sep 22 20:11:01 2011
@@ -0,0 +1,123 @@
+<%--
+  Created by IntelliJ IDEA.
+  User: ncsa
+  Date: Aug 5, 2010
+  Time: 9:41:22 AM
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page errorPage="setupErrorPage.jsp" %>
+<%@ page import="org.cilogon.portal.util.PortalParameters" %>
+<%@ page import="org.cilogon.util.SSLConfiguration" %>
+<%@ page import="static org.cilogon.portal.config.PortalVocabulary.*" %>
+<%@ page import="static org.cilogon.portal.servlets.ConfigConstants.*" %>
+
+<%
+    if (root.hasA(HAS_PORTAL_PARAMETERS)) {
+        ppm = root.getPortalParametersModel();
+    } else {
+        ppm = portalConfiguration.createPortalParameters();
+        root.setPortalParametersModel(ppm);
+        ppm.setCallback("http://" + request.getServerName() + request.getContextPath() + "/ready");
+        ppm.setFailure("http://" + request.getServerName() + request.getContextPath() + "/failure");
+        ppm.setSuccess("http://" + request.getServerName() + request.getContextPath() + "/success");
+    }
+    PortalParameters pp = ppm.toPortalParameters();
+
+    // fiddle with the context paths to make this look about right. Not perfect, but should save the
+    // user some typing.
+
+
+    // stick it in a bean for future use
+
+    if (root.hasA(HAS_SSL_CONFIGURATION)) {
+        sslcm = root.getSSLConfiguration();
+    } else {
+        sslcm = portalConfiguration.createSSLConfiguration();
+        root.setSSLConfiguration(sslcm);
+    }
+    SSLConfiguration sslCfg = sslcm.getConfiguration();
+    // regardless of what we do, we should save our state before continuing.
+    saveConfig(application, portalConfiguration);
+
+%>
+<html>
+<head><title>Setup</title></head>
+<body>
+<h2>CILogon Delegation Service Configuration</h2>
+
+<form action="<%= actionToTake %>" method="GET">
+    <table>
+        <tr>
+            <td ALIGN="right">The callback URL:</td>
+            <td><input type="text" size="100" name="<%= PORTAL_CALLBACK_URI %>" value=<%= pp.getCallback() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">The success URL:</td>
+            <td><input type="text" size="100" name="<%= PORTAL_SUCCESS_URI %>" value=<%= pp.getSuccess() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">The failure URL:</td>
+            <td><input type="text" size="100" name="<%= PORTAL_FAILURE_URI %>" value=<%= pp.getFailure() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">The name of this portal:</td>
+            <td><input type="text" size="100" name="<%= PORTAL_NAME %>" value=<%= pp.getName() %> /></td>
+        </tr>
+    </table>
+
+    <H3>Security configuration</h3>
+
+    <p>In order for portals to verify that they are talking to the CILogon service. This section contains the
+        configuration information for that.</p>
+    <table>
+      <tr>
+            <td ALIGN="right">The path to the keystore:</td>
+            <td><input type="text" size="100" name="<%= SSL_KEYSTORE %>" value=<%= sslCfg.getKeystore() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">The key store password:</td>
+            <td><input type="text" size="100" name="<%= SSL_KEYSTORE_PASSWORD %>"
+                       value=<%= sslCfg.getKeystorePassword() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">The key manager factory:</td>
+            <td><input type="text" size="100" name="<%= SSL_KEY_MANAGER_FACTORY %>"
+                       value=<%= sslCfg.getKeyManagerFactory() %> /></td>
+        </tr>
+
+        <tr>
+            <td ALIGN="right">The keystore type:</td>
+            <td><input type="text" size="100" name="<%= SSL_KEYSTORE_TYPE %>" value=<%= sslCfg.getKeystoreType() %> />
+            </td>
+        </tr>
+<!--        <tr>
+            <td ALIGN="right">The path to host credential:</td>
+            <td><input type="text" size="100" name="<%= SSL_HOST_CRED %>" value=<%= sslCfg.getHostCred() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">The path to the host key:</td>
+            <td><input type="text" size="100" name="<%= SSL_HOST_KEY %>" value=<%= sslCfg.getHostKey() %> /></td>
+        </tr>
+
+        <tr>
+            <td ALIGN="right">The trusted root path:</td>
+            <td><input type="text" size="100" name="<%= SSL_TRUST_ROOT_PATH %>" value=<%= sslCfg.getTrustrootPath() %> />
+            </td>
+        </tr>
+        -->
+    </table>
+
+    <h3>Select the type of the store</h3>
+
+    <input type="radio" name="<%= STORE_TYPE %>" value="<%= MEMORY_STORE_TYPE %>" checked />Memory<br/>
+    <input type="radio" name="<%= STORE_TYPE %>" value="<%= FILE_STORE_TYPE %>"/>File<br/>
+    <input type="radio" name="<%= STORE_TYPE %>" value="<%= POSTGRES_STORE_TYPE %>"/>Postgres<br/>
+    <input type="submit" value="Submit"/>
+
+    <input type="hidden" id="<%= CONFIG_STATUS %>" name=<%= CONFIG_STATUS %> value="<%= BASIC %>" />
+
+</form>
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupDone.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupDone.jsp?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupDone.jsp (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupDone.jsp Thu Sep 22 20:11:01 2011
@@ -0,0 +1,20 @@
+<%--
+  Date: Aug 7, 2010
+  Time: 9:09:42 AM
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+%>
+<html>
+<head><title>Setup is complete</title></head>
+<body>
+<h2>Setup is complete!</h2>
+
+<p>You have finished setting up your delegation service and it should be ready for use.</p>
+
+<form name="input" action="<%= setupDoneAction %>" method="get">
+    Click to request a credential<br><br>
+    <input type="submit" value="Submit"/>
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupErrorPage.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupErrorPage.jsp?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupErrorPage.jsp (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupErrorPage.jsp Thu Sep 22 20:11:01 2011
@@ -0,0 +1,36 @@
+<%@ page import="java.io.PrintWriter" %>
+<%@ page import="java.io.StringWriter" %>
+<%--
+  Really basic error page.
+  Date: Aug 5, 2010
+  Time: 2:17:49 PM
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page isErrorPage="true" %>
+<html>
+<body>
+<h1>
+    Error Page
+</h1>
+<hr>
+<h2>
+    Received the exception:<br>
+    <font color=red>
+        <%= exception.toString()   %>
+    </font>
+</h2>
+
+<%
+    out.println("<!--");
+    StringWriter sw = new StringWriter();
+    PrintWriter pw = new PrintWriter(sw);
+    exception.printStackTrace(pw);
+    out.println(sw);
+
+    sw.close();
+    pw.close();
+    out.println("-->");
+%>
+<%= sw.toString() %>
+</body>
+</html>

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupFileStore.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupFileStore.jsp?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupFileStore.jsp (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupFileStore.jsp Thu Sep 22 20:11:01 2011
@@ -0,0 +1,74 @@
+<%--
+  Created by IntelliJ IDEA.
+  User: ncsa
+  Date: Aug 7, 2010
+  Time: 9:14:32 AM
+  To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page import="org.cilogon.portal.servlets.ConfigConstants" %>
+<%@ page import="static org.cilogon.portal.config.PortalVocabulary.*" %>
+
+
+<%
+    FileStoreModel fileStoreModel = null;
+    String dataPath = null;
+    String indexPath = null;
+    boolean createFileStore = true;
+    say("starting file store setup");
+    StoreModel storeModel1 = root.getStore();
+    if (storeModel1 != null) {
+        // FIXME. Better logic in case the user changes his or her mind about the store type. So there might be some other store here to replace.
+        if (!storeModel1.isA(FILE_STORE_TYPE)) {
+            root.removeStore(storeModel1);
+            createFileStore = true;
+        } else {
+            fileStoreModel =
+                    (FileStoreModel) portalConfiguration.getMyThingSession().fetchThing(root.getStore().getSubject(), FileStoreModel.class);
+             createFileStore = false;
+        }
+    }
+    if (createFileStore) {
+        say("creatin new store");
+        fileStoreModel = portalConfiguration.createFileStore(application.getRealPath(CONFIG_FILE_PATH + TEMP_DIRECTORY_NAME));
+        root.setStore(fileStoreModel);
+        // we will set the defaults here
+    }
+    saveConfig(application, portalConfiguration);
+
+    dataPath = fileStoreModel.getDataPath();
+    indexPath = fileStoreModel.getLookup();
+%>
+<html>
+<head><title>File store setup</title></head>
+<body>
+<h3>Configuring the file store.</h3>
+
+<p>This requires two paths. The first is a directory where transactions will be stored and the second is for
+    indices. The defaults will place these in the current WEB-INF directory, which should be sufficient for
+    most cases.<br>
+    <b><i>Note</i></b>: If the paths do not exist, they will be created as needed. Be sure you have proper permissions for any
+    directories you list
+
+</p>
+
+<form action="<%= actionToTake %>" method="GET">
+    <table>
+        <tr>
+            <td ALIGN="right">Data directory:</td>
+            <td><input type="text" size="100" name="<%= FILE_DATA_PATH %>" value=<%= dataPath %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Index directory:</td>
+            <td><input type="text" size="100" name="<%= FILE_LOOKUP_PATH %>" value=<%= indexPath %> />
+            </td>
+        </tr>
+    </table>
+    <input type="submit" value="Submit"/>
+    <input type="hidden" id="<%= ConfigConstants.CONFIG_STATUS %>"
+           name=<%= ConfigConstants.CONFIG_STATUS %> value="<%= ConfigConstants.FILE_STORE_SETUP %>" />
+
+</form>
+</body>
+</html>
\ No newline at end of file

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresAdmin.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresAdmin.jsp?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresAdmin.jsp (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresAdmin.jsp Thu Sep 22 20:11:01 2011
@@ -0,0 +1,30 @@
+<%--
+  User: Jeff Gaynor
+  Date: Aug 10, 2010
+  Time: 9:38:35 AM
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page errorPage="setupErrorPage.jsp" %>
+<%@ page import="static org.cilogon.portal.config.PortalVocabulary.*" %>
+<%@ page import="static org.cilogon.portal.servlets.ConfigConstants.*" %>
+
+<%
+
+%>
+<html>
+  <head><title>Simple jsp page</title></head>
+  <body>
+  <form action="<%= actionToTake %>" method="GET">
+        <h3>Administrative actions</h3>
+   <p>The options allow you to clear the store, drop it or (re)-initialize the store.</p>
+      
+  <input type="radio" name="<%= POSTGRES_ADMIN_ACTION %>" value="<%= POSTGRES_ADMIN_CLEAR %>" />Clear the store: Remove all entries from an existing store<br/>
+  <input type="radio" name = "<%= POSTGRES_ADMIN_ACTION %>" value="<%= POSTGRES_ADMIN_INITIALIZE %>"/>Initialize the store: (Re)create the store.<br/>
+  <input type="radio" name="<%= POSTGRES_ADMIN_ACTION %>" value="<%= POSTGRES_ADMIN_DESTROY %>"/>Remove the store completely.<br/>
+  <input type="submit" value="Submit" />
+
+  <input type="hidden" id="<%= CONFIG_STATUS %>" name=<%= CONFIG_STATUS %> value="<%= POSTGRES_ADMIN %>" />
+      </form>
+
+  </body>
+</html>
\ No newline at end of file

Added: incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresStore.jsp
URL: http://svn.apache.org/viewvc/incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresStore.jsp?rev=1174365&view=auto
==============================================================================
--- incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresStore.jsp (added)
+++ incubator/rave/sandbox/science-gateways/rave-cilogon-extensions/src/main/webapp/setupPostgresStore.jsp Thu Sep 22 20:11:01 2011
@@ -0,0 +1,191 @@
+<%--
+  Setup whatever storage is required by the user.
+  Date: Aug 5, 2010
+  Time: 10:09:53 AM
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page import="org.cilogon.config.models.*" %>
+<%@ page import="org.cilogon.portal.config.PortalVocabulary" %>
+<%@ page import="org.cilogon.portal.config.models.PortalTransactionTableModel" %>
+<%@ page import="org.cilogon.portal.servlets.ConfigConstants" %>
+<%@ page import="org.cilogon.storage.impl.postgres.PostgresAdminConnectionParameters" %>
+<%@ page import="static org.cilogon.config.CLITools.prompt" %>
+<%@ page import="org.cilogon.storage.impl.postgres.PostgresConnectionParameters" %>
+<%@ page import="org.cilogon.util.AbstractIdentifierFactory" %>
+<%@ page import="java.util.Iterator" %>
+
+
+<%
+    boolean createPGStore = true;
+    StoreModel sm = root.getStore();
+    if (sm != null) {
+        if (!sm.isA(POSTGRES_STORE_TYPE)) {
+            root.removeStore(sm);
+            createPGStore = true;
+        } else {
+            postgresStoreModel = (PostgresStoreModel) portalConfiguration.getMyThingSession().fetchThing(root.getStore().getSubject(), PostgresStoreModel.class);
+            createPGStore = false;
+        }
+    }
+        if (createPGStore) {
+            postgresStoreModel = portalConfiguration.createPostgresStore();
+            root.setStore(postgresStoreModel);
+        }
+
+
+        Iterator<DatabaseModel> it = postgresStoreModel.getDatabases().iterator();
+        if (it.hasNext()) {
+            currentDatabase = it.next();
+            tt = (PortalTransactionTableModel) currentDatabase.fetchThingByPredicate(currentDatabase.getTransactionTable().getSubject(), PortalTransactionTableModel.class);
+        } else {
+            currentDatabase = portalConfiguration.createDatabase();
+            postgresStoreModel.addDatabase(currentDatabase);
+            tt = (PortalTransactionTableModel) portalConfiguration.getMyThingSession().fetchThing(AbstractIdentifierFactory.uriRef(), PortalTransactionTableModel.class);
+            tt.setPrefix("portal");
+            tt.setName("transactions");
+
+            currentDatabase.setTransactionTable(tt);
+        }
+
+        String dbName = currentDatabase.getName();
+        String dbSchema = currentDatabase.getSchema();
+        String ttName = tt.getName();
+        String ttPrefix = tt.getPrefix();
+
+%>
+
+<html>
+<head><title>Setup</title></head>
+<body>
+<h2>CILogon Delegation Store Configuration</h2>
+
+<form action="<%= actionToTake %>" method="GET">
+
+    <h3>Specify the name, schema and table name. </h3>
+
+    <p>Before creating the table, you must have created the database and users. The portal configuration
+       allows for a separate administrator for the database who is different from the regular user.
+       You may set these equal if your system is configured differently.
+    </p>
+
+    <p>The table prefix is optional and will be used if specified. E.g. if it is 'x' and the table name is
+        'transactions' then
+        the system will create and use the table named 'x_transactions'. This is very useful in cases where multiple
+        portals
+        live on the same system.
+    </p>
+    <table>
+        <tr>
+            <td ALIGN="right">Database name:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.SQL_DATABASE_NAME %>" value=<%= dbName %> />
+            </td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Database schema:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.SQL_DATABASE_SCHEMA %>" value=<%= dbSchema %> />
+            </td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Table name:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.SQL_TABLE_NAME %>" value=<%= ttName %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Table prefix (opt.):</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.SQL_TABLE_PREFIX %>" value=<%= ttPrefix %> />
+            </td>
+        </tr>
+    </table>
+
+    <%
+        PostgresConnectionParameters pcp = new PostgresConnectionParameters();
+        if (postgresStoreModel.hasA(HAS_CONNECTION)) {
+            postgresStoreModel.getConnectionParametersModel().toConnectionParameters(pcp);
+        } else {
+            ConnectionParametersModel cpm = portalConfiguration.createConnectionParameters();
+            postgresStoreModel.setConnectionParameters(cpm);
+            cpm.toConnectionParameters(pcp);
+        }
+    %>
+    <h3>Connection setup</h3>
+
+    <p>This will set up access for the user who will run the application.</p>
+    <table>
+        <tr>
+            <td ALIGN="right">Username:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_USERNAME%>"
+                       value=<%= pcp.getUsername() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Password:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_PASSWORD %>"
+                       value=<%= pcp.getPassword() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Hostname</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_HOST %>"
+                       value=<%= pcp.getHost() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Port:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_PORT%>" value=<%= pcp.getPort() %> />
+            </td>
+        </tr>
+        <tr>
+            <td ALIGN="right">JDBC driver:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_DRIVER %>"
+                       value=<%= pcp.getJdbcDriver() %> /></td>
+        </tr>
+    </table>
+
+    <%
+        PostgresAdminConnectionParameters pacp = new PostgresAdminConnectionParameters();
+
+        if (postgresStoreModel.hasA(HAS_ADMIN_CONNECTION)) {
+            postgresStoreModel.getAdminConnectionParametersModel().toAdminConnectionParameters(pacp);
+        } else {
+            AdminConnectionParametersModel acpm = portalConfiguration.createAdminConnectionParameters();
+            postgresStoreModel.setAdminConnectionParameters(acpm);
+            acpm.toAdminConnectionParameters(pacp);
+        }
+        saveConfig(application, portalConfiguration);
+
+    %>
+    <H3>Database user setup</h3>
+
+    <p>This will set up access for the database administrator.</p>
+    <table>
+        <tr>
+            <td ALIGN="right">Admin username:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_ADMIN_USERNAME %>"
+                       value=<%= pacp.getUsername() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Admin password:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_ADMIN_PASSWORD %>"
+                       value=<%= pacp.getPassword() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Admin hostname:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_ADMIN_HOST %>"
+                       value=<%= pacp.getHost() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Admin port:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_ADMIN_PORT %>"
+                       value=<%= pacp.getPort() %> /></td>
+        </tr>
+        <tr>
+            <td ALIGN="right">Admin JDBC driver:</td>
+            <td><input type="text" size="100" name="<%= PortalVocabulary.CONNECTION_ADMIN_DRIVER %>"
+                       value=<%= pacp.getJdbcDriver() %> /></td>
+        </tr>
+    </table>
+
+    <input type="submit" value="Submit"/>
+    <input type="hidden" id="<%= ConfigConstants.CONFIG_STATUS %>"
+           name=<%= ConfigConstants.CONFIG_STATUS %> value="<%= ConfigConstants.POSTGRES_STORE_SETUP %>" />
+
+</form>
+
+</body>
+</html>
\ No newline at end of file



Mime
View raw message