Author: ruchith
Date: Thu Dec 13 21:49:34 2007
New Revision: 11103

Log:

Added keystore browser code from https://wso2.org/repos/wso2/people/ruchith/kse

Added:
   trunk/commons/ksb/
   trunk/commons/ksb/pom.xml
   trunk/commons/ksb/src/
   trunk/commons/ksb/src/main/
   trunk/commons/ksb/src/main/java/
   trunk/commons/ksb/src/main/java/org/
   trunk/commons/ksb/src/main/java/org/wso2/
   trunk/commons/ksb/src/main/java/org/wso2/tools/
   trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/
   
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/KSExplorerConstants.java
   
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/KeyStoreDescription.java
   trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/
   
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/ShowMainAction.java
   
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/ShowPEMPrivateKeyAction.java
   
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/UploadKeyStoreAction.java
   trunk/commons/ksb/src/main/java/struts.properties
   trunk/commons/ksb/src/main/java/struts.xml
   trunk/commons/ksb/src/main/resources/
   trunk/commons/ksb/src/main/resources/org/
   trunk/commons/ksb/src/main/resources/org/wso2/
   trunk/commons/ksb/src/main/resources/org/wso2/solutions/
   trunk/commons/ksb/src/main/resources/org/wso2/solutions/identity/
   trunk/commons/ksb/src/main/resources/org/wso2/solutions/identity/admin/
   trunk/commons/ksb/src/main/resources/org/wso2/solutions/identity/admin/ui/
   
trunk/commons/ksb/src/main/resources/org/wso2/solutions/identity/admin/ui/action/
   
trunk/commons/ksb/src/main/resources/org/wso2/solutions/identity/admin/ui/action/LoginAction-validation.xml
   trunk/commons/ksb/src/main/webapp/
   trunk/commons/ksb/src/main/webapp/WEB-INF/
   trunk/commons/ksb/src/main/webapp/WEB-INF/web.xml
   trunk/commons/ksb/src/main/webapp/css/
   trunk/commons/ksb/src/main/webapp/css/styles.css
   trunk/commons/ksb/src/main/webapp/images/
   trunk/commons/ksb/src/main/webapp/images/loading.gif   (contents, props 
changed)
   trunk/commons/ksb/src/main/webapp/index.html
   trunk/commons/ksb/src/main/webapp/jsp/
   trunk/commons/ksb/src/main/webapp/jsp/main.jsp
   trunk/commons/ksb/src/main/webapp/jsp/showpem.jsp

