about summary refs log tree commit diff
path: root/gn_auth/templates/admin
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth/templates/admin')
-rw-r--r--gn_auth/templates/admin/confirm-change-client-secret.html45
-rw-r--r--gn_auth/templates/admin/list-oauth2-clients.html10
-rw-r--r--gn_auth/templates/admin/register-client.html109
-rw-r--r--gn_auth/templates/admin/view-oauth2-client.html136
4 files changed, 170 insertions, 130 deletions
diff --git a/gn_auth/templates/admin/confirm-change-client-secret.html b/gn_auth/templates/admin/confirm-change-client-secret.html
new file mode 100644
index 0000000..aa8ef81
--- /dev/null
+++ b/gn_auth/templates/admin/confirm-change-client-secret.html
@@ -0,0 +1,45 @@
+{%extends "base.html"%}
+
+{%block title%}gn-auth: View OAuth2 Client{%endblock%}
+
+{%block pagetitle%}View OAuth2 Client{%endblock%}
+
+{%block content%}
+{{flash_messages()}}
+
+<h2>Change Oauth2 Client Secret</h2>
+
+<p>You are attempting to change the <strong>CLIENT_SECRET</strong> value for the
+  following client:</p>
+
+<table class="table">
+  <tbody>
+    <tr>
+      <td><strong>Client ID</strong></td>
+      <td>{{client.client_id}}</td>
+    </tr>
+    <tr>
+      <td><strong>Client Name</strong></td>
+      <td>{{client.client_metadata.client_name}}</td>
+    </tr>
+  </tbody>
+</table>
+
+<p>Are you absolutely sure you want to do this?<br />
+  <small>Note that you'll need to update your configurations for the client and
+    restart it for the settings to take effect!</small></p>
+
+<form id="frm-change-client-secret"
+      method="POST"
+      action="{{url_for('oauth2.admin.change_client_secret',
+              client_id=client.client_id)}}">
+
+  <input type="hidden" name="client_id" value="{{client.client_id}}" />
+  <input type="hidden" name="client_name" value="{{client.client_metadata.client_name}}" />
+
+  <div class="form-group">
+    <input type="submit" class="btn btn-danger" value="generate new secret" />
+  </div>
+</form>
+
+{%endblock%}
diff --git a/gn_auth/templates/admin/list-oauth2-clients.html b/gn_auth/templates/admin/list-oauth2-clients.html
index ca0ee6d..6da5b2f 100644
--- a/gn_auth/templates/admin/list-oauth2-clients.html
+++ b/gn_auth/templates/admin/list-oauth2-clients.html
@@ -15,7 +15,7 @@
       <th>Client Name</th>
       <th>Default Redirect URI</th>
       <th>Owner</th>
-      <th colspan="2">Actions</th>
+      <th colspan="3">Actions</th>
     </tr>
   </thead>
 
@@ -43,6 +43,14 @@
 		 class="btn btn-danger" />
 	</form>
       </td>
+      <td>
+        <a href="{{url_for('oauth2.admin.change_client_secret',
+                 client_id=client.client_id)}}"
+           title="Change the client secret!"
+           class="btn btn-danger">
+          Change Secret
+        </a>
+      </td>
     </tr>
     {%else%}
     <tr>
diff --git a/gn_auth/templates/admin/register-client.html b/gn_auth/templates/admin/register-client.html
index 20d7aa2..bfe56f8 100644
--- a/gn_auth/templates/admin/register-client.html
+++ b/gn_auth/templates/admin/register-client.html
@@ -9,59 +9,72 @@
 
 <form method="POST" action="{{url_for('oauth2.admin.register_client')}}">
 
-  <fieldset>
-    <legend>Select client scope</legend>
-
+  <legend>Select client scope</legend>
+  <div class="form-group">
     {%for scp in scope%}
-    <input name="scope[]" id="chk-{{scp}}"type="checkbox" value="{{scp}}"
-	   {%if scp=="profile"%}checked="checked"{%endif%} />
-    <label for="chk-{{scp}}">{{scp}}</label><br />
+    <div class="checkbox">
+      <label for="chk-{{scp}}">
+        <input name="scope[]" id="chk-{{scp}}"type="checkbox" value="{{scp}}"
+	       {%if scp=="profile"%}checked="checked"{%endif%} />
+        {{scp}}
+      </label>
+    </div>
     {%endfor%}
+  </div>
 
-  </fieldset>
-
-  <fieldset>
-    <legend>Basic OAuth2 client information</legend>
-
-    
-    <label for="txt-client-name">Client name</label>
-    <input name="client_name" type="text" id="txt-client-name"
+  <legend>Basic OAuth2 client information</legend>
+  <div class="form-group">
+    <label for="txt-client-name" class="form-label">Client name</label>
+    <input name="client_name"
+           type="text"
+           id="txt-client-name"
+           class="form-control"
 	   required="required" />
-    <br /><br />
+  </div>
 
-    <label for="txt-redirect-uri">Redirect URI</label>
-    <input name="redirect_uri" type="text" id="txt-redirect-uri"
+  <div class="form-group">
+    <label for="txt-redirect-uri" class="form-label">Redirect URI</label>
+    <input name="redirect_uri"
+           type="text"
+           id="txt-redirect-uri"
+           class="form-control"
 	   required="required" />
-    <br /><br />
+  </div>
 
