aboutsummaryrefslogtreecommitdiff
path: root/templates/certs.go
diff options
context:
space:
mode:
authorNiall Sheridan <nsheridan@gmail.com>2016-07-17 23:54:42 +0100
committerNiall Sheridan <nsheridan@gmail.com>2016-07-24 23:23:33 +0100
commit44fef1c2a163bdfd781ef08a06e3cf5cf9b7d5da (patch)
treebcde234bf45255a8935aeacf7ee544f256b455cc /templates/certs.go
parentc9849d667ab55c23d343332a11afb3eb8ede3f2d (diff)
Add a page for revoking certs
Add a template for revocation Use DATETIME type to store created/expires times Require auth for the /admin and /revoke endpoints
Diffstat (limited to 'templates/certs.go')
-rw-r--r--templates/certs.go71
1 files changed, 71 insertions, 0 deletions
diff --git a/templates/certs.go b/templates/certs.go
new file mode 100644
index 0000000..2fde4fd
--- /dev/null
+++ b/templates/certs.go
@@ -0,0 +1,71 @@
+package templates
+
+// Token is the page users see when authenticated.
+const Certs = `<html>
+ <head>
+ <title>Certs</title>
+ <style>
+ <!--
+ body {
+ font-family: sans-serif;
+ background-color: #edece4;
+ margin-top: 120px;
+ }
+ .code {
+ background-color: #26292B;
+ border: none;
+ color: #fff;
+ font-family: monospace;
+ font-size: 13;
+ font-weight: bold;
+ height: auto;
+ margin: 12px 12px 12px 12px;
+ padding: 24px 12px 12px 12px;
+ resize: none;
+ text-align: center;
+ width: 960px;
+ }
+ ::selection {
+ background: #32d0ff;
+ color: #000;
+ }
+ ::-moz-selection {
+ background: #32d0ff;
+ color: #000;
+ }
+ -->
+ </style>
+ </head>
+ <body>
+
+ <form action="/admin/revoke" method="post" id="form_revoke">
+ {{ .CSRF }}
+ <table>
+ <tr>
+ <th>ID</th>
+ <th>Created</th>
+ <th>Expires</th>
+ <th>Principals</th>
+ <th>Revoked</th>
+ <th>Revoke</th>
+ </tr>
+
+ {{range .Certs}}
+ <tr>
+ <td>{{.KeyID}}</td>
+ <td>{{.CreatedAt}}</td>
+ <td>{{.Expires}}</td>
+ <td>{{.Principals}}</td>
+ <td>{{.Revoked}}</td>
+ <td>
+ {{if not .Revoked}}
+ <input type="checkbox" value="{{.KeyID}}" name="cert_id" id="cert_id" />
+ {{end}}
+ </td>
+ </tr>
+ {{ end }}
+ </table>
+ </form>
+ <button type="submit" form="form_revoke" value="Submit">Submit</button>
+ </body>
+</html>`