[Carbon-dev] svn commit r32788 - in trunk/carbon-components/identity: org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util org.wso2.carbon.identity.provider.ui/src/main/java/org/wso2/carbon/identity/provider/ui/client org.wso2.carbon.identity.provider.ui/src/main/resources org.wso2.carbon.identity.provider.ui/src/main/resources/org/wso2/carbon/identity/provider/ui/i18n org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/admin

prabath at wso2.com prabath at wso2.com
Sat Mar 28 05:36:04 PDT 2009


Author: prabath
Date: Sat Mar 28 05:36:03 2009
New Revision: 32788
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=32788

Log:
identity

Modified:
   trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/Activator.java
   trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityUtil.java
   trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/java/org/wso2/carbon/identity/provider/ui/client/RelyingPartyClient.java
   trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/RelyingPartyAdminService.wsdl
   trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/org/wso2/carbon/identity/provider/ui/i18n/Resources.properties
   trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/add_trusted_rp.jsp
   trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/import-cert-finish.jsp
   trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/Initializer.java
   trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/admin/RelyingPartyAdmin.java

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/Activator.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/Activator.java?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/Activator.java	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/internal/Activator.java	Sat Mar 28 05:36:03 2009
@@ -6,19 +6,18 @@
 import org.wso2.carbon.identity.core.RealmTracker;
 import org.wso2.carbon.identity.core.util.IdentityUtil;
 import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.utils.ServerConfiguration;
 
 public class Activator implements BundleActivator {
 
 	public void start(BundleContext bundleContext) throws Exception {
 		ServiceReference reference = bundleContext.getServiceReference(RegistryService.class
 				.getName());
-		RegistryService registryService = null;
-		
-		ServerConfiguration.getInstance().forceInit("conf/identity.xml",true);
+		RegistryService registryService = null;		
 		registryService = (RegistryService) bundleContext.getService(reference);
 		IdentityUtil.setRegistry(registryService.getSystemRegistry());
 	
+		IdentityUtil.populateProperties();
+		
 		try {
 			RealmTracker.init(bundleContext);
 		} catch (Exception e) {

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityUtil.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityUtil.java?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityUtil.java	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityUtil.java	Sat Mar 28 05:36:03 2009
@@ -7,13 +7,53 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 import org.wso2.carbon.registry.core.Registry;
+import org.wso2.carbon.utils.ServerConfiguration;
+import org.wso2.carbon.utils.ServerConfigurationException;
+import org.wso2.carbon.identity.core.IdentityConstants.ServerConfig;
 
 import java.security.MessageDigest;
+import java.util.HashMap;
+import java.util.Map;
 
 public class IdentityUtil {
 
 	private static Log log = LogFactory.getLog(IdentityUtil.class);
 	private static Registry registry;
+	private static Map<String, String> properties = new HashMap<String, String>();
+
+	public static String getProperty(String key) {
+		if (!properties.containsKey(key)) {
+			return null;
+		}
+		return properties.get(key);
+	}
+
+	public static void populateProperties() throws ServerConfigurationException {
+		ServerConfiguration serverConfig = ServerConfiguration.getInstance();
+		serverConfig.forceInit("conf/identity.xml", true);
+		properties.put(ServerConfig.USER_TRUSTED_RP_STORE_LOCATION, serverConfig
+				.getFirstProperty(ServerConfig.USER_TRUSTED_RP_STORE_LOCATION));
+		properties.put(ServerConfig.USER_TRUSTED_RP_STORE_PASSWORD, serverConfig
+				.getFirstProperty(ServerConfig.USER_TRUSTED_RP_STORE_PASSWORD));
+		properties.put(ServerConfig.USER_TRUSTED_RP_STORE_TYPE, serverConfig
+				.getFirstProperty(ServerConfig.USER_TRUSTED_RP_STORE_TYPE));
+		properties.put(ServerConfig.USER_TRUSTED_RP_KEY_PASSWORD, serverConfig
+				.getFirstProperty(ServerConfig.USER_TRUSTED_RP_KEY_PASSWORD));
+		properties.put(ServerConfig.USER_PERSONAL_STORE_LOCATION, serverConfig
+				.getFirstProperty(ServerConfig.USER_PERSONAL_STORE_LOCATION));
+		properties.put(ServerConfig.USER_TRUSTED_RP_STORE_LOCATION, serverConfig
+				.getFirstProperty(ServerConfig.USER_TRUSTED_RP_STORE_LOCATION));
+		properties.put(ServerConfig.USER_PERSONAL_STORE_PASSWORD, serverConfig
+				.getFirstProperty(ServerConfig.USER_PERSONAL_STORE_PASSWORD));
+		properties.put(ServerConfig.USER_PERSONAL_STORE_TYPE, serverConfig
+				.getFirstProperty(ServerConfig.USER_PERSONAL_STORE_TYPE));
+		properties.put(ServerConfig.IDP_STORE_PASSWORD, serverConfig
+				.getFirstProperty(ServerConfig.IDP_STORE_PASSWORD));
+		properties.put(ServerConfig.IDP_STORE_TYPE, serverConfig
+				.getFirstProperty(ServerConfig.IDP_STORE_TYPE));
+		properties.put(ServerConfig.IDP_STORE_LOCATION, serverConfig
+				.getFirstProperty(ServerConfig.IDP_STORE_LOCATION));
+	}
 
 	public static Registry getRegistry() {
 		return registry;
@@ -52,6 +92,7 @@
 
 	/**
 	 * Serialize the given node to a String.
+	 * 
 	 * @param node Node to be serialized.
 	 * @return The serialized node as a java.lang.String instance.
 	 */
@@ -61,7 +102,7 @@
 			OMDOMFactory fac = new OMDOMFactory();
 			importerDoc = (Document) fac.createOMDocument();
 		}
-		//Import the node as an AXIOM-DOOM node and use toSting()
+		// Import the node as an AXIOM-DOOM node and use toSting()
 		Node axiomNode = importerDoc.importNode(node, true);
 		return axiomNode.toString();
 	}

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/java/org/wso2/carbon/identity/provider/ui/client/RelyingPartyClient.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/java/org/wso2/carbon/identity/provider/ui/client/RelyingPartyClient.java?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/java/org/wso2/carbon/identity/provider/ui/client/RelyingPartyClient.java	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/java/org/wso2/carbon/identity/provider/ui/client/RelyingPartyClient.java	Sat Mar 28 05:36:03 2009
@@ -1,5 +1,10 @@
 package org.wso2.carbon.identity.provider.ui.client;
 
+import java.io.ByteArrayInputStream;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+
+import org.apache.axiom.om.util.Base64;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
@@ -10,13 +15,13 @@
 import org.wso2.carbon.identity.provider.ui.rp.dto.UserTrustedRPDTO;
 
 public class RelyingPartyClient {
-	
+
 	private static final Log log = LogFactory.getLog(IdentityProviderClient.class);
 
 	private RelyingPartyAdminServiceStub stub = null;
 
-	public RelyingPartyClient(String cookie, String backendServerURL,
-			ConfigurationContext configCtx) throws AxisFault {
+	public RelyingPartyClient(String cookie, String backendServerURL, ConfigurationContext configCtx)
+			throws AxisFault {
 		String serviceURL = backendServerURL + "RelyingPartyAdminService";
 		stub = new RelyingPartyAdminServiceStub(configCtx, serviceURL);
 		ServiceClient client = stub._getServiceClient();
@@ -24,21 +29,43 @@
 		option.setManageSession(true);
 		option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
 	}
-	
-	public UserTrustedRPDTO[] getAllPersonalTrustedRelyingParties(String username) throws AxisFault {
+
+	public UserTrustedRPDTO[] getAllUserTrustedRelyingParties(String username) throws AxisFault {
 		try {
-			return stub.getAllPersonalTrustedRelyingParties(username);
+			return stub.getAllUserTrustedRelyingParties(username);
 		} catch (Exception e) {
 			handleException("Error ouccured while retrieving trusted relying paties", e);
 		}
 		return null;
 	}
-	
-	public void removePersonalTrustedRelyingParty(UserTrustedRPDTO userrp) throws AxisFault {
+
+	public void removeUserTrustedRelyingParty(UserTrustedRPDTO userrp) throws AxisFault {
+		try {
+			stub.removeUserTrustedRelyingParty(userrp);
+		} catch (Exception e) {
+			handleException("Error ouccured while removing user truted rp", e);
+		}
+	}
+
+	public void createUserTrustedRP(UserTrustedRPDTO userrp, byte[] content) throws AxisFault {
 		try {
-			stub.removePersonalTrustedRelyingParty(userrp);
+			CertificateFactory factory = CertificateFactory.getInstance("X.509");
+			X509Certificate cert = (X509Certificate) factory
+					.generateCertificate(new ByteArrayInputStream(content));
+			String host = null;
+			String[] details = cert.getSubjectDN().getName().split(",");
+			for (int i = 0; i < details.length; i++) {
+				if (details[i].startsWith("CN="))
+				{
+					host = details[i].substring(3);
+					break;
+				}
+			}
+			userrp.setHostName(host);
+			userrp.setFileContent(Base64.encode(content));
+			stub.createUserTrustedRP(userrp);
 		} catch (Exception e) {
-			handleException("Error ouccured while removing", e);
+			handleException("Error ouccured while creating user truted rp", e);
 		}
 	}
 

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/RelyingPartyAdminService.wsdl
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/RelyingPartyAdminService.wsdl?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/RelyingPartyAdminService.wsdl	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/RelyingPartyAdminService.wsdl	Sat Mar 28 05:36:03 2009
@@ -66,14 +66,14 @@
             </xs:sequence>
         </xs:complexType>
     </xs:element>
-    <xs:element name="getAllPersonalTrustedRelyingParties">
+    <xs:element name="getAllUserTrustedRelyingParties">
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" name="userId" nillable="true" type="xs:string" />
             </xs:sequence>
         </xs:complexType>
     </xs:element>
-    <xs:element name="getAllPersonalTrustedRelyingPartiesResponse">
+    <xs:element name="getAllUserTrustedRelyingPartiesResponse">
         <xs:complexType>
             <xs:sequence>
                 <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="ax26:UserTrustedRPDTO" />
@@ -131,7 +131,7 @@
             </xs:sequence>
         </xs:complexType>
     </xs:element>
-    <xs:element name="removePersonalTrustedRelyingParty">
+    <xs:element name="removeUserTrustedRelyingParty">
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" name="userrp" nillable="true" type="ax26:UserTrustedRPDTO" />
@@ -149,6 +149,7 @@
     <xs:complexType name="UserTrustedRPDTO">
         <xs:sequence>
             <xs:element minOccurs="0" name="certificateAlias" nillable="true" type="xs:string" />
+            <xs:element minOccurs="0" name="fileContent" nillable="true" type="xs:string" />
             <xs:element minOccurs="0" name="hostName" nillable="true" type="xs:string" />
             <xs:element minOccurs="0" name="userName" nillable="true" type="xs:string" />
         </xs:sequence>
@@ -161,6 +162,9 @@
     <wsdl:message name="createUserTrustedRPRequest">
         <wsdl:part name="parameters" element="ns1:createUserTrustedRP" />
     </wsdl:message>
+    <wsdl:message name="Exception">
+        <wsdl:part name="parameters" element="ns1:Exception" />
+    </wsdl:message>
     <wsdl:message name="getRelyingPartyRequest">
         <wsdl:part name="parameters" element="ns1:getRelyingParty" />
     </wsdl:message>
@@ -173,9 +177,6 @@
     <wsdl:message name="deleteRelyingPartyRequest">
         <wsdl:part name="parameters" element="ns1:deleteRelyingParty" />
     </wsdl:message>
-    <wsdl:message name="Exception">
-        <wsdl:part name="parameters" element="ns1:Exception" />
-    </wsdl:message>
     <wsdl:message name="createOpenIDUserRPDORequest">
         <wsdl:part name="parameters" element="ns1:createOpenIDUserRPDO" />
     </wsdl:message>
@@ -194,18 +195,12 @@
     <wsdl:message name="createPPIDValueForRPRequest">
         <wsdl:part name="parameters" element="ns1:createPPIDValueForRP" />
     </wsdl:message>
-    <wsdl:message name="removePersonalTrustedRelyingPartyRequest">
-        <wsdl:part name="parameters" element="ns1:removePersonalTrustedRelyingParty" />
+    <wsdl:message name="removeUserTrustedRelyingPartyRequest">
+        <wsdl:part name="parameters" element="ns1:removeUserTrustedRelyingParty" />
     </wsdl:message>
     <wsdl:message name="createRelyingPartyRequest">
         <wsdl:part name="parameters" element="ns1:createRelyingParty" />
     </wsdl:message>
-    <wsdl:message name="getAllPersonalTrustedRelyingPartiesRequest">
-        <wsdl:part name="parameters" element="ns1:getAllPersonalTrustedRelyingParties" />
-    </wsdl:message>
-    <wsdl:message name="getAllPersonalTrustedRelyingPartiesResponse">
-        <wsdl:part name="parameters" element="ns1:getAllPersonalTrustedRelyingPartiesResponse" />
-    </wsdl:message>
     <wsdl:message name="createPPIDValueForUserTrustedRPRequest">
         <wsdl:part name="parameters" element="ns1:createPPIDValueForUserTrustedRP" />
     </wsdl:message>
@@ -213,9 +208,16 @@
     <wsdl:message name="getAllRelyingPartyListResponse">
         <wsdl:part name="parameters" element="ns1:getAllRelyingPartyListResponse" />
     </wsdl:message>
+    <wsdl:message name="getAllUserTrustedRelyingPartiesRequest">
+        <wsdl:part name="parameters" element="ns1:getAllUserTrustedRelyingParties" />
+    </wsdl:message>
+    <wsdl:message name="getAllUserTrustedRelyingPartiesResponse">
+        <wsdl:part name="parameters" element="ns1:getAllUserTrustedRelyingPartiesResponse" />
+    </wsdl:message>
     <wsdl:portType name="RelyingPartyAdminServicePortType">
         <wsdl:operation name="createUserTrustedRP">
             <wsdl:input message="axis2:createUserTrustedRPRequest" wsaw:Action="urn:createUserTrustedRP" />
+            <wsdl:fault message="axis2:Exception" name="Exception" wsaw:Action="urn:createUserTrustedRPException" />
         </wsdl:operation>
         <wsdl:operation name="getRelyingParty">
             <wsdl:input message="axis2:getRelyingPartyRequest" wsaw:Action="urn:getRelyingParty" />
@@ -223,6 +225,7 @@
         </wsdl:operation>
         <wsdl:operation name="create">
             <wsdl:input message="axis2:createRequest" wsaw:Action="urn:create" />
+            <wsdl:fault message="axis2:Exception" name="Exception" wsaw:Action="urn:createException" />
         </wsdl:operation>
         <wsdl:operation name="deleteRelyingParty">
             <wsdl:input message="axis2:deleteRelyingPartyRequest" wsaw:Action="urn:deleteRelyingParty" />
@@ -234,6 +237,7 @@
         <wsdl:operation name="getPersonalRelyingParty">
             <wsdl:input message="axis2:getPersonalRelyingPartyRequest" wsaw:Action="urn:getPersonalRelyingParty" />
             <wsdl:output message="axis2:getPersonalRelyingPartyResponse" wsaw:Action="urn:getPersonalRelyingPartyResponse" />
+            <wsdl:fault message="axis2:Exception" name="Exception" wsaw:Action="urn:getPersonalRelyingPartyException" />
         </wsdl:operation>
         <wsdl:operation name="getPPIDValuesForUser">
             <wsdl:input message="axis2:getPPIDValuesForUserRequest" wsaw:Action="urn:getPPIDValuesForUser" />
@@ -244,16 +248,13 @@
             <wsdl:input message="axis2:createPPIDValueForRPRequest" wsaw:Action="urn:createPPIDValueForRP" />
             <wsdl:fault message="axis2:Exception" name="Exception" wsaw:Action="urn:createPPIDValueForRPException" />
         </wsdl:operation>
-        <wsdl:operation name="removePersonalTrustedRelyingParty">
-            <wsdl:input message="axis2:removePersonalTrustedRelyingPartyRequest" wsaw:Action="urn:removePersonalTrustedRelyingParty" />
-            <wsdl:fault message="axis2:Exception" name="Exception" wsaw:Action="urn:removePersonalTrustedRelyingPartyException" />
+        <wsdl:operation name="removeUserTrustedRelyingParty">
+            <wsdl:input message="axis2:removeUserTrustedRelyingPartyRequest" wsaw:Action="urn:removeUserTrustedRelyingParty" />
+            <wsdl:fault message="axis2:Exception" name="Exception" wsaw:Action="urn:removeUserTrustedRelyingPartyException" />
         </wsdl:operation>
         <wsdl:operation name="createRelyingParty">
             <wsdl:input message="axis2:createRelyingPartyRequest" wsaw:Action="urn:createRelyingParty" />
-        </wsdl:operation>
-        <wsdl:operation name="getAllPersonalTrustedRelyingParties">
-            <wsdl:input message="axis2:getAllPersonalTrustedRelyingPartiesRequest" wsaw:Action="urn:getAllPersonalTrustedRelyingParties" />
-            <wsdl:output message="axis2:getAllPersonalTrustedRelyingPartiesResponse" wsaw:Action="urn:getAllPersonalTrustedRelyingPartiesResponse" />
+            <wsdl:fault message="axis2:Exception" name="Exception" wsaw:Action="urn:createRelyingPartyException" />
         </wsdl:operation>
         <wsdl:operation name="createPPIDValueForUserTrustedRP">
             <wsdl:input message="axis2:createPPIDValueForUserTrustedRPRequest" wsaw:Action="urn:createPPIDValueForUserTrustedRP" />
@@ -263,6 +264,11 @@
             <wsdl:input message="axis2:getAllRelyingPartyListRequest" wsaw:Action="urn:getAllRelyingPartyList" />
             <wsdl:output message="axis2:getAllRelyingPartyListResponse" wsaw:Action="urn:getAllRelyingPartyListResponse" />
         </wsdl:operation>
+        <wsdl:operation name="getAllUserTrustedRelyingParties">
+            <wsdl:input message="axis2:getAllUserTrustedRelyingPartiesRequest" wsaw:Action="urn:getAllUserTrustedRelyingParties" />
+            <wsdl:output message="axis2:getAllUserTrustedRelyingPartiesResponse" wsaw:Action="urn:getAllUserTrustedRelyingPartiesResponse" />
+            <wsdl:fault message="axis2:Exception" name="Exception" wsaw:Action="urn:getAllUserTrustedRelyingPartiesException" />
+        </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="RelyingPartyAdminServiceSoap11Binding" type="axis2:RelyingPartyAdminServicePortType">
         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
@@ -280,12 +286,18 @@
             <wsdl:input>
                 <soap:body use="literal" />
             </wsdl:input>
+            <wsdl:fault name="Exception">
+                <soap:fault use="literal" name="Exception" />
+            </wsdl:fault>
         </wsdl:operation>
         <wsdl:operation name="create">
             <soap:operation soapAction="urn:create" style="document" />
             <wsdl:input>
                 <soap:body use="literal" />
             </wsdl:input>
+            <wsdl:fault name="Exception">
+                <soap:fault use="literal" name="Exception" />
+            </wsdl:fault>
         </wsdl:operation>
         <wsdl:operation name="deleteRelyingParty">
             <soap:operation soapAction="urn:deleteRelyingParty" style="document" />
@@ -322,6 +334,9 @@
             <wsdl:output>
                 <soap:body use="literal" />
             </wsdl:output>
+            <wsdl:fault name="Exception">
+                <soap:fault use="literal" name="Exception" />
+            </wsdl:fault>
         </wsdl:operation>
         <wsdl:operation name="createPPIDValueForRP">
             <soap:operation soapAction="urn:createPPIDValueForRP" style="document" />
@@ -332,8 +347,8 @@
                 <soap:fault use="literal" name="Exception" />
             </wsdl:fault>
         </wsdl:operation>
-        <wsdl:operation name="removePersonalTrustedRelyingParty">
-            <soap:operation soapAction="urn:removePersonalTrustedRelyingParty" style="document" />
+        <wsdl:operation name="removeUserTrustedRelyingParty">
+            <soap:operation soapAction="urn:removeUserTrustedRelyingParty" style="document" />
             <wsdl:input>
                 <soap:body use="literal" />
             </wsdl:input>
@@ -341,20 +356,14 @@
                 <soap:fault use="literal" name="Exception" />
             </wsdl:fault>
         </wsdl:operation>
-        <wsdl:operation name="getAllPersonalTrustedRelyingParties">
-            <soap:operation soapAction="urn:getAllPersonalTrustedRelyingParties" style="document" />
-            <wsdl:input>
-                <soap:body use="literal" />
-            </wsdl:input>
-            <wsdl:output>
-                <soap:body use="literal" />
-            </wsdl:output>
-        </wsdl:operation>
         <wsdl:operation name="createRelyingParty">
             <soap:operation soapAction="urn:createRelyingParty" style="document" />
             <wsdl:input>
                 <soap:body use="literal" />
             </wsdl:input>
+            <wsdl:fault name="Exception">
+                <soap:fault use="literal" name="Exception" />
+            </wsdl:fault>
         </wsdl:operation>
         <wsdl:operation name="createPPIDValueForUserTrustedRP">
             <soap:operation soapAction="urn:createPPIDValueForUserTrustedRP" style="document" />
@@ -374,6 +383,18 @@
                 <soap:body use="literal" />
             </wsdl:output>
         </wsdl:operation>
+        <wsdl:operation name="getAllUserTrustedRelyingParties">
+            <soap:operation soapAction="urn:getAllUserTrustedRelyingParties" style="document" />
+            <wsdl:input>
+                <soap:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap:body use="literal" />
+            </wsdl:output>
+            <wsdl:fault name="Exception">
+                <soap:fault use="literal" name="Exception" />
+            </wsdl:fault>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="RelyingPartyAdminServiceSoap12Binding" type="axis2:RelyingPartyAdminServicePortType">
         <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
@@ -391,12 +412,18 @@
             <wsdl:input>
                 <soap12:body use="literal" />
             </wsdl:input>
+            <wsdl:fault name="Exception">
+                <soap12:fault use="literal" name="Exception" />
+            </wsdl:fault>
         </wsdl:operation>
         <wsdl:operation name="create">
             <soap12:operation soapAction="urn:create" style="document" />
             <wsdl:input>
                 <soap12:body use="literal" />
             </wsdl:input>
+            <wsdl:fault name="Exception">
+                <soap12:fault use="literal" name="Exception" />
+            </wsdl:fault>
         </wsdl:operation>
         <wsdl:operation name="deleteRelyingParty">
             <soap12:operation soapAction="urn:deleteRelyingParty" style="document" />
@@ -433,6 +460,9 @@
             <wsdl:output>
                 <soap12:body use="literal" />
             </wsdl:output>
+            <wsdl:fault name="Exception">
+                <soap12:fault use="literal" name="Exception" />
+            </wsdl:fault>
         </wsdl:operation>
         <wsdl:operation name="createPPIDValueForRP">
             <soap12:operation soapAction="urn:createPPIDValueForRP" style="document" />
@@ -443,8 +473,8 @@
                 <soap12:fault use="literal" name="Exception" />
             </wsdl:fault>
         </wsdl:operation>
-        <wsdl:operation name="removePersonalTrustedRelyingParty">
-            <soap12:operation soapAction="urn:removePersonalTrustedRelyingParty" style="document" />
+        <wsdl:operation name="removeUserTrustedRelyingParty">
+            <soap12:operation soapAction="urn:removeUserTrustedRelyingParty" style="document" />
             <wsdl:input>
                 <soap12:body use="literal" />
             </wsdl:input>
@@ -452,20 +482,14 @@
                 <soap12:fault use="literal" name="Exception" />
             </wsdl:fault>
         </wsdl:operation>
-        <wsdl:operation name="getAllPersonalTrustedRelyingParties">
-            <soap12:operation soapAction="urn:getAllPersonalTrustedRelyingParties" style="document" />
-            <wsdl:input>
-                <soap12:body use="literal" />
-            </wsdl:input>
-            <wsdl:output>
-                <soap12:body use="literal" />
-            </wsdl:output>
-        </wsdl:operation>
         <wsdl:operation name="createRelyingParty">
             <soap12:operation soapAction="urn:createRelyingParty" style="document" />
             <wsdl:input>
                 <soap12:body use="literal" />
             </wsdl:input>
+            <wsdl:fault name="Exception">
+                <soap12:fault use="literal" name="Exception" />
+            </wsdl:fault>
         </wsdl:operation>
         <wsdl:operation name="createPPIDValueForUserTrustedRP">
             <soap12:operation soapAction="urn:createPPIDValueForUserTrustedRP" style="document" />
@@ -485,6 +509,18 @@
                 <soap12:body use="literal" />
             </wsdl:output>
         </wsdl:operation>
+        <wsdl:operation name="getAllUserTrustedRelyingParties">
+            <soap12:operation soapAction="urn:getAllUserTrustedRelyingParties" style="document" />
+            <wsdl:input>
+                <soap12:body use="literal" />
+            </wsdl:input>
+            <wsdl:output>
+                <soap12:body use="literal" />
+            </wsdl:output>
+            <wsdl:fault name="Exception">
+                <soap12:fault use="literal" name="Exception" />
+            </wsdl:fault>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:binding name="RelyingPartyAdminServiceHttpBinding" type="axis2:RelyingPartyAdminServicePortType">
         <http:binding verb="POST" />
@@ -545,21 +581,12 @@
                 <mime:content type="text/xml" part="createPPIDValueForRP" />
             </wsdl:input>
         </wsdl:operation>
-        <wsdl:operation name="removePersonalTrustedRelyingParty">
-            <http:operation location="RelyingPartyAdminService/removePersonalTrustedRelyingParty" />
+        <wsdl:operation name="removeUserTrustedRelyingParty">
+            <http:operation location="RelyingPartyAdminService/removeUserTrustedRelyingParty" />
             <wsdl:input>
-                <mime:content type="text/xml" part="removePersonalTrustedRelyingParty" />
+                <mime:content type="text/xml" part="removeUserTrustedRelyingParty" />
             </wsdl:input>
         </wsdl:operation>
-        <wsdl:operation name="getAllPersonalTrustedRelyingParties">
-            <http:operation location="RelyingPartyAdminService/getAllPersonalTrustedRelyingParties" />
-            <wsdl:input>
-                <mime:content type="text/xml" part="getAllPersonalTrustedRelyingParties" />
-            </wsdl:input>
-            <wsdl:output>
-                <mime:content type="text/xml" part="getAllPersonalTrustedRelyingParties" />
-            </wsdl:output>
-        </wsdl:operation>
         <wsdl:operation name="createRelyingParty">
             <http:operation location="RelyingPartyAdminService/createRelyingParty" />
             <wsdl:input>
@@ -581,6 +608,15 @@
                 <mime:content type="text/xml" part="getAllRelyingPartyList" />
             </wsdl:output>
         </wsdl:operation>
+        <wsdl:operation name="getAllUserTrustedRelyingParties">
+            <http:operation location="RelyingPartyAdminService/getAllUserTrustedRelyingParties" />
+            <wsdl:input>
+                <mime:content type="text/xml" part="getAllUserTrustedRelyingParties" />
+            </wsdl:input>
+            <wsdl:output>
+                <mime:content type="text/xml" part="getAllUserTrustedRelyingParties" />
+            </wsdl:output>
+        </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="RelyingPartyAdminService">
         <wsdl:port name="RelyingPartyAdminServiceHttpsSoap11Endpoint" binding="axis2:RelyingPartyAdminServiceSoap11Binding">

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/org/wso2/carbon/identity/provider/ui/i18n/Resources.properties
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/org/wso2/carbon/identity/provider/ui/i18n/Resources.properties?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/org/wso2/carbon/identity/provider/ui/i18n/Resources.properties	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/org/wso2/carbon/identity/provider/ui/i18n/Resources.properties	Sat Mar 28 05:36:03 2009
@@ -1,3 +1,3 @@
 openid.infocard=InfoCard/OpenID
-registration.options=Registration Options
-register.with.username.and.password=Register with username and password
+cert.import=Trusted relying party added successfully
+cert.cannot.import=Failed to add trusted relying party

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/add_trusted_rp.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/add_trusted_rp.jsp?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/add_trusted_rp.jsp	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/add_trusted_rp.jsp	Sat Mar 28 05:36:03 2009
@@ -26,7 +26,7 @@
 
 try {
 	user = (String) session.getAttribute("logged-user");
-	userTrustedRPs = client.getAllPersonalTrustedRelyingParties(user);
+	userTrustedRPs = client.getAllUserTrustedRelyingParties(user);
 } catch (Exception e) {
     CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request, e);
 %>

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/import-cert-finish.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/import-cert-finish.jsp?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/import-cert-finish.jsp	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.provider.ui/src/main/resources/web/identity-provider/import-cert-finish.jsp	Sat Mar 28 05:36:03 2009
@@ -10,11 +10,18 @@
 <%@page import="java.util.ResourceBundle" %>
 <%@page import="java.text.MessageFormat" %>
 <%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@page import="org.wso2.carbon.identity.provider.ui.client.RelyingPartyClient"%>
+<%@page import="org.wso2.carbon.identity.provider.ui.rp.dto.UserTrustedRPDTO"%>
 
 <%
     String forwardTo = null;
     String BUNDLE = "org.wso2.carbon.identity.provider.ui.i18n.Resources";
     ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE, request.getLocale());
+    UserTrustedRPDTO rpdto = null;
+    String loggedinUser = null;
+    
+    loggedinUser = (String) session.getAttribute("logged-user");
+    
     try {
         if (ServletFileUpload.isMultipartContent(request)) {
             List items = ProviderUtil.parseRequest(new ServletRequestContext(request));
@@ -30,27 +37,30 @@
                     fileName = fileName.substring(index+1);
                 } 
             }
+            
+            rpdto = new UserTrustedRPDTO();
+            rpdto.setUserName(loggedinUser);
 
             String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
             String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
             ConfigurationContext configContext =
                     (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
             RelyingPartyClient client = new RelyingPartyClient(cookie, backendServerURL, configContext);
-            client.(fileName, content);
+            client.createUserTrustedRP(rpdto,content);
             String message = resourceBundle.getString("cert.import");
-            forwardTo = "import-cert.jsp?keyStore=" + keyStore;
+            forwardTo = "add_trusted_rp.jsp";
             CarbonUIMessage.sendCarbonUIMessage(message, CarbonUIMessage.INFO, request);
         }
     } catch (Exception e) {
         String message = MessageFormat.format(resourceBundle.getString("cert.cannot.import"),
                 new Object[]{e.getMessage()});
-        forwardTo = "import-cert.jsp?keyStore=" + keyStore;
+        forwardTo = "add_trusted_rp.jsp";
         CarbonUIMessage.sendCarbonUIMessage(message, CarbonUIMessage.ERROR, request);
     }
 %>
 
 
-<%@page import="org.wso2.carbon.identity.provider.ui.client.RelyingPartyClient"%><script type="text/javascript">
+<script type="text/javascript">
     function forward() {
         location.href = "<%=forwardTo%>";
     }

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/Initializer.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/Initializer.java?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/Initializer.java	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/Initializer.java	Sat Mar 28 05:36:03 2009
@@ -85,39 +85,37 @@
 	private void addKeyStores() throws SecurityConfigException {
 		String storeFilePath = null;
 		KeyStoreAdmin keyAdmin = null;
-		ServerConfiguration serverConfig = null;
 		String password = null;
 		String type = null;
 		String privateKeyPass = null;
 
-		serverConfig = ServerConfiguration.getInstance();
-		storeFilePath = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
-		password = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_PASSWORD);
-		type = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_TYPE);
-		privateKeyPass = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_KEY_PASSWORD);
+		storeFilePath = IdentityUtil
+				.getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
+		password = IdentityUtil
+				.getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_PASSWORD);
+		type = IdentityUtil.getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_TYPE);
+		privateKeyPass = IdentityUtil
+				.getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_KEY_PASSWORD);
 
 		keyAdmin = new KeyStoreAdmin(IdentityUtil.getRegistry());
 		keyAdmin.addKeyStoreWithFilePath(storeFilePath, new File(storeFilePath).getName(),
 				password, "", type, privateKeyPass);
 
