Author: reto
Date: Mon Jul 26 17:36:12 2010
New Revision: 979380
URL: http://svn.apache.org/viewvc?rev=979380&view=rev
Log:
applied patch Henry Story with some modification (unfinished support for
firefox)
Added:
incubator/clerezza/issues/CLEREZZA-243/
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/
- copied from r978883,
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/
Modified:
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.java
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-panel.ssp
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-staticweb/scripts/profile.js
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/settings-panel.ssp
Modified:
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml?rev=979380&r1=978883&r2=979380&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml
(original)
+++
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml
Mon Jul 26 17:36:12 2010
@@ -50,6 +50,10 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.rdf.core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>org.apache.clerezza.rdf.scala.utils</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.rdf.ontologies</artifactId>
@@ -102,5 +106,10 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.permissiondescriptions</artifactId>
</dependency>
+ <dependency>
+ <groupId>uk.ac.manchester.rcs.bruno.keygenapp</groupId>
+ <artifactId>keygenapp-base</artifactId>
+ <version>0.3-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified:
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java?rev=979380&r1=978883&r2=979380&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java
(original)
+++
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java
Mon Jul 26 17:36:12 2010
@@ -22,16 +22,16 @@ package org.apache.clerezza.platform.acc
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import javax.ws.rs.FormParam;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
+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 net.bblfish.dev.foafssl.keygen.CertSerialisation;
+import net.bblfish.dev.foafssl.keygen.Certificate;
+import net.bblfish.dev.foafssl.keygen.impl.StaticKeygenService;
import org.apache.clerezza.jaxrs.utils.RedirectUtil;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Property;
@@ -83,6 +83,9 @@ public class ProfilePanel extends FileSe
@Reference
private UserManager userManager;
+
+ @Reference
+ private net.bblfish.dev.foafssl.keygen.KeygenService keygenSrvc;
@Reference
private TcManager tcManager;
@@ -194,6 +197,42 @@ public class ProfilePanel extends FileSe
});
}
+ @POST
+ @Path("keygen")
+ public Response createCert(@FormParam("webId") String webId,
+ @FormParam("cn") String commonName,
+ @FormParam("spkac") String spkac,
+ @FormParam("hours") String hours,
+ @FormParam("days") String days) {
+ logger.info("in keygen code. webId="+webId);
+ logger.info("cn="+commonName);
+ logger.info("hours="+hours);
+ logger.info("days="+days);
+ logger.info("spkac="+spkac);
+ Certificate cert = null;
+ if (spkac != null && spkac.length() > 0) {
+ cert = keygenSrvc.createFromSpkac(spkac);
+ if (cert == null) logger.warn("unable to create keygen from spkac
request");
+ }
+ if (cert == null) {
+ return null;
+ }
+ cert.setSubjectCommonName(commonName);
+ cert.addDurationInHours(hours);
+ cert.addDurationInDays(days);
+ cert.setSubjectWebID(webId);
+
+ try {
+ CertSerialisation ser = cert.getSerialisation();
+ Response.ResponseBuilder resBuild =
Response.ok(ser.getContent(),MediaType.valueOf(ser.getMimeType()));
+ return resBuild.build();
+ } catch (Exception e) {
+ logger.warn("problem creating cert for webid="+webId,e);
+ return null;
+ }
+ }
+
+
@POST
@Path("modify")
public Response modifyProfile(@Context final UriInfo uriInfo,
Modified:
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.java
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.java?rev=979380&r1=978883&r2=979380&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.java
(original)
+++
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/SettingsPanel.java
Mon Jul 26 17:36:12 2010
@@ -167,6 +167,7 @@ public class SettingsPanel {
return graphNode;
}
+
private void addBundleDescriptionToGraph(MGraph responseGraph, Bundle
bundle) {
TypedLiteral status = LiteralFactory.getInstance().
createTypedLiteral(bundle.getState());
Modified:
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-panel.ssp
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-panel.ssp?rev=979380&r1=978883&r2=979380&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-panel.ssp
(original)
+++
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-panel.ssp
Mon Jul 26 17:36:12 2010
@@ -1,88 +1,172 @@
-import scala.xml.NodeBuffer
-import scala.collection.mutable.ListBuffer
-def cp(s: Any) = new UriRef("http://clerezza.org/2009/03/controlpanel#"+s)
+import org.apache.clerezza.rdf.core.{BNode, UriRef}
+import org.apache.clerezza.rdf.ontologies.{DC, FOAF}
+import org.apache.clerezza.rdf.scala.utils.RichGraphNode
+import scala.xml.Null
+import xml.{Text, Attribute}
+
+
+def cp(s: Any) = new UriRef("http://clerezza.org/2009/03/controlpanel#" + s)
def platform(s: Any) = new UriRef("http://clerezza.org/2009/08/platform#" + s)
resultDocModifier.addStyleSheet("profile/style/profile.css");
resultDocModifier.addScriptReference("profile/scripts/profile.js");
resultDocModifier.setTitle("Account Control Panel");
resultDocModifier.addNodes2Elem("tx-module", <h1>Account Control Panel</h1>);
-resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a
href="#">Profile</a></li>);
-resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a
href="control-panel">Settings</a></li>);
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active">
+ <a href="#">Profile</a>
+</li>);
+resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li>
+ <a href="control-panel">Settings</a>
+</li>);
-val agent = res/FOAF.primaryTopic
+val agent: RichGraphNode = res / FOAF.primaryTopic
+var webId =""
def createWebId() = {
- <h3>Associate Profile to Web-id</h3>
- <div id="newOrExistingSelection">
- <p>Your profile is not currently associated to a Web-ID. A
Web-ID allows you
- to link your friends as well as to log-in to many sites
(supporting foaf+ssl
- or open-id).</p>
- <p>You may either create a new Web-Id or associate your account
to an
- existing Web-Id. Only creating a Web-Id here will allow you to
manage your
- profile here.</p>
- <form action="#" id="associateSelection">
+ <h3>Associate Profile to Web-id</h3>
+ <div id="newOrExistingSelection">
+ <p>Your profile is not currently associated to a Web-ID.A Web-ID allows you
+ to link your friends as well as to log-in to many sites (supporting
foaf+ssl
+ or open-id).
+ </p>
+ <p>You may either create a new Web-Id or associate your account to an
+ existing Web-Id.Only creating a Web-Id here will allow you to manage
your
+ profile here.
+ </p>
+ <form action="#" id="associateSelection">
<button id="newWebIdButton">Create a new Web-Id</button>
<button id="existingWebIdButton">I already have a
Web-ID and want to use it</button>
- </form>
- </div>
- <div id="createNewWebId">
- <p>You have chosen to create a new Web-Id.</p>
- <p>The Web-ID will be created as follows:<br/>
- <ol>
- <li>Web-Id: {res/cp("suggestedPPDUri")*}#me</li>
- <li>Perfonal-Profile Document:
http://localhost/user/admin/profile</li>
- </ol>
- </p>
+ </form>
+ </div>
+ <div id="createNewWebId">
+ <p>You have chosen to create a new Web-Id.</p>
+ <p>The Web-ID will be created as follows:
+ <br/>
+ <ol>
+ <li>Web-Id:
+ {webId = res/cp("suggestedPPDUri")*;
+ webId += "#me";
+ webId}
+ </li>
+ <li>Personal-Profile Document: {res/cp("suggestedPPDUri")*}</li>
+ </ol>
+ </p>
<form method="post" action="profile/create-new-web-id">
<input value="Create it!" type="submit"/>
- </form>
- </div>
- <div id="setExistingWebId">
- <p>Please enter your Web-Id, if your Web-Id supports Foaf+SSL
you will
- be able to use it to log in to this site.</p>
- <form method="post" action="profile/set-existing-webid">
- <label for="webid">Web-Id</label> <input type="text"
name="webid" size="80" title="Web-ID"/><br/>
- <input value="Associate Profile to Web-Id"
type="submit"/><p />
- </form>
- </div>
-
+ </form>
+ </div>
+ <div id="setExistingWebId">
+ <p>Please enter your Web-Id, if your Web-Id supports Foaf+SSL you will
+ be able to use it to log in to this site.</p>
+ <form method="post" action="profile/set-existing-webid">
+ <label for="webid">Web-Id</label> <input type="text" name="webid"
size="80" title="Web-ID"/>
+ <br/>
+ <input value="Associate Profile to Web-Id" type="submit"/>
+ <p/>
+ </form>
+ </div>
+
}
def existingWebId() = {
- if ((res/cp("isLocalProfile")).as[Boolean]) {
- existingLocalWebId()
- } else {
- roamingUser()
- }
+ if ((res / cp("isLocalProfile")).as[Boolean]) {
+ existingLocalWebId()
+ } else {
+ roamingUser()
+ }
}
def existingLocalWebId() = {
- <h3>Manage your profile</h3>
- <p>Here you can change your public profile.</p>
- <form method="post" action="profile/modify">
- <input type="hidden" name="webId" value={agent*}/>
- <label for="name">name</label><input type="text" name="name"
value={agent/FOAF.name*}/><br/>
- <label for="description">description</label><textarea
name="description"
- >{agent/DC.description*}</textarea><br/>
- <input value="Modify" type="submit"/><p />
- </form>
+ <h3>Manage your profile</h3>
+ <p>Here you can change your public profile.</p>
+ <form method="post" action="profile/modify">
+ <input type="hidden" name="webId" value={agent*}/>
+ <label for="name">name</label> <input type="text" name="name"
value={agent / FOAF.name *}/>
+ <br/>
+ <label for="description">description</label> <textarea
name="description">
+ {agent / DC.description *}
+ </textarea> <br/>
+ <input value="Modify" type="submit"/>
+ <p/>
+ </form>
+
+ <h1>web-is stuff</h1>
+
+ <form id="keygenform" method="post" action="profile/keygen">
+ <table width="95%">
+ <tr>
+ <td>Common Name:</td>
+ <td>
+ <input name="cn" size="30" id="cn" type="text"
value="m...@clerezza"/> <!-- find some way perhaps to get hostname-->
+ </td>
+ </tr>
+ <tr>
+ <td>WebID:</td>
+ <td>
+ <input name="webId" size="60" id="webId" type="text"
value={agent*} />
+ </td>
+ </tr>
+ <tr>
+ <td>Key strength:</td>
+ <td id="keystrenghtd">
+ <keygen id="spkac" name="spkac" challenge="TheChallenge1"/>
+ </td>
+ </tr>
+ <tr>
+ <td>Valid for:
+ <br/>
+ (defaults to 1 year)</td>
+ <td>
+ <input type="text" name="hours" value="0.0" size="4"/>
+ hours
+ <br/>
+ <input type="text" name="days" value="356" size="4"/>
+ days</td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ #if ($nodebug)
+ Clicking the submit button will start the following sequence of
events:
+ #else
+ If none of the above debug options are checked then the following
will happen on clicking submit:
+ #end
+ <ol>
+ <li>your browser will create a public/private key pair</li>
+ <li>send us your public key, in what is known as a
+ <a
href="http://en.wikipedia.org/wiki/Certification_request">certification
request</a>
+ along with information from the form above</li>
+ <li>we will create a certificate with the parameters
specified</li>
+ <li>it will be returned to you and your browser will match it
with your private key and add the pair to your keychain</li>
+ <li>a
+ <a
href="$xwiki.getDocument('WebId.RSAPubKeyClass').getURL('edit','editor=class')">WebId.RSAPubKeyClass</a>
+ object will be created in
+ <a href="$homepage.getURL()">your public profile</a>, which
you will then see clearly in
+ <a target="_blank"
href="${homepage.getURL('edit','editor=object')}">its object view</a>.Your
profile should also have an RDF view of the key.</li>
+ </ol>
+ </td>
+ </tr>
+ </table>
+ <input id="keygensubmit" type="submit" value="submit certificate
request" />
+ </form>
}
def roamingUser() = {
- <h3>Using remote profile</h3>
- <p>{agent/FOAF.nick*}, you have accessed this site using you Web-Id
{"<"+(agent*)+">"} which has not been
- created on this site. To edit your profile you should visit the site
issuing the
- profile.</p>
+ <h3>Using remote profile</h3>
+ <p>
+ {agent / FOAF.nick *}, you have accessed this site using your
Web-Id
+ {"<" + (agent *) + ">"}
+ which has not been
+ created on this site.To edit your profile you should visit the
site issuing the
+ profile.</p>
}
<div id="tx-content">
<h2>Personal Profile</h2>
-
+
{
agent! match {
- case _: BNode => createWebId()
- case _: UriRef => existingWebId()
+ case _: BNode => createWebId()
+ case _: UriRef => existingWebId()
}
}
</div>
\ No newline at end of file
Modified:
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-staticweb/scripts/profile.js
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-staticweb/scripts/profile.js?rev=979380&r1=978883&r2=979380&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-staticweb/scripts/profile.js
(original)
+++
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/profile-staticweb/scripts/profile.js
Mon Jul 26 17:36:12 2010
@@ -7,5 +7,40 @@ $(document).ready(function() {
$("#newOrExistingSelection").css({display: "none"})
$("#setExistingWebId").css({display: "block"})
});
- //$('form').submit(function () { return false; })
+ $("#keygenform").submit(function() {
+ return spkacFix();
+ });
});
+
+var crmfObject;
+function setCRMFRequest() {
+ var formContents = $("#keygenform").serialize();
+ var newContents = jQuery.extend({}, formContents);
+ newContents.crmf = crmfObject.request
+ $.post("profile/keygen",newContents,
+ function(data) {
+ alert("congrats");
+ });
+ $("#keygenform").submit(function() {
+ return spkacFix();
+ });
+}
+
+function spkacFix() {
+ alert("hello")
+ alert("cn ="+$("#cn").val())
+ alert("key ="+$("#keygen").val())
+ if ($("#keygen").val()) {
+ alert("no fix needed")
+ return true;
+ } else {
+ crmfObject = crypto.generateCRMFRequest(
+ 'CN=Fred',
+ "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;
+ }
+}
Modified:
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/settings-panel.ssp
URL:
http://svn.apache.org/viewvc/incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/settings-panel.ssp?rev=979380&r1=978883&r2=979380&view=diff
==============================================================================
---
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/settings-panel.ssp
(original)
+++
incubator/clerezza/issues/CLEREZZA-243/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/resources/org/apache/clerezza/platform/accountcontrolpanel/settings-panel.ssp
Mon Jul 26 17:36:12 2010
@@ -1,3 +1,4 @@
+import org.apache.clerezza.rdf.core.UriRef
import scala.xml.NodeBuffer
import scala.collection.mutable.ListBuffer
def cp(s: Any) = new UriRef("http://clerezza.org/2009/03/controlpanel#"+s)