~sircmpwn/meta.sr.ht

ref: 72548bd7545f78670878667674cc7645835a17bd meta.sr.ht/metasrht/templates/oauth2-dashboard.html -rw-r--r-- 4.8 KiB
72548bd7Drew DeVault API: Updates per core-go auth changes 1 year, 1 month ago
                                                                                
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
147
148
149
150
151
152
153
154
155
156
{% extends "meta.html" %}
{% block title %}
<title>OAuth 2.0 - {{cfg("sr.ht", "site-name")}} meta</title>
{% endblock %}
{% block content %}
<div class="alert alert-info">
  <strong>Notice!</strong> This is the <strong>experimental</strong> OAuth
  2.0 dashboard. Credentials issued here are incompatible with the legacy API!
  <a href="{{url_for("oauth_web.oauth_GET")}}" class="btn btn-link">
    Return to legacy OAuth Dashboard {{icon('caret-right')}}
  </a>
</div>
<div class="row">
  <div class="col-md-12 event-list">
    <section class="event">
      <h3>Personal Access Tokens</h3>
      {% if any(personal_tokens) %}
      <p>You have issued the following personal access tokens:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Comment</th>
            <th>Issued</th>
            <th>Expires</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for token in personal_tokens %}
          <tr>
            <td>{{ token.comment }}</td>
            <td>{{ token.issued | date }}</td>
            <td>{{ token.expires | date }}</td>
            <td style="width: 6rem">
              <a
                href="{{url_for('oauth2.personal_token_revoke_GET',
                  token_id=token.id)}}"
                class="btn btn-danger btn-fill"
              >Revoke</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not created any personal access tokens.</p>
      {% endif %}
      <a class="btn btn-primary" href="{{url_for('oauth2.personal_token_GET')}}">
        Generate new token {{icon("caret-right")}}
      </a>
    </section>
    <section class="event">
      <h3>Authorized Clients</h3>
      {% if any(oauth_grants) %}
      <p>You have granted the following third parties access to your account:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Service</th>
            <th>Operator</th>
            <th>Issued</th>
            <th>Expires</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for grant in oauth_grants %}
          <tr>
            <td>
              {# lol this hack is awful #}
              <a
                href="{{grant.client.url}}"
                rel="noopener"
              >{{ grant.client.name }}</a>
              <a
                href="{{grant.client.url}}"
                rel="noopener"
              >{{icon('external-link-alt')}}</a>
            </td>
            <td>{{grant.client.owner.canonicalName}}</td>
            <td>{{grant.issued | date}}</td>
            <td>{{grant.expires | date}}</td>
            <td style="width: 6rem">
              <a
                href="{{url_for("oauth2.bearer_token_revoke_GET",
                  token_hash=grant.tokenHash)}}"
                class="btn btn-danger btn-fill"
              >Revoke</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not granted any third party clients access to your account.</p>
      {% endif %}
    </section>
    <section class="event">
      <h3>Registered Clients</h3>
      {% if client_revoked %}
      <div class="alert alert-info">
        Your OAuth client has been unregistered. All bearer tokens issued to
        your client have been revoked.
      </div>
      {% endif %}
      <p>
        Please consult our <a
          href="https://man.sr.ht/meta.sr.ht/oauth.md"
          rel="noopener"
        >OAuth 2.0 documentation</a> for information about OAuth clients.
      </p>
      {% if any(oauth_clients) %}
      <p>You have registered the following OAuth clients:</p>
      <table class="table">
        <thead>
          <tr>
            <th>Name</th>
            <th>Client ID</th>
            <th></th>
          </tr>
        </thead>
        <tbody>
          {% for client in oauth_clients %}
          <tr>
            <td>
              {# lol this hack is awful #}
              <a
                href="{{client.url}}"
                rel="noopener"
              >{{ client.name }}</a>
              <a
                href="{{client.url}}"
                rel="noopener"
              >{{icon('external-link-alt')}}</a>
            </td>
            <td>{{ client.uuid }}</td>
            <td style="width: 6rem">
              <a
                href="{{url_for('oauth2.manage_client_GET', uuid=client.uuid)}}"
                class="btn btn-default btn-fill"
              >Manage {{icon('caret-right')}}</a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
      {% else %}
      <p>You have not registered any OAuth clients yet.</p>
      {% endif %}
      <a class="btn btn-primary" href="{{url_for('oauth2.client_registration_GET')}}">
        Register new client {{icon("caret-right")}}
      </a>
    </section>
  </div>
</div>
{% endblock %}