-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoken.html
executable file
·146 lines (139 loc) · 4.2 KB
/
token.html
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{% extends "page.html" %}
{% block main %}
<div class="container">
<div class="row">
<form id="request-token-form" class="col-md-offset-3 col-md-6">
<div class="text-center">
<button type="submit" class="btn btn-lg btn-jupyter">
Request new API token
</button>
</div>
<div class="form-group">
<label for="token-note">Note</label>
<input
id="token-note"
class="form-control"
placeholder="note to identify your new token">
<small id="note-note" class="form-text text-muted">
This note will help you keep track of what your tokens are for.
</small>
</div>
</form>
</div>
<div class="row">
<div id="token-area" class="col-md-6 col-md-offset-3" style="display: none;">
<div class="panel panel-default">
<div class="panel-heading">
Your new API Token
</div>
<div class="panel-body">
<p class="lead text-center">
<span id="token-result"></span>
</p>
<p>
Copy this token. You won't be able to see it again,
but you can always come back here to get a new one.
</p>
</div>
</div>
</div>
</div>
{% if api_tokens %}
<div class="row">
<h2>API Tokens</h2>
<p>
These are tokens with full access to the JupyterHub API.
Anything you can do with JupyterHub can be done with these tokens.
Revoking the API token for a running server will require restarting that server.
</p>
<table class="table table-striped">
<thead>
<tr>
<td>Note</td>
<td>Last used</td>
<td>Created</td>
</tr>
</thead>
<tbody>
{% for token in api_tokens %}
<tr class="token-row" data-token-id="{{token.api_id}}">
{% block token_row scoped %}
<td class="note-col col-sm-5">{{token.note}}</td>
<td class="time-col col-sm-3">
{%- if token.last_activity -%}
{{ token.last_activity.isoformat() + 'Z' }}
{%- else -%}
Never
{%- endif -%}
</td>
<td class="time-col col-sm-3">
{%- if token.created -%}
{{ token.created.isoformat() + 'Z' }}
{%- else -%}
N/A
{%- endif -%}
</td>
<td class="col-sm-1 text-center">
<button class="revoke-token-btn btn btn-xs btn-danger">revoke</button>
</td>
{% endblock token_row %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% if oauth_clients %}
<div class="row">
<h2>Authorized Applications</h2>
<p>
These are applications that use OAuth with JupyterHub
to identify users (mostly notebook servers).
OAuth tokens can generally only be used to identify you,
not take actions on your behalf.
</p>
<table class="table table-striped">
<thead>
<tr>
<td>Application</td>
<td>Last used</td>
<td>First authorized</td>
</tr>
</thead>
<tbody>
{% for client in oauth_clients %}
<tr class="token-row"
data-token-id="{{ client['token_id'] }}">
{% block client_row scoped %}
<td class="note-col col-sm-5">{{ client['description'] }}</td>
<td class="time-col col-sm-3">
{%- if client['last_activity'] -%}
{{ client['last_activity'].isoformat() + 'Z' }}
{%- else -%}
Never
{%- endif -%}
</td>
<td class="time-col col-sm-3">
{%- if client['created'] -%}
{{ client['created'].isoformat() + 'Z' }}
{%- else -%}
N/A
{%- endif -%}
</td>
<td class="col-sm-1 text-center">
<button class="revoke-token-btn btn btn-xs btn-danger">revoke</button>
{% endblock client_row %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
{% endblock main %}
{% block script %}
{{ super() }}
<script type="text/javascript">
require(["token"]);
</script>
{% endblock script %}