aboutsummaryrefslogtreecommitdiff
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/dashboard.html24
-rw-r--r--gn_auth/templates/admin/list-oauth2-clients.html56
-rw-r--r--gn_auth/templates/admin/login.html32
-rw-r--r--gn_auth/templates/admin/register-client.html78
-rw-r--r--gn_auth/templates/admin/registered-client.html21
-rw-r--r--gn_auth/templates/admin/view-oauth2-client.html75
6 files changed, 286 insertions, 0 deletions
diff --git a/gn_auth/templates/admin/dashboard.html b/gn_auth/templates/admin/dashboard.html
new file mode 100644
index 0000000..7798022
--- /dev/null
+++ b/gn_auth/templates/admin/dashboard.html
@@ -0,0 +1,24 @@
+{%extends "base.html"%}
+
+{%block title%}Genenetwork3: Admin Dashboard{%endblock%}
+
+{%block pagetitle%}Admin Dashboard{%endblock%}
+
+{%block content%}
+{{flash_messages()}}
+
+<ul class="nav">
+ <li>
+ <a href="{{url_for('oauth2.admin.register_client')}}"
+ title="Register a new OAuth2 client.">Register OAuth2 Client</a>
+ </li>
+ <li>
+ <a href="{{url_for('oauth2.admin.list_clients')}}"
+ title="List OAuth2 clients.">List OAuth2 Client</a>
+ </li>
+ <li>
+ <a href="{{url_for('oauth2.admin.logout')}}"
+ title="Log out of the system.">Logout</a>
+ </li>
+</ul>
+{%endblock%}
diff --git a/gn_auth/templates/admin/list-oauth2-clients.html b/gn_auth/templates/admin/list-oauth2-clients.html
new file mode 100644
index 0000000..0104f0d
--- /dev/null
+++ b/gn_auth/templates/admin/list-oauth2-clients.html
@@ -0,0 +1,56 @@
+{%extends "base.html"%}
+
+{%block title%}Genenetwork3: OAuth2 Clients{%endblock%}
+
+{%block pagetitle%}OAuth2 Clients{%endblock%}
+
+{%block content%}
+{{flash_messages()}}
+
+<table class="table table-hover table-striped cell-border no-footer">
+ <caption>List of registered OAuth2 clients</caption>
+ <thead>
+ <tr>
+ <th>Client ID</th>
+ <th>Client Name</th>
+ <th>Default Redirect URI</th>
+ <th>Owner</th>
+ <th colspan="2">Actions</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ {%for client in clients%}
+ <tr>
+ <td>{{client.client_id}}</td>
+ <td>{{client.client_metadata.client_name}}</td>
+ <td>{{client.client_metadata.default_redirect_uri}}</td>
+ <td>{{client.user.name}} ({{client.user.email}})</td>
+ <td>
+ <a href="{{url_for('oauth2.admin.view_client', client_id=client.client_id)}}"
+ title"View/Edit client {{client.client_metadata.client_name}}"
+ class="btn btn-info">
+ View/Edit
+ </a>
+ </td>
+ <td>
+ <form id="frm:delete:{{client.client_id}}"
+ action="{{url_for('oauth2.admin.delete_client')}}"
+ method="POST">
+ <input type="hidden" name="client_id" value="{{client.client_id}}" />
+ <input type="submit" value="Delete"
+ title"Delete client {{client.client_metadata.client_name}}"
+ class="btn btn-danger" />
+ </form>
+ </td>
+ </tr>
+ {%else%}
+ <tr>
+ <td colspan="4" style="text-align: center;">
+ No registered OAuth2 clients!
+ </td>
+ </tr>
+ {%endfor%}
+ </tbody>
+</table>
+{%endblock%}
diff --git a/gn_auth/templates/admin/login.html b/gn_auth/templates/admin/login.html
new file mode 100644
index 0000000..ac217ab
--- /dev/null
+++ b/gn_auth/templates/admin/login.html
@@ -0,0 +1,32 @@
+{%extends "base.html"%}
+
+{%block title%}Log in to Genenetwork3{%endblock%}
+
+{%block pagetitle%}Admin Log In{%endblock%}
+
+{%block content%}
+{{flash_messages()}}
+
+<form method="POST" action="{{url_for('oauth2.admin.login')}}">
+
+ <fieldset>
+ <legend>User Credentials</legend>
+
+ <input name="next_uri" type="hidden" value={{next_uri}}>
+
+ <fieldset class="form-group">
+ <label for="txt:email" class="form-label">Email Address</label>
+ <input name="email" type="email" id="txt:email" required="required"
+ placeholder="your@email.address" class="form-control" />
+ </fieldset>
+
+ <fieldset class="form-group">
+ <label for="txt:password" class="form-label">Password</label>
+ <input name="password" type="password" id="txt:password"
+ required="required" class="form-control" />
+ </fieldset>
+ </fieldset>
+
+ <input type="submit" value="log in" class="btn btn-primary" />
+</form>
+{%endblock%}
diff --git a/gn_auth/templates/admin/register-client.html b/gn_auth/templates/admin/register-client.html
new file mode 100644
index 0000000..daac977
--- /dev/null
+++ b/gn_auth/templates/admin/register-client.html
@@ -0,0 +1,78 @@
+{%extends "base.html"%}
+
+{%block title%}Genenetwork3: Register OAuth2 Client{%endblock%}
+
+{%block pagetitle%}Register OAuth2 Client{%endblock%}
+
+{%block content%}
+{{flash_messages()}}
+
+<form method="POST" action="{{url_for('oauth2.admin.register_client')}}">
+
+ <fieldset>
+ <legend>Select client scope</legend>
+
+ {%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 />
+ {%endfor%}
+
+ </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"
+ required="required" />
+ <br /><br />
+
+ <label for="txt:redirect-uri">Redirect URI</label>
+ <input name="redirect_uri" type="text" id="txt:redirect-uri"
+ required="required" />
+ <br /><br />
+
+ <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"
+ cols="80" rows="10"
+ title="Enter one URI per line."></textarea>
+ <br /><br />
+ <fieldset>
+ <legend>Supported grant types</legend>
+ <input name="grants[]"
+ type="checkbox"
+ value="authorization_code"
+ id="chk:authorization-code"
+ checked="checked" />
+ <label for="chk:authorization-code">Authorization Code</label>
+ <br /><br />
+
+ <input name="grants[]"
+ type="checkbox"
+ value="refresh_token"
+ id="chk:refresh-token" />
+ <label for="chk:refresh-token">Refresh Token</label>
+ </fieldset>
+ </fieldset>
+
+ <fieldset>
+ <legend>User information</legend>
+
+ <p>The user to register this client for</p>
+ <select name="user" required="required">
+ {%for user in users%}
+ <option value="{{user.user_id}}"
+ {%if user.user_id==current_user.user_id%}
+ selected="selected"
+ {%endif%}>{{user.name}} ({{user.email}})</option>
+ {%endfor%}
+ </select>
+ </fieldset>
+
+ <input type="submit" value="register client" />
+</form>
+{%endblock%}
diff --git a/gn_auth/templates/admin/registered-client.html b/gn_auth/templates/admin/registered-client.html
new file mode 100644
index 0000000..5c46f4d
--- /dev/null
+++ b/gn_auth/templates/admin/registered-client.html
@@ -0,0 +1,21 @@
+{%extends "base.html"%}
+
+{%block title%}Genenetwork3: Register OAuth2 Client{%endblock%}
+
+{%block pagetitle%}Register OAuth2 Client{%endblock%}
+
+{%block content%}
+{{flash_messages()}}
+
+<p>Client has been registered successfully.</p>
+
+<p>Please save the following client details somewhere. There is no way to
+ retrieve the the <strong>CLIENT_SECRET</strong> once you leave this page.</p>
+
+<dl>
+ <dt>CLIENT_ID</dt>
+ <dd>{{client.client_id}}</dd>
+ <dt>CLIENT_SECRET</dt>
+ <dd>{{client_secret}}</dd>
+</dl>
+{%endblock%}
diff --git a/gn_auth/templates/admin/view-oauth2-client.html b/gn_auth/templates/admin/view-oauth2-client.html
new file mode 100644
index 0000000..b90428d
--- /dev/null
+++ b/gn_auth/templates/admin/view-oauth2-client.html
@@ -0,0 +1,75 @@
+{%extends "base.html"%}
+
+{%block title%}Genenetwork3: 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}}" />
+ <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:default-redirect-uri">Default Redirect URI</label>
+ <br />
+ <input type="text" name="default_redirect_uri" id="txt:default-redirect-uri"
+ value="{{client.client_metadata.default_redirect_uri}}"
+ required="required">
+ <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>
+ <input name="grants[]"
+ type="checkbox"
+ value="authorization_code"
+ id="chk:authorization-code"
+ {%if "authorization_code" in client.client_metadata.grant_types%}
+ checked="checked"
+ {%endif%} />
+ <label for="chk:authorization-code">Authorization Code</label>
+ <br /><br />
+
+ <input name="grants[]"
+ type="checkbox"
+ value="refresh_token"
+ id="chk:refresh-token"
+ {%if "refresh_token" in client.client_metadata.grant_types%}
+ checked="checked"
+ {%endif%} />
+ <label for="chk:refresh-token">Refresh Token</label>
+ </fieldset>
+
+ <input type="submit" value="update client" />
+</form>
+{%endif%}
+{%endblock%}