Added: trunk/commons/ksb/pom.xml
==============================================================================
--- (empty file)
+++ trunk/commons/ksb/pom.xml   Thu Dec 13 21:49:34 2007
@@ -0,0 +1,151 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+    <groupId>org.wso2.tools.kse</groupId>
+    <artifactId>kse</artifactId>
+    <version>SNAPSHOT</version>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>war</packaging>
+    <name>WSO2 Keystore explorer</name>
+
+    <repositories>
+        <repository>
+            <releases>
+                <enabled>false</enabled>
+                <updatePolicy>always</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+                <checksumPolicy>fail</checksumPolicy>
+            </snapshots>
+            <id>apache-snapshots</id>
+            <name>Apache Maven2 SNAPSHOTS</name>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+            <layout>default</layout>
+        </repository>
+        <repository>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>always</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </snapshots>
+            <id>apache-ws-snapshots2</id>
+            <name>Apache ws.zones - 2</name>
+            <url>http://ws.zones.apache.org/repository2</url>
+        </repository>
+
+        <repository>
+            <releases>
+                <enabled>true</enabled>
+                <updatePolicy>always</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+                <updatePolicy>never</updatePolicy>
+                <checksumPolicy>warn</checksumPolicy>
+            </snapshots>
+            <id>wso2-maven2-repo</id>
+            <name>wso2.org maven2 repo</name>
+            <url>http://dist.wso2.org/maven2</url>
+        </repository>
+    </repositories>
+
+
+    <pluginRepositories>
+        <pluginRepository>
+            <id>snapshot-apache</id>
+            <name>Apache Snapshot repository</name>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+        </pluginRepository>
+
+        <pluginRepository>
+            <id>snapshot</id>
+            <name>Snapshot repository</name>
+            <url>http://snapshots.maven.codehaus.org/maven2</url>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+        </pluginRepository>
+
+    </pluginRepositories>
+
+
+       <build>
+               <sourceDirectory>src/main/java</sourceDirectory>
+               <testSourceDirectory>src/test/java</testSourceDirectory>
+               <resources>
+                       <resource>
+                               <directory>src/main/java</directory>
+                       </resource>
+               </resources>
+
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <configuration>
+                                       <source>1.4</source>
+                                       <target>1.4</target>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>jsp-api</artifactId>
+            <version>2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.struts</groupId>
+            <artifactId>struts2-core</artifactId>
+            <version>2.0.9</version>
+        </dependency>
+               <dependency>
+            <groupId>opensymphony</groupId>
+            <artifactId>ognl</artifactId>
+            <version>2.6.11</version>
+        </dependency>
+               <dependency>
+            <groupId>opensymphony</groupId>
+            <artifactId>xwork</artifactId>
+            <version>2.0.4</version>
+        </dependency>
+           <dependency>
+               <groupId>commons-collections</groupId>
+               <artifactId>commons-collections</artifactId>
+               <version>3.1</version>
+           </dependency>
+           <dependency>
+               <groupId>commons-io</groupId>
+               <artifactId>commons-io</artifactId>
+               <version>1.2</version>
+           </dependency>
+               <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+    </dependencies>
+</project>

Added: 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/KSExplorerConstants.java
==============================================================================
--- (empty file)
+++ 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/KSExplorerConstants.java
  Thu Dec 13 21:49:34 2007
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.wso2.tools.ksexplorer;
+
+public class KSExplorerConstants {
+
+    public final static String SESSION_KEY_KS = "keystores";
+    public final static String PARAM_STORE_TYPE = "storeType";
+    public final static String PARAM_STORE_PASSWORD = "storePasswd";
+    
+}

Added: 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/KeyStoreDescription.java
==============================================================================
--- (empty file)
+++ 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/KeyStoreDescription.java
  Thu Dec 13 21:49:34 2007
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.wso2.tools.ksexplorer;
+
+import java.security.KeyStore;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.UUID;
+
+public class KeyStoreDescription {
+
+    private KeyStore keyStore;
+    
+    private String name;
+
+    private String uuid;
+    
+    public KeyStoreDescription(KeyStore store, String name) {
+        this.keyStore = store;
+        this.name = name;
+        this.uuid = UUID.randomUUID().toString();
+    }
+    
+    public String getStoreType() {
+        return this.keyStore.getType();
+    }
+    
+    public List getPrivateKeys() throws Exception {
+        ArrayList list = new ArrayList();
+        
+        Enumeration aliases = this.keyStore.aliases();
+        while (aliases.hasMoreElements()) {
+            String alias = (String) aliases.nextElement();
+            if(this.keyStore.isKeyEntry(alias)) {
+                list.add(new Cert(alias, (X509Certificate) this.keyStore
+                        .getCertificate(alias)));
+            }
+        }
+        
+        return list;
+    }
+
+    public List getCertificates() throws Exception {
+        ArrayList list = new ArrayList();
+        
+        Enumeration aliases = this.keyStore.aliases();
+        while (aliases.hasMoreElements()) {
+            String alias = (String) aliases.nextElement();
+            if(this.keyStore.isCertificateEntry(alias)) {
+                list.add(new Cert(alias, (X509Certificate) this.keyStore
+                        .getCertificate(alias)));
+            }
+        }
+        
+        return list;
+    }
+    
+    public String getAlias(Certificate cert) {
+        return this.getAlias(cert);
+    }
+    
+    public String getName() {
+        return this.name;
+    }
+    
+    class Cert {
+        
+        private String alias;
+        private X509Certificate cert;
+        
+        public Cert(String alias, X509Certificate cert) {
+            this.alias = alias;
+            this.cert = cert;
+        }
+
+        public String getAlias() {
+            return alias;
+        }
+
+        public X509Certificate getCert() {
+            return cert;
+        }
+        
+    }
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public KeyStore getKeyStore() {
+        return keyStore;
+    }
+    
+}