-    <label for="txt-other-redirect-uris">
-      Other redirect URIs (Enter one URI per line)</label>
-    <br />
-    <textarea name="other_redirect_uris" id="txt-other-redirect-uris"
+  <div class="form-group">
+    <label for="txt-other-redirect-uris" class="form-label">
+      Other redirect URIs</label>
+    <div class="form-text text-muted">Enter one URI per line</div>
+    <textarea name="other_redirect_uris"
+              id="txt-other-redirect-uris"
 	      cols="80" rows="10"
+              class="form-control"
 	      title="Enter one URI per line."></textarea>
-    <br /><br />
-    <fieldset>
-      <legend>Supported grant types</legend>
-      {%for granttype in granttypes%}
-      <input name="grants[]"
-	     type="checkbox"
-	     value="{{granttype.value}}"
-	     id="chk-{{granttype.name.lower().replace(' ', '-')}}"
-	     checked="checked" />
+  </div>
+
+  <div class="form-group">
+    <legend>Supported grant types</legend>
+    {%for granttype in granttypes%}
+    <div class="checkbox">
       <label for="chk-{{granttype.name.lower().replace(' ', '-')}}">
+        <input name="grants[]"
+	       type="checkbox"
+	       value="{{granttype.value}}"
+	       id="chk-{{granttype.name.lower().replace(' ', '-')}}"
+	       checked="checked" />
         {{granttype.name}}
       </label>
-      <br /><br />
-      {%endfor%}
-    </fieldset>
-  </fieldset>
-
-  <fieldset>
-    <legend>User information</legend>
+    </div>
+    {%endfor%}
+  </div>
 
-    <p>The user to register this client for</p>
-    <select name="user" required="required">
+  <legend>User information</legend>
+  <div class="form-group">
+    <label for="select-user">The user to register this client for</label>
+    <select id="select-user"
+            name="user"
+            class="form-control"
+            required="required">
       {%for user in users%}
       <option value="{{user.user_id}}"
 	      {%if user.user_id==current_user.user_id%}
@@ -69,8 +82,18 @@
 	      {%endif%}>{{user.name}} ({{user.email}})</option>
       {%endfor%}
     </select>
-  </fieldset>
-  
-  <input type="submit" value="register client" />
+  </div>
+
+  <legend>Other metadata</legend>
+  <div class="form-group">
+    <label class="form-group" for="txt-client-jwk-uri">
+      Client's Public JWKs</label>
+    <input type="text"
+           id="txt-client-jwk-uri"
+           name="client_jwk_uri"
+           class="form-control" />
+  </div>
+
+  <input type="submit" value="register client" class="btn btn-primary" />
 </form>
 {%endblock%}
diff --git a/gn_auth/templates/admin/view-oauth2-client.html b/gn_auth/templates/admin/view-oauth2-client.html
index 415873d..c250ee3 100644
--- a/gn_auth/templates/admin/view-oauth2-client.html
+++ b/gn_auth/templates/admin/view-oauth2-client.html
@@ -13,118 +13,82 @@
 {%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>
+    <p><strong>Client ID: </strong> {{client.client_id}}</p>
+    <p><strong>Client Name: </strong> {{client.client_metadata.client_name}}</p>
   </div>
-  <fieldset>
+
+  <div class="form-group">
     <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 />
+    <div class="checkbox">
+      <label for="chk:{{scp}}">
+        <input name="scope[]" id="chk:{{scp}}" type="checkbox" value="{{scp}}"
+	       {%if scp in client.client_metadata.scope%}
+	       checked="checked"
+	       {%endif%} />
+        {{scp}}</label><br />
+    </div>
     {%endfor%}
-  </fieldset>
+  </div>
 
-  <fieldset>
+  <div class="form-group">
     <legend>Redirect URIs</legend>
-    <label for="txt-redirect-uri">Default Redirect URI</label>
+    <label for="txt-redirect-uri" class="form-label">Default Redirect URI</label>
     <br />
-    <input type="text" name="redirect_uri" id="txt-redirect-uri"
+    <input type="text"
+           name="redirect_uri"
+           id="txt-redirect-uri"
 	   value="{{client.client_metadata.default_redirect_uri}}"
 	   required="required"
            class="form-control" />
-    <br /><br />
+  </div>
 
-    <label for="txta:other-redirect-uris">Other Redirect URIs</label>
-    <br />
+  <div class="form-group">
+    <label for="txta:other-redirect-uris"
+           class="form-label">Other Redirect URIs</label>
     <textarea id="txta:other-redirect-uris"
 	      name="other_redirect_uris"
 	      cols="80" rows="10"
+              class="form-control"
 	      title="Enter one URI per line."
 	      >{{"\r\n".join(client.client_metadata.redirect_uris)}}</textarea>
-  </fieldset>
+  </div>
 
-  <fieldset>
+  <div class="form-group">
     <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%} />
+    {%for granttype in granttypes%}
+    <div class="checkbox">
       <label for="chk-{{granttype.name.lower().replace(' ', '-')}}">
+        <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%} />
         {{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>
+    </div>
     {%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>
+  </div>
+
+  <legend>Other metadata</legend>
+  <div class="form-group">
+    <label class="form-group" for="txt-client-jwk-uri">
+      Client's Public JWKs</label>
+    <input type="text"
+           id="txt-client-jwk-uri"
+           name="client_jwk_uri"
+           class="form-control"
+           value="{{client.client_metadata.get('public-jwks-uri', '')}}" />
+  </div>
 
-  <br />
-  <input type="submit" class="btn btn-primary" value="register key" />
+  <input type="submit" class="btn btn-primary" value="update client" />
 </form>
 
 {%endif%}