You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by re...@apache.org on 2016/10/03 15:50:08 UTC
[42/51] [partial] clerezza git commit: CLEREZZA-1012: reduced
clerezza to core components, the rest stays in legacy-branch
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/LICENSE
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/LICENSE b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/LICENSE
deleted file mode 100644
index 261eeb9..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml
deleted file mode 100644
index 7a7b7f9..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/pom.xml
+++ /dev/null
@@ -1,198 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
-
- 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.
-
---><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">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.accountcontrolpanel</artifactId>
- <version>0.10</version>
- </parent>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.accountcontrolpanel.core</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
- <name>Clerezza - Platform Account Control Panel Core</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.scala-tools</groupId>
- <artifactId>maven-scala-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!-- <scalaVersion>${scala.version}</scalaVersion> -->
- <!-- <args>
- <arg>-target:jvm-1.5</arg>
- </args> -->
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Service-Component>OSGI-INF/serviceComponents.xml</Service-Component>
- <Export-Package>org.apache.clerezza.platform.accountcontrolpanel.*</Export-Package>
- <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.xsite</groupId>
- <artifactId>xsite-maven-plugin</artifactId>
- <configuration>
- <sourceDirectoryPath>${basedir}/src/site/xsite</sourceDirectoryPath>
- <sitemapPath>content/sitemap.xml</sitemapPath>
- <skinPath>templates/skin.html</skinPath>
- <outputDirectoryPath>${basedir}/target/site/documentation</outputDirectoryPath>
- </configuration>
- <executions>
- <execution>
- <phase>pre-site</phase>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.scala.utils</artifactId>
- <version>0.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.ontologies</artifactId>
- <version>0.12</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>jaxrs.utils</artifactId>
- <version>0.9</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.typerendering.seedsnipe</artifactId>
- <version>0.7</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.typerendering.scalaserverpages</artifactId>
- <version>0.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.users.core</artifactId>
- <version>0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.config</artifactId>
- <version>0.4</version>
- </dependency>
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.typerendering.scala</artifactId>
- <version>0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.globalmenu.api</artifactId>
- <version>0.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.accountcontrolpanel.ontologies</artifactId>
- <version>0.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.usermanager</artifactId>
- <version>0.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>web.fileserver</artifactId>
- <version>0.10</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>permissiondescriptions</artifactId>
- <version>0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>ssl.keygen.base</artifactId>
- <version>0.6</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.security.foafssl.ontologies</artifactId>
- <version>0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.clerezza.ext</groupId>
- <artifactId>slf4j-scala-api</artifactId>
- <version>1.6.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.commons.security.core</artifactId>
- <version>0.11.0</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/scripts/IEKeygen.js
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/scripts/IEKeygen.js b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/scripts/IEKeygen.js
deleted file mode 100644
index 6d0803d..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/scripts/IEKeygen.js
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-/**
- *
- * Copyright (c) 2008-2010, The University of Manchester, United Kingdom. All
- * rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer. Redistributions in binary
- * form must reproduce the above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or other materials provided
- * with the distribution. Neither the name of the The University of Manchester
- * nor the names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * Author........: Bruno Harbulot
- *
- */
-
-
-
-function createCsrCertEnroll(enrollFactObj, keylength) {
- /*
- * Creates a CX509EnrollmentWebClassFactory (used to create all the other
- * objects).
- */
- if (enrollFactObj == null) {
- enrollFactObj = new ActiveXObject(
- "X509Enrollment.CX509EnrollmentWebClassFactory");
- }
-
- /*
- * Load the information about the providers.
- */
- var providerInfosObj = enrollFactObj
- .CreateObject("X509Enrollment.CCspInformations");
- providerInfosObj.AddAvailableCsps();
-
- /*
- * Find the provider of RSA type (sufficient for this example). The type
- * numbers for this are 1, 2 and 24.
- * http://msdn.microsoft.com/en-us/library/aa379427%28VS.85%29.aspx
- */
- var providerType = -1;
- var providerName = null;
- for ( var i = 0; i < providerInfosObj.Count; i++) {
- var providerInfoObj = providerInfosObj.ItemByIndex(i);
- switch (providerInfoObj.Type) {
- case 1:
- case 2:
- case 24:
- providerType = providerInfoObj.Type;
- providerName = providerInfoObj.Name;
- break;
- default:
- }
- }
-
- /*
- * Creates a 2048-bit key with this provider.
- */
- var privKeyObj = enrollFactObj
- .CreateObject("X509Enrollment.CX509PrivateKey");
- privKeyObj.ProviderType = providerInfoObj.Type;
- privKeyObj.KeySpec = 1;
- privKeyObj.Length = keylength;
- // http://msdn.microsoft.com/en-us/library/aa379024%28VS.85%29.aspx
- privKeyObj.MachineContext = false;
- // http://msdn.microsoft.com/en-us/library/aa379414%28VS.85%29.aspx
- privKeyObj.KeyProtection = 2;
- // http://msdn.microsoft.com/en-us/library/aa379002%28VS.85%29.aspx
- privKeyObj.ExportPolicy = 1;
-
- /*
- * Creates the PKCS#10 object and initialise as a user context.
- */
- var pkcs10CsrObj = enrollFactObj
- .CreateObject("X509Enrollment.CX509CertificateRequestPkcs10");
- pkcs10CsrObj.InitializeFromPrivateKey(1, privKeyObj, "");
-
- /*
- * Creates the enrolment object and exports the CSR.
- */
- var enrollObj = enrollFactObj
- .CreateObject("X509Enrollment.CX509Enrollment");
- enrollObj.InitializeFromRequest(pkcs10CsrObj);
- var csr = enrollObj.CreateRequest(1);
- csr = "-----BEGIN CERTIFICATE REQUEST-----\r\n" + csr
- + "-----END CERTIFICATE REQUEST-----";
-
- /*
- * Makes the request to the server.
- */
- xmlHttpRequest = createRequest(csr);
-
- /**
- * What to do on response
- */
- xmlHttpRequest.onreadystatechange = function() {
- if (xmlHttpRequest.readyState == 4) {
- if (xmlHttpRequest.status == 200) {
- /*
- * Installs the certificate.
- */
- try {
- enrollObj.InstallResponse(4, xmlHttpRequest.responseText,
- 0, "");
- window.alert("A certificate has been installed.");
- } catch (e1) {
- try {
- enrollObj.InstallResponse(0,
- xmlHttpRequest.responseText, 0, "");
- window.alert("A certificate has been installed.");
- } catch (e2) {
- window
- .alert("You're probably using Vista without SP1 or above, in which case you need to add the certificate of this authority as a trusted root certificate (not recommended in general).");
- }
- }
- } else {
- window.alert("The server returned an error status: "
- + xmlHttpRequest.status);
- }
- }
- }
-}
-
-
-function createRequest(csrString) {
- var xmlHttpRequest = new XMLHttpRequest();
-
- xmlHttpRequest.open("POST", kgnFloctn, true);
-
- var params = "webId=" + encodeURIComponent(document.getElementById("webId").value);
- params += "&cn=" + encodeURIComponent(document.getElementById("cn").value);
- params += "&csr=" + encodeURIComponent(csrString);
- params += "&days="+encodeURIComponent(document.getElementById("days").value);
- params += "&hours="+encodeURIComponent(document.getElementById("hours").value);
-
- xmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xmlHttpRequest.setRequestHeader("Content-length", params.length);
- xmlHttpRequest.setRequestHeader("Connection", "close");
-
- xmlHttpRequest.send(params);
-
- return xmlHttpRequest;
-
-}
-
-
-function createCsrXenroll(enrollObj, keylength) {
- if (enrollObj == null) {
- enrollObj = new ActiveXObject("CEnroll.CEnroll");
- }
-
- // http://msdn.microsoft.com/en-us/library/aa379941%28VS.85%29.aspx
- // CRYPT_EXPORTABLE: 1?
- enrollObj.GenKeyFlags = (keylength * 256 * 256) + 1;
- enrollObj.KeySpec = 2;
-
- var csr = enrollObj.createPKCS10("", "");
- csr = "-----BEGIN CERTIFICATE REQUEST-----\r\n" + csr
- + "-----END CERTIFICATE REQUEST-----";
-
- xmlHttpRequest = createRequest(csr);
-
- xmlHttpRequest.onreadystatechange = function() {
- if (xmlHttpRequest.readyState == 4) {
- if (xmlHttpRequest.status == 200) {
- enrollObj.acceptPKCS7(xmlHttpRequest.responseText);
- window.alert("A certificate has been installed.");
- } else {
- window.alert("The server returned an error status: "
- + xmlHttpRequest.status);
- }
- }
- }
-}
-
-function createCsr() {
- var keystrengthSelectElem = document.getElementById("keylength");
- var keylength = keystrengthSelectElem.value;
-
- var enrollFactObj = null;
- try {
- enrollFactObj = new ActiveXObject(
- "X509Enrollment.CX509EnrollmentWebClassFactory");
- } catch (e) {
- }
-
- if (enrollFactObj != null) {
- createCsrCertEnroll(enrollFactObj, keylength);
- } else {
- var enrollObj = null;
- try {
- enrollObj = new ActiveXObject("CEnroll.CEnroll");
- } catch (e) {
- }
- if (enrollObj != null) {
- createCsrXenroll(enrollObj, keylength);
- } else {
- window.alert("ActiveX certificate creation not supported or not enabled.");
- }
- }
-}
-// kgnFloctn needs to be calculated first
-var kgnFloctn = "errorKeyGenLoctn";
-function configurePage() {
- kgnFloctn = document.getElementById("keygenform").getAttribute("action");
-
- var keygenElem = document.getElementById("spkac");
-
- if (navigator.appName == "Microsoft Internet Explorer") {
- var keygenFormElem = document.getElementById("keygenform");
- keygenFormElem.removeAttribute("action");
- keygenFormElem.removeAttribute("method");
-
- /*
- * Try the ActiveX approach, assume Internet Explorer.
- */
-
- var iehelptextElem = document.getElementById("iehelptext");
- iehelptextElem.style.display = "block";
-
- var submitButtonElem = document.getElementById("keygensubmit");
- var newSumbitButtonElem = document.createElement("input");
- newSumbitButtonElem.setAttribute("type", "button");
- newSumbitButtonElem.setAttribute("value", "Submit");
- submitButtonElem.parentNode.replaceChild(newSumbitButtonElem,
- submitButtonElem);
- submitButtonElem = newSumbitButtonElem;
-
- if (submitButtonElem.attachEvent) {
- submitButtonElem.attachEvent("onclick", createCsr);
- } else {
- submitButtonElem.setAttribute("onclick", "createCsr()");
- }
-
- var keystrengthSelectElem = document.createElement("select");
- keystrengthSelectElem.setAttribute("id", "keylength");
- keystrengthSelectElem.setAttribute("name", "keylength");
- var optionElem;
- optionElem = document.createElement("option");
- optionElem.setAttribute("value", "1024");
- optionElem.appendChild(document.createTextNode("1024"));
- keystrengthSelectElem.appendChild(optionElem);
- optionElem = document.createElement("option");
- optionElem.setAttribute("value", "2048");
- optionElem.appendChild(document.createTextNode("2048"));
- keystrengthSelectElem.appendChild(optionElem);
- var keystrengthTdElem = document.getElementById("keystrenghtd");
- keystrengthTdElem.appendChild(keystrengthSelectElem);
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/scripts/profile.js
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/scripts/profile.js b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/scripts/profile.js
deleted file mode 100644
index 6ad1db2..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/scripts/profile.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-$(document).ready(function() {
- $('#newWebIdButton').click(function() {
- $("#newOrExistingSelection").css({display: "none"})
- $("#createNewWebId").css({display: "block"})
- });
- $("#existingWebIdButton").click(function() {
- $("#newOrExistingSelection").css({display: "none"})
- $("#setExistingWebId").css({display: "block"})
- });
- $("#keygenform").submit(function() {
- return spkacFix();
- });
-});
-
-var crmfObject;
-function setCRMFRequest() {
- var hiddenField = $("<input type=\"hidden\" name=\"crmf\" id=\"crmf\" \/>");
- $("#keygenform").append(hiddenField)
- //var formContents = $("#keygenform").serialize();
- //var newContents = jQuery.extend({}, formContents);
- hiddenField.val(crmfObject.request)
- $("#keygenform").submit()
-}
-
-function spkacFix() {
-
- if ($("#spkac").val()) {
- return true;
- } else {
- if ($("#crmf").val()) {
- return true;
- }
- //alert("fix needed by firefox in xhtml mode")
- crmfObject = crypto.generateCRMFRequest(
- 'CN=Ignored',
- "regToken", "authenticator", // not sure
- null, // base-64 cert for key
- // escrow. set this to null
- "setCRMFRequest();", // callback
- 2048, null, "rsa-dual-use"); // key parameters
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/style/profile.css
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/style/profile.css b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/style/profile.css
deleted file mode 100644
index 64e52c4..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/CLEREZZA-INF/web-resources/account-control-panel/style/profile.css
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-#associateSelection {
- width: 80%
-}
-#createNewWebId {
- display: none
-}
-#setExistingWebId {
- display: none
-}
-/* we need to override a table td:first-child in /style/table.css */
-td.propvalue:first-child {
- text-align: right;
-}
-
-td.formlabel:first-child {
- width: 10em;
- text-align: right;
-}
-
-td.multiline:first-child {
- vertical-align: text-top;
-}
-
-img.mugshot {
- width: 80px;
-}
-
-td.personInABox {
- width: 100px;
-}
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml
deleted file mode 100644
index 8e50481..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/resources/OSGI-INF/serviceComponents.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?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.
-
--->
-
-<components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
- <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.AcpPermissionDescriptionsProvider">
- <implementation class="org.apache.clerezza.platform.accountcontrolpanel.AcpPermissionDescriptionsProvider"/>
- <service servicefactory="false">
- <provide interface="org.apache.clerezza.permissiondescriptions.PermissionDescriptionsProvider"/>
- </service>
- <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.AcpPermissionDescriptionsProvider"/>
- </scr:component>
-
- <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.MenuItemProvider">
- <implementation class="org.apache.clerezza.platform.accountcontrolpanel.MenuItemProvider"/>
- <service servicefactory="false">
- <provide interface="org.apache.clerezza.platform.dashboard.GlobalMenuItemsProvider"/>
- </service>
- <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.MenuItemProvider"/>
- </scr:component>
-
- <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.SettingsPanel">
- <implementation class="org.apache.clerezza.platform.accountcontrolpanel.SettingsPanel"/>
- <service servicefactory="false">
- <provide interface="java.lang.Object"/>
- </service>
- <property name="javax.ws.rs" type="Boolean" value="true"/>
- <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.SettingsPanel"/>
- <reference name="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin" cardinality="0..1" policy="dynamic" bind="bindConfigurationAdmin" unbind="unbindConfigurationAdmin"/>
- <reference name="systemGraph" interface="org.apache.clerezza.rdf.core.MGraph" cardinality="1..1" policy="static" target="(name=urn:x-localinstance:/system.graph)" bind="bindSystemGraph" unbind="unbindSystemGraph"/>
- <reference name="cgProvider" interface="org.apache.clerezza.platform.graphprovider.content.ContentGraphProvider" cardinality="1..1" policy="static" bind="bindCgProvider" unbind="unbindCgProvider"/>
- </scr:component>
- <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.SettingsPanel">
- <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.SettingsPanel"/>
- <service servicefactory="false">
- <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
- </service>
- <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.SettingsPanel"/>
- </scr:component>
-
-
- <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.ProfilePanel">
- <implementation class="org.apache.clerezza.platform.accountcontrolpanel.ProfilePanel"/>
- <service servicefactory="false">
- <provide interface="java.lang.Object"/>
- </service>
- <property name="javax.ws.rs" type="Boolean" value="true"/>
- <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.ProfilePanel"/>
- <reference name="userManager" interface="org.apache.clerezza.platform.usermanager.UserManager"
- cardinality="1..1" policy="static" bind="bindUserManager" unbind="unbindUserManager"/>
- <reference name="graphNodeProvider" interface="org.apache.clerezza.rdf.utils.graphnodeprovider.GraphNodeProvider"
- cardinality="1..1" policy="static" bind="bindGraphNodeProvider" unbind="unbindGraphNodeProvider"/>
- <reference name="keygenSrvc" interface="org.apache.clerezza.ssl.keygen.KeygenService"
- cardinality="1..1" policy="static" bind="bindKeygenSrvc" unbind="unbindKeygenSrvc"/>
- <reference name="webIdGraphsService" interface="org.apache.clerezza.platform.users.WebIdGraphsService"
- cardinality="1..1" policy="static" bind="bindWebIdGraphsService" unbind="unbindWebIdGraphsService"/>
- <reference name="platformConfig" interface="org.apache.clerezza.platform.config.PlatformConfig"
- cardinality="1..1" policy="static" bind="bindPlatformConfig" unbind="unbindPlatformConfig"/>
- <reference name="tcManager" interface="org.apache.clerezza.rdf.core.access.TcManager"
- cardinality="1..1" policy="static" bind="bindTcManager" unbind="unbindTcManager"/>
- </scr:component>
- <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.ProfilePanel">
- <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.ProfilePanel"/>
- <service servicefactory="false">
- <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
- </service>
- <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.ProfilePanel"/>
- </scr:component>
- <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.ContactConfirmRenderlet">
- <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.ContactConfirmRenderlet"/>
- <service servicefactory="false">
- <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
- </service>
- <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.ContactConfirmRenderlet"/>
- </scr:component>
- <scr:component enabled="true" name="org.apache.clerezza.platform.accountcontrolpanel.html.PersonBox">
- <implementation class="org.apache.clerezza.platform.accountcontrolpanel.html.PersonBox"/>
- <service servicefactory="false">
- <provide interface="org.apache.clerezza.platform.typerendering.TypeRenderlet"/>
- </service>
- <property name="service.pid" value="org.apache.clerezza.platform.accountcontrolpanel.html.PersonBox"/>
- </scr:component>
-</components>
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/AcpPermissionDescriptionsProvider.scala
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/AcpPermissionDescriptionsProvider.scala b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/AcpPermissionDescriptionsProvider.scala
deleted file mode 100644
index 5d41410..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/AcpPermissionDescriptionsProvider.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.clerezza.platform.accountcontrolpanel
-
-import java.util.HashSet
-import java.util.Set
-import org.apache.clerezza.permissiondescriptions.PermissionDescriptionsProvider
-import org.apache.clerezza.permissiondescriptions.PermissionDescripton
-import org.apache.felix.scr.annotations.Component
-import org.apache.felix.scr.annotations.Service
-
-/**
- * <code>PermissionDescriptionsProvider</code> implementation that provides
- * <code>PermissionDescripton</code>s of Account Control Panel permissions.
- * The following permissions are described:
- * <ul>
- * <li>org.apache.clerezza.platform.accountcontrolpanel.AccountControlPanelAppPermission</li>
- * <li>org.apache.clerezza.platform.accountcontrolpanel.ChangePasswordPermission</li>
- * <li>org.apache.clerezza.platform.accountcontrolpanel.UserBundlePermission</li>
- * </ul>
- *
- * @author mir
- */
-object AcpPermissionDescriptionsProvider {
- private val ACP_PERMISSION_DESCRIPTIONS: Set[PermissionDescripton] = new HashSet[PermissionDescripton]
- ACP_PERMISSION_DESCRIPTIONS.add(
- new PermissionDescripton("Change Own Password Permission",
- "Grants permission to the user to change its own password",
- null, classOf[ChangePasswordPermission],
- "(org.apache.clerezza.platform.accountcontrolpanel.ChangePasswordPermission \"{username}\" \"\")"
- )
- )
-
- ACP_PERMISSION_DESCRIPTIONS.add(
- new PermissionDescripton("Access Own Account Control Panel Permission",
- "Grants permission to the user to access its own Account Control Panel",
- null, classOf[AccountControlPanelAppPermission],
- "(org.apache.clerezza.platform.accountcontrolpanel.AccountControlPanelAppPermission \"{username}\" \"\")"
- )
- )
-
- ACP_PERMISSION_DESCRIPTIONS.add(
- new PermissionDescripton("Bundle Upload Permission",
- "Grants permission to the user to upload a bundle",
- null, classOf[AccountControlPanelAppPermission],
- "(org.apache.clerezza.platform.accountcontrolpanel.UserBundlePermission \"{username}\" \"\")"
- )
- )
-
-}
-
-class AcpPermissionDescriptionsProvider extends PermissionDescriptionsProvider {
-
- import AcpPermissionDescriptionsProvider._
-
- def getPermissionDescriptors: Set[PermissionDescripton] = {
- return ACP_PERMISSION_DESCRIPTIONS
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/MenuItemProvider.scala
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/MenuItemProvider.scala b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/MenuItemProvider.scala
deleted file mode 100644
index ce09780..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/MenuItemProvider.scala
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.clerezza.platform.accountcontrolpanel
-
-import java.io.UnsupportedEncodingException
-import java.net.URLEncoder
-import java.security.AccessControlContext
-import java.security.AccessControlException
-import java.security.AccessController
-import java.security.Principal
-import java.security.PrivilegedActionException
-import java.security.PrivilegedExceptionAction
-import java.util.HashSet
-import java.util.Iterator
-import java.util.Set
-import javax.security.auth.Subject
-import org.apache.felix.scr.annotations.Component
-import org.apache.felix.scr.annotations.Service
-import org.apache.clerezza.platform.globalmenu.GlobalMenuItem
-import org.apache.clerezza.platform.globalmenu.GlobalMenuItemsProvider
-import org.apache.stanbol.commons.security.UserUtil
-
-/**
- *
- * Provides menu-item to profile or settings-panel or none depending on user
- * permissions.
- *
- * @author reto
- */
-class MenuItemProvider extends GlobalMenuItemsProvider {
- def getMenuItems: Set[GlobalMenuItem] = {
- var items: Set[GlobalMenuItem] = new HashSet[GlobalMenuItem]
- var userName: String = UserUtil.getCurrentUserName
- if (userName != null) {
- try {
- AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
- }
- catch {
- case e: AccessControlException => {
- return items
- }
- }
- try {
- var path: String = "/user/" + URLEncoder.encode(userName, "utf-8") + "/control-panel"
- items.add(new GlobalMenuItem(path, "ACP", "Account Control Panel", 5, "Administration"))
- }
- catch {
- case e: UnsupportedEncodingException => {
- throw new RuntimeException(e)
- }
- }
- }
- return items
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/clerezza/blob/14575ea3/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala
----------------------------------------------------------------------
diff --git a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala b/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala
deleted file mode 100644
index d46f9f1..0000000
--- a/platform/accountcontrolpanel/platform.accountcontrolpanel.core/src/main/scala/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.scala
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * 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.clerezza.platform.accountcontrolpanel
-
-import java.util.List
-import java.util.Arrays
-import java.util.Collections
-import java.util.Iterator
-import ontologies.CONTROLPANEL
-import org.apache.clerezza.rdf.utils.graphnodeprovider.GraphNodeProvider
-import org.apache.clerezza.ssl.keygen.CertSerialisation
-import org.apache.clerezza.ssl.keygen.Certificate
-import org.apache.clerezza.foafssl.ontologies.CERT
-import org.apache.clerezza.foafssl.ontologies.RSA
-import org.apache.clerezza.jaxrs.utils.RedirectUtil
-import org.apache.clerezza.jaxrs.utils.TrailingSlash
-import org.apache.clerezza.platform.config.PlatformConfig
-import org.apache.clerezza.platform.usermanager.UserManager
-import org.apache.clerezza.rdf.core._
-import org.apache.clerezza.platform.Constants
-import access.TcManager
-import impl.{SimpleMGraph, TripleImpl}
-import org.apache.clerezza.rdf.utils.GraphNode
-import org.apache.clerezza.rdf.utils.UnionMGraph
-import org.osgi.service.component.ComponentContext
-import javax.ws.rs._
-import javax.ws.rs.core.Context
-import javax.ws.rs.core.MediaType
-import javax.ws.rs.core.Response
-import javax.ws.rs.core.UriInfo
-import java.math.BigInteger
-import java.security.AccessController
-import java.security.PrivilegedAction
-import java.security.interfaces.RSAPublicKey
-import org.apache.clerezza.ssl.keygen.KeygenService
-import java.net.URI
-import org.apache.clerezza.rdf.core.access.security.TcPermission
-import org.apache.clerezza.rdf.ontologies._
-import org.slf4j.scala.Logging
-import org.apache.clerezza.platform.users.{WebIdInfo, WebIdGraphsService}
-import org.apache.clerezza.rdf.scala.utils._
-
-/**
- * Presents a panel where the user can create a webid and edit her profile.
- *
- * @author reto
- */
-
-@Path("/user/{id}/profile")
-class ProfilePanel extends Logging {
-
- import collection.JavaConversions._
- import Preamble._
-
- /**
- * Returns a GraphNode describing a ProfilePage for the user identified by
- * the specified UserName. A ProfilePage resourcve is retuned for any user
- * disregarding if they have a WebId and if this is local. The renderlet
- * may provide instrcutions on how a WebId is created for users that do
- * not have a WebId and redirect them to their WebId provider if they have
- * a remote WebId.
- */
- @GET
- def getPersonalProfilePage(@Context uriInfo: UriInfo,
- @PathParam(value = "id") userName: String): GraphNode = {
- TrailingSlash.enforceNotPresent(uriInfo)
- //not checking as public profile must be public, more selective access control TBD
- //AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
- val resultNode= getPersonalProfile(userName, uriInfo)
- return resultNode
- }
-
- private def getPersonalProfile(userName: String, info: UriInfo): GraphNode = {
- lazy val suggestedPPDUri = getSuggestedPPDUri(userName)
-
- val profile = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
- def run: GraphNode = {
- val userInSysGraph = userManager.getUserInSystemGraph(userName)
- val userResource = userInSysGraph.getNode
- val profile: GraphNode = userResource match {
- case blank: BNode => {
- //user does not have a webId yet
- val g = new EzMGraph()
- import g._
- val profile = bnode
- (profile -- CONTROLPANEL.isLocalProfile --> bool2lit(true)
- -- CONTROLPANEL.suggestedPPDUri --> suggestedPPDUri
- -- FOAF.primaryTopic --> (bnode -- PLATFORM.userName --> userName))
- profile
- }
- case webid: UriRef => {
- var webIDInfo = webIdGraphsService.getWebIdInfo(webid)
- var res = new GraphNode(suggestedPPDUri, new UnionMGraph(new SimpleMGraph, webIDInfo.localPublicUserData))
- (res -- CONTROLPANEL.isLocalProfile --> bool2lit(webIDInfo.isLocal)
- -- FOAF.primaryTopic --> webid)
- res
- }
- }
- /*val friendInfo:Iterator[TripleCollection] = for (kn: Triple <- profile.getGraph.filter(userResource.asInstanceOf[NonLiteral], FOAF.knows, null)
- if kn.getObject.isInstanceOf[UriRef];
- friend = kn.getObject.asInstanceOf[UriRef]
- if (friend != suggestedPPDUri)
- ) yield {
- try {
- val friendGraph = tcManager.getGraph(FoafBrowser.removeHash(friend))
- new RichGraphNode(friend, friendGraph).getNodeContext
- } catch {
- case e => {
- logger.warn("cought exception trying to fetch graph - these graphs should already be in store " + friend, e)
- new EzMGraph() {
- friend -- SKOS.note --> ("problem with fetching this node: " + e)
- }
- }
- }
- }
- //vera bad: mixing data from different sources
- for (g <- friendInfo) profile.getGraph.addAll(g) */
- profile
- }
- })
-
-
- (profile a PLATFORM.HeadedPage
- a CONTROLPANEL.ProfilePage)
- }
-
- /**
- * @param userName
- * @return the suggested Personal Profile Document URI
- */
- def getSuggestedPPDUri(userName: String): UriRef = {
- return new UriRef(platformConfig.getDefaultBaseUri.getUnicodeString + "user/" + userName + "/profile")
- }
-
- @POST
- @Path("set-existing-webid")
- def setExistingWebId(@Context uriInfo: UriInfo,
- @FormParam("webid") webId: UriRef,
- @PathParam(value = "id") userName: String): Response = {
- AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
- return AccessController.doPrivileged(new PrivilegedAction[Response] {
- def run: Response = {
- var userInSystemGraph: GraphNode = userManager.getUserInSystemGraph(userName)
- userInSystemGraph.replaceWith(webId)
- return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
- }
- })
- }
-
- @POST
- @Path("create-new-web-id")
- def createNewWebId(@Context uriInfo: UriInfo,
- @PathParam(value = "id") userName: String): Response = {
- val ppd: UriRef = getSuggestedPPDUri(userName)
- val webId: UriRef = new UriRef(ppd.getUnicodeString + "#me")
- AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
- return AccessController.doPrivileged(new PrivilegedAction[Response] {
- def run: Response = {
- userManager.assignPermissionsToUser(userName, java.util.Collections.singletonList(new TcPermission(
- webId.getUnicodeString, TcPermission.READWRITE).toString))
- tcManager.getTcAccessController.setRequiredReadPermissionStrings(
- ppd, Collections.singleton(new TcPermission(
- Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ).toString))
- tcManager.createMGraph(ppd)
- val webIDInfo = webIdGraphsService.getWebIdInfo(webId)
- webIDInfo.localPublicUserData.addAll(
- Arrays.asList(
- new TripleImpl(ppd, RDF.`type`, FOAF.PersonalProfileDocument),
- new TripleImpl(ppd, FOAF.primaryTopic, webId))
- )
- var userInSystemGraph: GraphNode = userManager.getUserInSystemGraph(userName)
- userInSystemGraph.replaceWith(webId)
- return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
- }
- })
- }
-
- /**
- * Presents a confirmation form for adding a contact
- */
- @GET
- @Path("addContact")
- def addContactConfirm(@PathParam(value = "id") userName: String,
- @QueryParam("contactWebId") contactWebId: UriRef): GraphNode = {
- AccessController.checkPermission(new AccountControlPanelAppPermission(userName, ""))
- val contactNode = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
- def run = {
- graphNodeProvider.get(contactWebId);
- }
- })
- val resultGraph = new EzMGraph(new UnionMGraph(new SimpleMGraph, contactNode.getGraph))
- import resultGraph._
- val result: GraphNode = bnode
- result a CONTROLPANEL.ContactConfirmPage
- result -- FOAF.primaryTopic --> contactNode
- }
-
- @POST
- @Path("addContact")
- def addContact(@PathParam(value = "id") userName: String, @Context uriInfo: UriInfo,
- @FormParam("webId") newContacts: java.util.List[UriRef]): Response = {
- import collection.JavaConversions._
- if (newContacts.size > 0) {
- var me: GraphNode = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
- def run: GraphNode = {
- return userManager.getUserGraphNode(userName)
- }
- })
- for (contactWebID <- newContacts) {
- val webIdGraphs = webIdGraphsService.getWebIdInfo(me.getNode.asInstanceOf[UriRef])
- var meGrph: GraphNode = new GraphNode(me.getNode, webIdGraphs.localPublicUserData)
- meGrph.addProperty(FOAF.knows, contactWebID)
- } //todo: one should catch errors here (bad uris sent for ex
- }
- return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
- }
-
- /**
- * Removes a contact
- */
- @POST
- @Path("deleteContact")
- def deleteContact(@PathParam(value = "id") userName: String, @Context uriInfo: UriInfo,
- @FormParam("contactWebId") contactWebId: UriRef): Response = {
- import collection.JavaConversions._
- var me: GraphNode = AccessController.doPrivileged(new PrivilegedAction[GraphNode] {
- def run: GraphNode = {
- return userManager.getUserGraphNode(userName)
- }
- })
- val webIdGraphs = webIdGraphsService.getWebIdInfo(me.getNode.asInstanceOf[UriRef])
- var meGrph: GraphNode = new GraphNode(me.getNode, webIdGraphs.localPublicUserData)
- meGrph.deleteProperty(FOAF.knows, contactWebId)
- return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
- }
-
- /**
- * @parm webId: A list of WebIDs to be added as Subject Alternative Names
- * @param cn Common Name, the name that usually appears in the certificate selection box
- * @param spkac key request in format generated by Netscape, Safari, Opera
- * @param crmf hey request in format generated by M$ Explorer
- * @param csr key request as generated by Javascript of Netscape
- * @param hours the certificate should last (hours and days add up)
- * @param days the certificate should last
- * @param comment a comment to be attached to the public key in the database
- */
- @POST
- @Path("keygen")
- def createCert(@FormParam("webId") webIds: java.util.List[URI],
- @FormParam("cn") commonName: String,
- @FormParam("spkac") spkac: String,
- @FormParam("crmf") crmf: String,
- @FormParam("csr") csr: String,
- @FormParam("hours") hours: String,
- @FormParam("days") days: String,
- @FormParam("comment") comment: String): Response = {
- import scala.collection.JavaConversions._
- var cert: Certificate = null
- if (spkac != null && spkac.length > 0) {
- cert = keygenSrvc.createFromSpkac(spkac)
- if (cert == null) {
- logger.warn("unable to create certificate from spkac request")
- }
- }
- if (cert == null && crmf != null && crmf.length > 0) {
- cert = keygenSrvc.createFromCRMF(crmf)
- if (cert == null) {
- logger.warn("unable to create certificate from crmf requrest :" + crmf)
- }
- }
- if (cert == null && csr != null && csr.length > 0) {
- cert = keygenSrvc.createFromPEM(csr)
- if (cert == null) {
- logger.warn("unable to create certificate from csr request :" + csr)
- }
- }
- if (cert == null) {
- throw new RuntimeException("The server was unable to create a certificate")
- }
- cert.setSubjectCommonName(commonName)
- cert.addDurationInHours(hours)
- cert.addDurationInDays(days)
- cert.startEarlier("2")
- for(san: URI<-webIds) {
- cert.addSubjectAlternativeName(san.toString)
- }
- var ser: CertSerialisation = null
- try {
- ser = cert.getSerialisation
- }
- catch {
- case ex: Exception => {
- throw new RuntimeException(ex)
- }
- }
- var pubKey: RSAPublicKey = cert.getSubjectPublicKey.getPublicKey.asInstanceOf[RSAPublicKey]
- var publicExponent: BigInteger = pubKey.getPublicExponent
- var modulus: BigInteger = pubKey.getModulus
-
- for (webid: URI<-webIds
- if (webid.getScheme=="https"||webid.getScheme=="http");
- val webidRef = new UriRef(webid.toString);
- val webIdInfo = webIdGraphsService.getWebIdInfo(webidRef);
- if (webIdInfo.isLocal)
- ) {
- val certGraph = new EzMGraph(webIdInfo.localPublicUserData)
- import certGraph._
- val certNode = certGraph.bnode
- ( (certNode a RSA.RSAPublicKey)
- -- CERT.identity --> webidRef
- -- RSA.modulus --> modulus
- -- RSA.public_exponent --> publicExponent
- -- DC.date --> cert.getStartDate )
- if (comment != null && comment.length > 0) {
- certNode -- RDFS.comment --> comment
- }
- }
- var resBuild: Response.ResponseBuilder = Response.ok(ser.getContent, MediaType.valueOf(ser.getMimeType))
- return resBuild.build
- }
-
- @POST
- @Path("deletekey")
- def deleteKey(@Context uriInfo: UriInfo,
- @FormParam("webId") webId: UriRef,
- @FormParam("keyhash") keys: List[String]): Response = {
- val webIDInfo = webIdGraphsService.getWebIdInfo(webId)
- val agent: GraphNode = new GraphNode(webId, webIDInfo.localPublicUserData)
- var subjects: Iterator[GraphNode] = agent.getSubjectNodes(CERT.identity)
- import scala.util.control.Breaks._
- breakable {
- import scala.collection.JavaConversions._
- //to for loop through iterators
- for (nl <- subjects) {
- var modulusIt: Iterator[Resource] = nl.getObjects(RSA.modulus)
- if (!modulusIt.hasNext) break
- var modLit: Resource = modulusIt.next
- if (modulusIt.hasNext) logger.warn("data error, a modulus too many in cert for " + webId)
- if (!(modLit.isInstanceOf[TypedLiteral])) {
- logger.warn("a public key has a modulus that is not a literal for " + webId)
- break
- }
- var modulus: BigInteger = LiteralFactory.getInstance.createObject(classOf[BigInteger], modLit.asInstanceOf[TypedLiteral])
- for (key <- keys) {
- if (modulus.hashCode == Integer.decode(key)) {
- nl.deleteNodeContext
- break
- }
- }
- }
- }
- return RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
- }
-
- @POST
- @Path("modify")
- def modifyProfile(@Context uriInfo: UriInfo,
- @PathParam("id") userName: String,
- @FormParam("webId") webId: UriRef,
- @FormParam("name") name: String,
- @FormParam("description") description: String): Response = {
- val webIDInfo = AccessController.doPrivileged(new PrivilegedAction[WebIdInfo] {
- def run = {
- webIdGraphsService.getWebIdInfo(webId)
- }
- })
- val agent: GraphNode = new GraphNode(webId, webIDInfo.localPublicUserData)
- agent.deleteProperties(FOAF.name)
- agent.addPropertyValue(FOAF.name, name)
- agent.deleteProperties(DC.description)
- agent.addPropertyValue(DC.description, description)
- logger.debug("local graph (uri: {}) is now of size {}".format(webIDInfo.webId, webIDInfo.localPublicUserData.size))
- RedirectUtil.createSeeOtherResponse("../profile", uriInfo)
- }
-
- protected def bindUserManager(usermanager: UserManager): Unit = {
- userManager = usermanager
- }
-
- protected def unbindUserManager(usermanager: UserManager): Unit = {
- if (userManager == usermanager) {
- userManager = null
- }
- }
-
- protected def bindGraphNodeProvider(graphNodeProvider: GraphNodeProvider): Unit = {
- this.graphNodeProvider = graphNodeProvider
- }
-
- protected def unbindGraphNodeProvider(graphNodeProvider: GraphNodeProvider): Unit = {
- this.graphNodeProvider = null
- }
-
- protected def bindKeygenSrvc(keygenservice: KeygenService): Unit = {
- keygenSrvc = keygenservice
- }
-
- protected def unbindKeygenSrvc(keygenservice: KeygenService): Unit = {
- if (keygenSrvc == keygenservice) {
- keygenSrvc = null
- }
- }
-
-
- protected def bindWebIdGraphsService(webidgraphsservice: WebIdGraphsService): Unit = {
- webIdGraphsService = webidgraphsservice
- }
-
- protected def unbindWebIdGraphsService(webidgraphsservice: WebIdGraphsService): Unit = {
- webIdGraphsService = null
- }
-
- protected def bindPlatformConfig(platformconfig: PlatformConfig): Unit = {
- platformConfig = platformconfig
- }
-
- protected def unbindPlatformConfig(platformconfig: PlatformConfig): Unit = {
- if (platformConfig == platformconfig) {
- platformConfig = null
- }
- }
-
- protected def bindTcManager(tcManager: TcManager) = {
- this.tcManager = tcManager
- }
-
- protected def unbindTcManager(tcManager: TcManager) = {
- this.tcManager = null
- }
-
- protected def activate(componentContext: ComponentContext): Unit = {
- this.componentContext = componentContext
- }
-
-
- private var userManager: UserManager = null
-
- private var graphNodeProvider: GraphNodeProvider = null
-
- private var webIdGraphsService: WebIdGraphsService = null
-
- private var keygenSrvc: KeygenService = null
- private var platformConfig: PlatformConfig = null
-
-
- private var componentContext: ComponentContext = null
-
- private var tcManager: TcManager = null;
-
-}
\ No newline at end of file