aboutsummaryrefslogtreecommitdiff
path: root/gn_auth/templates/admin/view-oauth2-client.html
blob: 415873df2f3587c98fc6db78bcf0255d51ef8892 (plain)
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
{%extends "base.html"%}

{%block title%}gn-auth: View OAuth2 Client{%endblock%}

{%block pagetitle%}View OAuth2 Client{%endblock%}

{%block content%}
{{flash_messages()}}

{%if client.is_nothing()%}
<p>No such client</p>
{%else%}
{%set client = client.value%}
<form method="POST" action="{{url_for('oauth2.admin.edit_client')}}">
  <legend>View/Edit Oauth2 Client</legend>
  <input type="hidden" name="client_id" value="{{client.client_id}}" />
  <input type="hidden" name="client_name" value="{{client.client_metadata.client_name}}" />
  <div>
    <p><strong>Client ID: <strong> {{client.client_id}}</p>
    <p><strong>Client Name: <strong> {{client.client_metadata.client_name}}</p>
  </div>
  <fieldset>
    <legend>Scope</legend>
    {%for scp in scope%}
    <input name="scope[]" id="chk:{{scp}}" type="checkbox" value="{{scp}}"
	   {%if scp in client.client_metadata.scope%}
	   checked="checked"
	   {%endif%} />
    <label for="chk:{{scp}}">{{scp}}</label><br />
    {%endfor%}
  </fieldset>

  <fieldset>
    <legend>Redirect URIs</legend>
    <label for="txt-redirect-uri">Default Redirect URI</label>
    <br />
    <input type="text" name="redirect_uri" id="txt-redirect-uri"
	   value="{{client.client_metadata.default_redirect_uri}}"
	   required="required"
           class="form-control" />
    <br /><br />

    <label for="txta:other-redirect-uris">Other Redirect URIs</label>
    <br />
    <textarea id="txta:other-redirect-uris"
	      name="other_redirect_uris"
	      cols="80" rows="10"
	      title="Enter one URI per line."
	      >{{"\r\n".join(client.client_metadata.redirect_uris)}}</textarea>
  </fieldset>

  <fieldset>
    <legend>Grants</legend>
      {%for granttype in granttypes%}
      <input name="grants[]"
	     type="checkbox"
	     value="{{granttype.value}}"
	     id="chk-{{granttype.name.lower().replace(' ', '-')}}"
             {%if granttype.value in client.client_metadata.grant_types%}
	     checked="checked"
             {%endif%} />
      <label for="chk-{{granttype.name.lower().replace(' ', '-')}}">
        {{granttype.name}}
      </label>
      <br /><br />
      {%endfor%}
  </fieldset>

  <input type="submit" class="btn btn-primary" value="update client" />
</form>

<hr />
<h2>Signing/Verification SSL Keys</h2>
<table>
  <caption>Registered Public Keys</caption>
  <thead>
    <tr>
      <th>JWK Thumbprint</th>
      <th>Actions</th>
    </tr>
  </thead>

  <tbody>
    {%for sslkey in client.jwks.keys:%}
    <tr>
      <td>{{sslkey.thumbprint()}}</td>
      <td>
        <form method="POST"
              action="{{url_for('oauth2.admin.delete_client_public_key')}}">
          <input type="hidden"
                 name="client_id"
                 value="{{client.client_id}}" />
          <input type="hidden"
                 name="ssl_key"
                 value="{{sslkey.thumbprint()}}" />
          <input type="submit"
                 class="btn btn-danger"
                 value="delete key" />
        </form>
      </td>
    </tr>
    {%else%}
    <tr>
      <td class="alert-warning"
          colspan="2">
        There are no registered SSL keys for this client.
      </td>
    </tr>
    {%endfor%}
  </tbody>
</table>
<form id="frm-client-add-ssl-key"
      method="POST"
      action="{{url_for('oauth2.admin.register_client_public_key')}}">
  <legend>Register new SSL key</legend>
  <input type="hidden" name="client_id" value="{{client.client_id}}" />
  <fieldset>
    <label for="txt-area-client-ssl-key">Client's Public Key</label>
    <textarea id="txt-area-client-ssl-key"
              name="client_ssl_key"
              required="required"
              class="form-control"
              rows="10"></textarea>
  </fieldset>

  <br />
  <input type="submit" class="btn btn-primary" value="register key" />
</form>

{%endif%}
{%endblock%}