improved output of test suite for increased readability. Also moved the URL to the one that foafssl.org has been using for some time so that links don't break to that service. webid
authorHenry Story <henry.story@bblfish.net>
Wed, 21 Dec 2011 16:44:34 +0100
branchwebid
changeset 157 33f2505485b6
parent 156 e74fb80c6edc
child 158 81652221976f
improved output of test suite for increased readability. Also moved the URL to the one that foafssl.org has been using for some time so that links don't break to that service.
src/main/resources/template/NoWebId.xhtml
src/main/resources/template/WebId.xhtml
src/main/resources/template/webidp/WebIdService.badcert.html
src/main/scala/auth/X509view.scala
src/main/scala/auth/earl.scala
--- a/src/main/resources/template/NoWebId.xhtml	Tue Dec 20 20:02:18 2011 +0100
+++ b/src/main/resources/template/NoWebId.xhtml	Wed Dec 21 16:44:34 2011 +0100
@@ -13,9 +13,11 @@
 <body>
   <h1>WebID Authentication Report</h1>
       
-  <p>This page describes in detail the state of your <a href="http://webid.info/spec">WebID authentication</a> session on <span class="date">Thu Nov 17 08:31:53 PST 2011.</span> </p>
+  <p>This page describes in detail the state of your <a href="http://webid.info/spec">WebID authentication</a>
+      session on <span class="date">Thu Nov 17 08:31:53 PST 2011.</span> </p>
 
-  <p>We received no certificate from you. <a href="" onclick="return logout()">try again</a></p>
+  <p>We received no certificate from you. <a href="" onclick="return logout()">try again</a>
+      (works on IE and Firefox)</p>
 
 
 </body>
--- a/src/main/resources/template/WebId.xhtml	Tue Dec 20 20:02:18 2011 +0100
+++ b/src/main/resources/template/WebId.xhtml	Wed Dec 21 16:44:34 2011 +0100
@@ -2,6 +2,11 @@
 	<head id="head">
 	<title>WebId Tests</title>
     <script src="/public/logout.js" type="text/javascript"/>
+        <style type="text/css">
+            .outcome_passed {color: green}
+            .outcome_failed { color: red}
+            .outcome_untested {color: orange}
+        </style>
     </head>
 <body>
   <h1>WebID Authentication Report</h1>
@@ -12,11 +17,12 @@
 
   <h2>WebID</h2>
   <div class="webid_tests">
-  <p class="no_webid">No Subject Alternative Names were found in your Certificate.</p>
+  <p><span class="san_number">2</span> Subject Alternative Names were found in your Certificate. <span class="san_verified">Of these we verified
+  <span class="san_verified_no">245</span>.</span></p>
   <table width="100%" rules="groups">
       <tbody class="webid_test">
-      <tr><td colspan="2">Verification of Subject Alternative Name <span class="webid">http://bblfish.net/#me</span>?</td> </tr>
-      <tr><td class="tst_res">result</td><td class="tst_res_txt">found 1 valid principals</td></tr>
+      <tr><td colspan="2">Verification of <span class="webid">http://bblfish.net/#me</span>?</td> </tr>
+      <tr><td class="tst_res">result</td><td class="tst_res_txt">found 1 valid ID</td></tr>
       <tr class="webid_cause"><td>cause</td><td class="cause_txt"></td></tr>
       </tbody>
   </table>
--- a/src/main/resources/template/webidp/WebIdService.badcert.html	Tue Dec 20 20:02:18 2011 +0100
+++ b/src/main/resources/template/webidp/WebIdService.badcert.html	Wed Dec 21 16:44:34 2011 +0100
@@ -33,13 +33,12 @@
                 <div class="arrow"></div>
                 <div class="table">
                     <div class="vertical contents">