Added: 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/ShowMainAction.java
==============================================================================
--- (empty file)
+++ 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/ShowMainAction.java
        Thu Dec 13 21:49:34 2007
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.wso2.tools.ksexplorer.action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsStatics;
+import org.wso2.tools.ksexplorer.KSExplorerConstants;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import java.util.List;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionSupport;
+
+public class ShowMainAction extends ActionSupport {
+
+    private static final long serialVersionUID = -8989302791312420867L;
+
+    private static Log log = LogFactory.getLog(ShowMainAction.class);
+
+    private List keyStoreDescriptions;
+
+    public String execute() throws Exception {
+        // Check whether there are any ks files in the session
+        HttpServletRequest request = (HttpServletRequest) ActionContext
+                .getContext().get(StrutsStatics.HTTP_REQUEST);
+        HttpSession session = request.getSession();
+        keyStoreDescriptions = (List) session
+                .getAttribute(KSExplorerConstants.SESSION_KEY_KS);
+        if (this.keyStoreDescriptions != null) {
+            log.info("[WSO2KSE] : Showing information of "
+                    + keyStoreDescriptions.size() + " keystores");
+        }
+        return SUCCESS;
+    }
+
+    public List getKeyStoreDescriptions() {
+        return keyStoreDescriptions;
+    }
+
+}

Added: 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/ShowPEMPrivateKeyAction.java
==============================================================================
--- (empty file)
+++ 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/ShowPEMPrivateKeyAction.java
       Thu Dec 13 21:49:34 2007
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.wso2.tools.ksexplorer.action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsStatics;
+import org.wso2.tools.ksexplorer.KSExplorerConstants;
+import org.wso2.tools.ksexplorer.KeyStoreDescription;
+
+import sun.misc.BASE64Encoder;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import java.security.KeyStore;
+import java.security.PrivateKey;
+import java.util.Iterator;
+import java.util.List;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionSupport;
+
+public class ShowPEMPrivateKeyAction extends ActionSupport {
+
+    private static final long serialVersionUID = -4061122808487798237L;
+    
+    private static Log log = LogFactory.getLog(ShowPEMPrivateKeyAction.class);
+    
+    private String pemKey;
+    private String alias;
+    private String storeName;
+    
+    
+    public String getAlias() {
+        return alias;
+    }
+
+    public String getStoreName() {
+        return storeName;
+    }
+
+    public String execute() throws Exception {
+
+        HttpServletRequest request = (HttpServletRequest) ActionContext
+                .getContext().get(StrutsStatics.HTTP_REQUEST);
+        HttpSession session = request.getSession();
+        List keyStoreDescriptions = (List) session
+                .getAttribute(KSExplorerConstants.SESSION_KEY_KS);
+
+        String ksId = request.getParameter("ksId");
+        KeyStoreDescription ksDesc = null; 
+        for (Iterator iterator = keyStoreDescriptions.iterator(); iterator
+                .hasNext();) {
+            KeyStoreDescription desc = (KeyStoreDescription) iterator.next();
+            if(desc.getUuid().equals(ksId)) {
+                ksDesc = desc;
+            }
+        }
+        
+        KeyStore store = ksDesc.getKeyStore();
+        this.storeName = ksDesc.getName();
+        this.alias = request.getParameter("alias");
+        String keyPasswd = request.getParameter("keyPasswd");
+        PrivateKey key = (PrivateKey)store.getKey(alias, 
keyPasswd.toCharArray());
+
+        log.info("[WSO2KSE] : Showing key : " + alias + " in keystore : " + 
+                this.storeName + " (store id :" + ksId + ")");
+        
+        BASE64Encoder encoder = new BASE64Encoder();
+        pemKey = "-----BEGIN PRIVATE KEY-----\n";
+        pemKey += encoder.encode(key.getEncoded());
+        pemKey += "\n-----END PRIVATE KEY-----";
+        
+        return SUCCESS;
+    }
+
+    public String getPemKey() {
+        return pemKey;
+    }
+
+}