-		storeFilePath = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_PERSONAL_STORE_LOCATION);
-		password = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_PERSONAL_STORE_PASSWORD);
-		type = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_PERSONAL_STORE_TYPE);
-		privateKeyPass = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_PERSONAL_KEY_PASSWORD);
-
-		//TODO
-		/*keyAdmin.addKeyStoreWithFilePath(storeFilePath, new File(storeFilePath).getName(),
-				password, "", type, privateKeyPass);*/
+		storeFilePath = IdentityUtil
+				.getProperty(IdentityConstants.ServerConfig.USER_PERSONAL_STORE_LOCATION);
+		password = IdentityUtil
+				.getProperty(IdentityConstants.ServerConfig.USER_PERSONAL_STORE_PASSWORD);
+		type = IdentityUtil.getProperty(IdentityConstants.ServerConfig.USER_PERSONAL_STORE_TYPE);
+		privateKeyPass = IdentityUtil
+				.getProperty(IdentityConstants.ServerConfig.USER_PERSONAL_KEY_PASSWORD);
+
+		// TODO
+		/*
+		 * keyAdmin.addKeyStoreWithFilePath(storeFilePath, new File(storeFilePath).getName(),
+		 * password, "", type, privateKeyPass);
+		 */
 	}
-	
+
 	private void addDialectsAndClaims() throws IdentityProviderException, AxisFault {
 
 		IdentityPersistenceManager dbAdmin = null;

Modified: trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/admin/RelyingPartyAdmin.java
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/admin/RelyingPartyAdmin.java?rev=32788&r1=32787&r2=32788&view=diff
==============================================================================
--- trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/admin/RelyingPartyAdmin.java	(original)
+++ trunk/carbon-components/identity/org.wso2.carbon.identity.provider/src/main/java/org/wso2/carbon/identity/provider/admin/RelyingPartyAdmin.java	Sat Mar 28 05:36:03 2009
@@ -28,12 +28,12 @@
 import org.wso2.carbon.identity.core.model.RelyingPartyDO;
 import org.wso2.carbon.identity.core.model.UserTrustedRPDO;
 import org.wso2.carbon.identity.core.persistence.IdentityPersistenceManager;
+import org.wso2.carbon.identity.core.util.IdentityUtil;
 import org.wso2.carbon.identity.provider.IdentityProviderConstants;
 import org.wso2.carbon.identity.provider.IdentityProviderException;
 import org.wso2.carbon.identity.provider.IdentityProviderUtil;
 import org.wso2.carbon.security.SecurityConfigException;
 import org.wso2.carbon.security.keystore.KeyStoreAdmin;
-import org.wso2.carbon.utils.ServerConfiguration;
 
 public class RelyingPartyAdmin {
 
@@ -106,7 +106,7 @@
 	public UserTrustedRPDO[] getAllPersonalRelyingParties(String userId) {
 		return dbMan.getAllPersonalRelyingParties(userId);
 	}
-	
+
 	public UserTrustedRPDO[] getAllUserTrustedRelyingParties(String userId) {
 		return dbMan.getAllUserTrustedRPs(userId);
 	}
@@ -116,24 +116,26 @@
 		KeyStoreAdmin keyAdmin = null;
 		UserTrustedRPDO rpdo = null;
 		String storeFilePath = null;
-		ServerConfiguration serverConfig = null;
-
-		serverConfig = ServerConfiguration.getInstance();
-		storeFilePath = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
 
+		storeFilePath = IdentityUtil.getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
 		keyAdmin = new KeyStoreAdmin(IdentityProviderUtil.getRegistry());;
 		try {
-			keyAdmin.importCertToStore(hostName, content, new File(storeFilePath).getName());
+			if (hostName == null) {
+				hostName = keyAdmin.importCertToStore(content, new File(storeFilePath).getName());
+			} else {
+				keyAdmin.importCertToStore(hostName, content, new File(storeFilePath).getName());
+			}
 		} catch (SecurityConfigException e) {
 			throw new IdentityProviderException(e.getMessage(), e);
 		}
-		rpdo = new UserTrustedRPDO();
-		rpdo.setHostName(hostName);
-		rpdo.setUserId(userName);
-		dbMan.createUserTrustedRP(rpdo);
-	}
 
+		if (hostName != null) {
+			rpdo = new UserTrustedRPDO();
+			rpdo.setHostName(hostName);
+			rpdo.setUserId(userName);
+			dbMan.createUserTrustedRP(rpdo);
+		}
+	}
 	/**
 	 * Remove a personal relying party
 	 * 
@@ -143,7 +145,6 @@
 	public void removeUserTrustedRelyingParty(String user, String hostName)
 			throws IdentityProviderException {
 		UserTrustedRPDO rpDO = null;
-		ServerConfiguration serverConfig = null;
 		String storeFilePath = null;
 		KeyStoreAdmin keyAdmin = null;
 		IdentityPersistenceManager dbman = null;
@@ -152,9 +153,7 @@
 		rpDO = dbMan.getUserTrustedRelyingParty(user, hostName);
 		dbMan.deletePersonalRelyingParty(rpDO);
 
-		serverConfig = ServerConfiguration.getInstance();
-		storeFilePath = serverConfig
-				.getFirstProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
+		storeFilePath = IdentityUtil.getProperty(IdentityConstants.ServerConfig.USER_TRUSTED_RP_STORE_LOCATION);
 
 		rpdo = new UserTrustedRPDO();
 		rpdo.setHostName(hostName);



More information about the Carbon-dev mailing list