-                        <strong class="error">Certificate missing a WebID</strong>  (<a href="/test/auth/webid">details</a>)
+                        <strong class="error">Certificate missing a WebID</strong>  (<a href="/test/WebId">details</a>)
                         <div class="form_section">
                             <img class="depiction" src="idp/profile_anonymous.png"/>
                             <div class="submit cf">
                                 <input type="submit" class="button" tabindex="3" value="try again" onclick="logout()"/>
                                 <button class="newuser" tabindex="3">verify email</button>
-
                                 <button class="returning" tabindex="3">select email</button>
                             </div>
                         </div>
--- a/src/main/scala/auth/X509view.scala	Tue Dec 20 20:02:18 2011 +0100
+++ b/src/main/scala/auth/X509view.scala	Wed Dec 21 16:44:34 2011 +0100
@@ -59,7 +59,7 @@
   lazy val noX509: Elem = XML.loadFile(new File(fileDir, "NoWebId.xhtml"))
   
   def intent : Cycle.Intent[Req,Res] = {
-    case req @ Path("/test/auth/webid")  => req match {
+    case req @ Path("/test/WebId")  => req match {
       case X509Claim(claim) => Ok ~> Html( new X509Filler(claim).apply(webidTst) )
       case _ => Ok ~> Html (new NoX509().apply(noX509))
     }
@@ -73,6 +73,13 @@
 }
 
 class X509Filler(x509: X509Claim) extends Transformer {
+  def pretty(res: Outcome) = {
+    res match {
+      case org.w3.readwriteweb.auth.passed => <span class="outcome_passed">passed</span>
+      case org.w3.readwriteweb.auth.failed => <span class="outcome_failed">failed</span>
+      case org.w3.readwriteweb.auth.untested => <span class="outcome_untested">untested</span>
+    }
+  }
   $(".date").contents = DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG).format( x509.claimReceivedDate)
   $(".cert_test") { node =>
       val x509Assertion = new Assertion(certOk,x509);
@@ -81,19 +88,26 @@
         new Transform(node) {
           $(".tst_question").contents = ast.test.title
           $(".tst_txt").contents = ast.test.description
-          $(".tst_res").contents = ast.result.outcome.name
+          $(".tst_res").contents = pretty(ast.result.outcome)
           $(".tst_res_txt").contents = ast.result.description
         }.toNodes()
       }
       ff.flatten
   }
-  $(".no_webid") { node => if (x509.verified.size==0) node else <span/> }
+  $(".san_number").contents = if (x509.claims.size == 0) "No" else x509.claims.size.toString
+  $(".san_verified") { node => if (x509.claims.size==0) <span/> else
+    new Transform(node) {
+      $(".san_verified_no").contents = x509.verified.size.toString
+    }.toNodes()
+  }
+
   $(".webid_test") { node =>
     val ff = for (idclaim <- x509.claims) yield {
       val idAsrt = new Assertion(webidClaimTst, idclaim)
       new Transform(node) {
         $(".webid").contents = idclaim.san
         $(".tst_res_txt").contents = idAsrt.result.description
+        $(".tst_res").contents = pretty(idAsrt.result.outcome)
         $(".webid_cause") { n2 =>
           val nn = for (a <- idAsrt.depends) yield {
             new Transform(n2) {
--- a/src/main/scala/auth/earl.scala	Tue Dec 20 20:02:18 2011 +0100
+++ b/src/main/scala/auth/earl.scala	Wed Dec 21 16:44:34 2011 +0100
@@ -151,7 +151,7 @@
     webIdclaim.verify match {
       case Success(webId) => new Result("WebId successfully verified",passed)
       case Failure(webIdClaimErr: WebIDVerificationFailure) => 
-        new Result("keys in certificate don't match key in profile for "+webIdClaimErr.subject,failed)
+        new Result("keys in profile don't match key in certificate for "+webIdClaimErr.subject.san,failed)
       case Failure(e) => new Result("WebID verification failed",failed,cause=List(new AssertionErr(e)))
     }