Added: 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/UploadKeyStoreAction.java
==============================================================================
--- (empty file)
+++ 
trunk/commons/ksb/src/main/java/org/wso2/tools/ksexplorer/action/UploadKeyStoreAction.java
  Thu Dec 13 21:49:34 2007
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.wso2.tools.ksexplorer.action;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.StrutsStatics;
+import org.wso2.tools.ksexplorer.KSExplorerConstants;
+import org.wso2.tools.ksexplorer.KeyStoreDescription;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.security.KeyStore;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionSupport;
+
+public class UploadKeyStoreAction extends ActionSupport {
+
+    private static final long serialVersionUID = -8841477227660234617L;
+    private Log log = LogFactory.getLog(UploadKeyStoreAction.class);
+    
+    private File keyStoreFile;
+    private String keyStoreFileFileName; 
+
+    public String execute() throws Exception {
+        HttpServletRequest request = (HttpServletRequest) ActionContext
+                .getContext().get(StrutsStatics.HTTP_REQUEST);
+
+        String storeType = ("01".equals(request
+                .getParameter(KSExplorerConstants.PARAM_STORE_TYPE))) ? "JKS"
+                : "PKCS12";
+        String storePass = request
+                .getParameter(KSExplorerConstants.PARAM_STORE_PASSWORD);
+        KeyStore store = KeyStore.getInstance(storeType);
+        store.load(new FileInputStream(this.keyStoreFile), storePass
+                .toCharArray());
+
+        KeyStoreDescription ksDesc = new KeyStoreDescription(store, 
this.keyStoreFileFileName);
+        
+        HttpSession session = request.getSession();
+        List keyStoreDescriptions = (List) session
+                .getAttribute(KSExplorerConstants.SESSION_KEY_KS);
+        if (keyStoreDescriptions == null) {
+            keyStoreDescriptions = new ArrayList();
+        }
+        keyStoreDescriptions.add(ksDesc);
+        session.setAttribute(KSExplorerConstants.SESSION_KEY_KS,
+                keyStoreDescriptions);
+
+        log.info("[WSO2KSE] : Added keystore : " + this.keyStoreFileFileName);
+        log.info("[WSO2KSE] : This session now has : " + 
keyStoreDescriptions.size() + " keystores");
+        
+        return SUCCESS;
+    }
+
+    public File getKeyStoreFile() {
+        return keyStoreFile;
+    }
+
+    public void setKeyStoreFile(File keyStoreFile) {
+        this.keyStoreFile = keyStoreFile;
+    }
+
+    public String getKeyStoreFileFileName() {
+        return keyStoreFileFileName;
+    }
+
+    public void setKeyStoreFileFileName(String keyStoreFileFileName) {
+        this.keyStoreFileFileName = keyStoreFileFileName;
+    }
+
+}

Added: trunk/commons/ksb/src/main/java/struts.properties
==============================================================================
--- (empty file)
+++ trunk/commons/ksb/src/main/java/struts.properties   Thu Dec 13 21:49:34 2007
@@ -0,0 +1 @@
+#struts.custom.i18n.resources=i18n.properties
\ No newline at end of file

