-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.gohtml
109 lines (97 loc) · 2.61 KB
/
template.gohtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
{{define "Layout"}}
<!DOCTYPE html>
<html lang="en">
<head>
<title>JIT Example</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<style>
#root {
padding: 16px;
}
</style>
</head>
<body>
<div id="root">
{{.}}
</div>
</body>
</html>
{{end}}
{{define "Index"}}
<h1>Pomerium Zero JIT Example</h1>
<p>
This web application demonstrates a Just-In-Time request/approve access flow with Pomerium Zero.
</p>
<form action="/request-access" method="post">
<p>By clicking this button users can request access:</p>
<input type="submit" value="Request Access" />
</form>
<p>
Users who have access can reach the admin page at <a href="/admin">/admin</a>.
</p>
{{end}}
{{define "Admin"}}
<h1>Pomerium Zero JIT Example</h1>
<p>This is the admin page where users can be approved.</p>
<h2>Users With Access</h2>
<p>
These users have time-limited access.
</p>
<table>
<thead>
<tr>
<th>Email</th>
<th>Expires</th>
<th></th>
</tr>
</thead>
<tbody>
{{ range .jitUsers }}
{{ if .Expires.IsZero }}
{{ else }}
<tr>
<td>{{ .Email }}</td>
<td>{{ .Expires }}</td>
<td>
<form action="/admin/revoke-access" method="post">
<input type="hidden" name="email" value="{{.Email}}" />
<input type="submit" value="Revoke" />
</form>
</td>
</tr>
{{ end }}
{{ end }}
</table>
<h2>Users Requesting Access</h2>
<p>
These users are requesting access. By clicking approve they will be granted time-limited access.
</p>
<table>
<thead>
<tr>
<th>Email</th>
<th></th>
</tr>
</thead>
<tbody>
{{ range .jitUsers }}
{{ if .Expires.IsZero }}
<tr>
<td>{{ .Email }}</td>
<td>
<form action="/admin/approve-access" method="post">
<input type="hidden" name="email" value="{{.Email}}" />
<input type="submit" value="Approve" />
</form>
<form action="/admin/revoke-access" method="post">
<input type="hidden" name="email" value="{{.Email}}" />
<input type="submit" value="Reject" />
</form>
</td>
</tr>
{{ end }}
{{ end }}
</table>
{{end}}