Added: trunk/commons/ksb/src/main/java/struts.xml
==============================================================================
--- (empty file)
+++ trunk/commons/ksb/src/main/java/struts.xml  Thu Dec 13 21:49:34 2007
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE struts PUBLIC
+    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+    "http://struts.apache.org/dtds/struts-2.0.dtd";>
+
+<struts>
+
+    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
+    <constant name="struts.devMode" value="false" />
+
+
+    <package name="default" namespace="/" extends="struts-default">
+
+               
+               <interceptors>
+               <interceptor-stack name="defaultInterceptorStack">
+                   <interceptor-ref name="servlet-config" />
+                   <interceptor-ref name="params" />
+                   <interceptor-ref name="prepare" />
+                   <interceptor-ref name="chain" />
+                   <interceptor-ref name="model-driven" />
+                   <interceptor-ref name="fileUpload" />
+                   <interceptor-ref name="static-params" />
+                   <interceptor-ref name="params" />
+                   <interceptor-ref name="conversionError" />
+                   <interceptor-ref name="validation" />
+                   <interceptor-ref name="workflow" />
+               </interceptor-stack>
+               
+        </interceptors>
+        
+        <default-interceptor-ref name="defaultInterceptorStack" />
+        
+               <action name="ShowMain" 
class="org.wso2.tools.ksexplorer.action.ShowMainAction">
+                       <result name="success">jsp/main.jsp</result>
+               </action>
+               <action name="UploadKeyStore" 
class="org.wso2.tools.ksexplorer.action.UploadKeyStoreAction">
+                       <result name="success" 
type="redirect">ShowMain.action</result>
+               </action>
+               <action name="ShowPEMPrivateKey" 
class="org.wso2.tools.ksexplorer.action.ShowPEMPrivateKeyAction">
+                       <result name="success">jsp/showpem.jsp</result>
+               </action>
+               
+               
+    </package>
+</struts>
\ No newline at end of file

Added: 
trunk/commons/ksb/src/main/resources/org/wso2/solutions/identity/admin/ui/action/LoginAction-validation.xml
==============================================================================
--- (empty file)
+++ 
trunk/commons/ksb/src/main/resources/org/wso2/solutions/identity/admin/ui/action/LoginAction-validation.xml
 Thu Dec 13 21:49:34 2007
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+        <!DOCTYPE validators PUBLIC 
+
+               "-//OpenSymphony Group//XWork Validator 1.0.2//EN" 
+
+               "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>
+
+        
+
+<validators>
+
+       <field name="username">
+               <field-validator type="requiredstring">
+                       <param name="trim">true</param>
+                       <message>Login name is required</message>
+               </field-validator>
+       </field>
+
+       <field name="password">
+               <field-validator type="requiredstring">
+                       <param name="trim">true</param>
+                       <message>Password is required</message>
+               </field-validator>
+       </field>
+
+</validators>
\ No newline at end of file

Added: trunk/commons/ksb/src/main/webapp/WEB-INF/web.xml
==============================================================================
--- (empty file)
+++ trunk/commons/ksb/src/main/webapp/WEB-INF/web.xml   Thu Dec 13 21:49:34 2007
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WSO2-IS-AdminUI" version="2.4" 
xmlns="http://java.sun.com/xml/ns/j2ee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
+
+    <display-name>WSO2 Identity Solution Admin</display-name>
+
+    <filter>
+        <filter-name>struts2</filter-name>
+        
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
+    </filter>
+    
+
+    <filter-mapping>
+        <filter-name>struts2</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+
+</web-app>
\ No newline at end of file

Added: trunk/commons/ksb/src/main/webapp/css/styles.css
==============================================================================
--- (empty file)
+++ trunk/commons/ksb/src/main/webapp/css/styles.css    Thu Dec 13 21:49:34 2007
@@ -0,0 +1,59 @@
+body{
+padding:0px;
+margin:0px;
+}
+body, td, tr, input{
+font: 11px Verdana, Arial, Helvetica, sans-serif;
+line-height:18px;
+}
+.header-back{
+background-color:#c6c9a3;
+padding:10px;
+border-bottom:solid 1px #96977a;
+}
+h1{
+padding:0px;
+margin:0px;
+padding-top:5px;
+padding-bottom:5px;
+color:#343434;
+font-size:17px;
+}
+h2{
+padding:0px;
+margin:0px;
+padding-top:5px;
+padding-bottom:5px;
+color:#343434;
+font-size:14px;
+margin-left:10px;
+}
+h3{
+padding:0px;
+margin:0px;
+padding-top:5px;
+padding-bottom:5px;
+color:#5a6370;
+font-size:12px;
+margin-left:10px;
+}
+.entryBox{
+background-color:#ececec;
+padding:10px;
+margin:10px;
+margin-top:0px;
+width:99%;
+border:dotted 1px #9b9b9b;
+}
+.attribute-name{
+font-weight:bold;
+width:200px;
+}
+.footer{
+background-color:#d6d6d6;
+height:30px;
+color:#5c5c5c;
+font-size:10px;
+padding-top:5px;
+padding-left:5px;
+}
\ No newline at end of file

Added: trunk/commons/ksb/src/main/webapp/images/loading.gif
==============================================================================
Binary file. No diff available.

Added: trunk/commons/ksb/src/main/webapp/index.html
==============================================================================
--- (empty file)
+++ trunk/commons/ksb/src/main/webapp/index.html        Thu Dec 13 21:49:34 2007
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+<title>WSO2 Key Store Browser</title>
+<META HTTP-EQUIV="Refresh" CONTENT="0;URL=ShowMain.action">
+
+</head>
+<body>
+Loading
+<img src="images/loading.gif" align="left" />
+</body>
+</html>

Added: trunk/commons/ksb/src/main/webapp/jsp/main.jsp
==============================================================================
--- (empty file)
+++ trunk/commons/ksb/src/main/webapp/jsp/main.jsp      Thu Dec 13 21:49:34 2007
@@ -0,0 +1,159 @@
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
+"http://www.w3.org/TR/html4/strict.dtd";>
+<html>
+<head>
+<style>
+body{
+padding:0px;
+margin:0px;
+}
+body, td, tr, input{
+font: 11px Verdana, Arial, Helvetica, sans-serif;
+line-height:18px;
+}
+.header-back{
+background-color:#c6c9a3;
+padding:10px;
+border-bottom:solid 1px #96977a;
+}
+h1{
+padding:0px;
+margin:0px;
+padding-top:5px;
+padding-bottom:5px;
+color:#343434;
+font-size:17px;
+}
+h2{
+padding:0px;
+margin:0px;
+padding-top:5px;
+padding-bottom:5px;
+color:#343434;
+font-size:14px;
+margin-left:10px;
+}
+h3{
+padding:0px;
+margin:0px;
+padding-top:5px;
+padding-bottom:5px;
+color:#5a6370;
+font-size:12px;
+margin-left:10px;
+}
+.table-top{
+background-color:#dadada;
+font-size:12px;
+font-weight:bold;
+padding:0px;
+margin:0px;
+color:#2e2e2e;
+padding-top:5px;
+padding-bottom:5px;
+}
+.entryBox{
+background-color:#ececec;
+margin:10px;
+margin-top:0px;
+width:99%;
+border:dotted 1px #9b9b9b;
+}
+.entryBox td{
+padding-left:5px;
+padding-top:3px;
+padding-bottom:3px;
+}
+.attribute-name{
+font-weight:bold;
+width:200px;
+}
+.footer{
+background-color:#edeee2;
+height:30px;
+color:#5c5c5c;
+font-size:10px;
+padding-top:5px;
+padding-left:5px;
+border-bottom:solid 1px #bec192;
+border-top:solid 1px #bec192;
+}
+</style>
+<title>WSO2 Keystore Browser</title>
+</head>
+<body>
+<div class="header-back">
+<h1>Keystore explorer</h1>
+
+       
+               <s:form action="UploadKeyStore" method="POST" 
enctype="multipart/form-data">
+                       <s:file name="keyStoreFile" label="Keystore file"/>
+                       <s:select label="Store type"
+                              name="storeType"
+                              headerKey="01" headerValue="JKS"
+                              list="#{'01':'JKS', '02':'PKCS12'}"
+                              value="storeType"
+                              required="true"
+                       />
+                       <s:password label="Store password" name="storePasswd" />
+                       <s:submit type="button" label="Upload"/>
+                       
+               </s:form>
+       
+</div>
+
+
+           <s:iterator value="keyStoreDescriptions">
+                       <h3>    
+                               Keystore :<s:property value="name" />           
        
+                               Type :<s:property value="storeType" />
+                       </h3>
+               
+                       <h2>Certificates :</h2>
+                       
+                       <s:iterator value="certificates">
+                               <table cellpadding="0" cellspacing="0" 
border="0" class="entryBox">
+                                       <tr><td colspan="2" 
class="table-top">Alias : <s:property value="alias"/></td></tr>
+                                       <tr><td class="attribute-name">Subject 
: </td><td><s:property value="cert.SubjectDN"/></td></tr>
+                                       <tr><td class="attribute-name">Issuer : 
</td><td><s:property value="cert.IssuerDN"/></td></tr>
+                                       <tr><td class="attribute-name">Serial 
number : </td><td><s:property value="cert.SerialNumber"/></td></tr>
+                                       <tr><td class="attribute-name">Version 
: </td><td><s:property value="cert.Version"/></td></tr>
+                                       <tr><td class="attribute-name">Not 
before : </td><td><s:date name="cert.NotBefore" format="dd/MM/yyyy" /></td></tr>
+                                       <tr><td class="attribute-name">Not 
after : </td><td><s:date name="cert.NotAfter" format="dd/MM/yyyy" /></td></tr>
+                               </table>
+                       </s:iterator>
+                       
+                       <h2>Private Keys :</h2>
+                       <s:iterator value="privateKeys">
+                       <table cellpadding="0" cellspacing="0" border="0" 
class="entryBox">
+                               <tr>
+                                       <td colspan="2" class="table-top">
+                                               <s:url id="PEMUrl" 
namespace="/" action="privKeyPasswdForPEMUrl">
+                                                   <s:param name="alias" 
value="%{alias}" />
+                                                   <s:param name="ksId" 
value="%{uuid}" />
+                                               </s:url>
+                               
+                                               Alias : <s:property 
value="alias"/>
+                                               <form method="post" 
action="ShowPEMPrivateKey.action?alias=<s:property 
value="alias"/>&ksId=<s:property value="uuid"/>">
+                                                       <input type="password" 
name="keyPasswd"/>
+                                                       <input type="submit" 
value="PEM"/>
+                                               </form>
+                                       </td>
+                               </tr>
+                               <tr><td class="attribute-name">Subject : 
</td><td><s:property value="cert.SubjectDN"/></td></tr>
+                               <tr><td class="attribute-name">Issuer : 
</td><td><s:property value="cert.IssuerDN"/></td></tr>
+                               <tr><td class="attribute-name">Serial number : 
</td><td><s:property value="cert.SerialNumber"/></td></tr>
+                               <tr><td class="attribute-name">Version : 
</td><td><s:property value="cert.Version"/></td></tr>
+                               <tr><td class="attribute-name">Not before : 
</td><td><s:date name="cert.NotBefore" format="dd/MM/yyyy"/></td></tr>
+                               <tr><td class="attribute-name">Not after : 
</td><td><s:date name="cert.NotAfter" format="dd/MM/yyyy"/></td></tr>
+                       </table>
+                       </s:iterator>
+                       
+                       <br/>
+           </s:iterator>
+
+<div class="footer">&copy 2007 <a href="http://www.wso2.org";>WSO2</a> 
Inc.</div>
+
+</body>
+</html>

Added: trunk/commons/ksb/src/main/webapp/jsp/showpem.jsp
==============================================================================
--- (empty file)
+++ trunk/commons/ksb/src/main/webapp/jsp/showpem.jsp   Thu Dec 13 21:49:34 2007
@@ -0,0 +1,21 @@
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
+"http://www.w3.org/TR/html4/strict.dtd";>
+<html>
+<head>
+<title>WSO2 Keystore Brower | Private key in PEM format</title>
+</head>
+<body>
+<h2>Keystore : <s:property value="storeName"/></h2>
+<h2>Private key alias : <s:property value="alias"/></h2>
+<hr/>
+<pre>
+<s:property value="pemKey"/>
+</pre>
+<hr/>
+<a href="ShowMain.action">Back</a>
+
+<p>&copy 2007 <a href="http://www.wso2.org";>WSO2</a> Inc.</p>
+</body>
+</html>

_______________________________________________
Commons-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/commons-dev

Reply via email to