diff options
author | Frederick Muriuki Muriithi | 2023-05-29 14:56:24 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-05-29 14:56:24 +0300 |
commit | 2aa7abf383df814f24c88beea733c324cda682d0 (patch) | |
tree | 89a9297a8854aa2759f9bd7c3e8217cd3d23d163 /gn3/templates/admin | |
parent | 25c6da03e1639895f0051e8be6502762beefde0b (diff) | |
download | genenetwork3-2aa7abf383df814f24c88beea733c324cda682d0.tar.gz |
auth: Enable registration of OAuth2 clients
Add UI and code to enable the administrative user to register new OAuth2
clients that can access the API server.
Diffstat (limited to 'gn3/templates/admin')
-rw-r--r-- | gn3/templates/admin/dashboard.html | 16 | ||||
-rw-r--r-- | gn3/templates/admin/login.html | 32 | ||||
-rw-r--r-- | gn3/templates/admin/register-client.html | 78 | ||||
-rw-r--r-- | gn3/templates/admin/registered-client.html | 21 |
4 files changed, 147 insertions, 0 deletions
diff --git a/gn3/templates/admin/dashboard.html b/gn3/templates/admin/dashboard.html new file mode 100644 index 0000000..49bf2f6 --- /dev/null +++ b/gn3/templates/admin/dashboard.html @@ -0,0 +1,16 @@ +{%extends "base.html"%} + +{%block title%}Genenetwork3: Admin Dashboard{%endblock%} + +{%block content%} +{{flash_messages()}} + +<h1>Genenetwork3: Admin Dashboard</h1> + +<ul class="nav"> + <li> + <a href="{{url_for('oauth2.admin.register_client')}}" + title="Register a new OAuth2 client.">Register OAuth2 Client</a> + </li> +</ul> +{%endblock%} diff --git a/gn3/templates/admin/login.html b/gn3/templates/admin/login.html new file mode 100644 index 0000000..cf46009 --- /dev/null +++ b/gn3/templates/admin/login.html @@ -0,0 +1,32 @@ +{%extends "base.html"%} + +{%block title%}Log in to Genenetwork3{%endblock%} + +{%block content%} +{{flash_messages()}} + +<h1>Genenetwork3: Admin Log In</h1> + +<form method="POST" action="{{url_for('oauth2.admin.login')}}"> + + <fieldset> + <legend>User Credentials</legend> + + <input name="next_uri" type="hidden" value={{next_uri}}> + + <fieldset> + <label for="txt:email">Email Address</label> + <input name="email" type="email" id="txt:email" required="required" + placeholder="your@email.address" /> + </fieldset> + + <fieldset> + <label for="txt:password">Password</label> + <input name="password" type="password" id="txt:password" + required="required" /> + </fieldset> + </fieldset> + + <input type="submit" value="log in" /> +</form> +{%endblock%} diff --git a/gn3/templates/admin/register-client.html b/gn3/templates/admin/register-client.html new file mode 100644 index 0000000..3058aee --- /dev/null +++ b/gn3/templates/admin/register-client.html @@ -0,0 +1,78 @@ +{%extends "base.html"%} + +{%block title%}Genenetwork3: Register OAuth2 Client{%endblock%} + +{%block content%} +{{flash_messages()}} + +<h1>Genenetwork3: Register OAuth2 Client</h1> + +<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/gn3/templates/admin/registered-client.html b/gn3/templates/admin/registered-client.html new file mode 100644 index 0000000..2fc3990 --- /dev/null +++ b/gn3/templates/admin/registered-client.html @@ -0,0 +1,21 @@ +{%extends "base.html"%} + +{%block title%}Genenetwork3: Register OAuth2 Client{%endblock%} + +{%block content%} +{{flash_messages()}} + +<h1>Genenetwork3: Register OAuth2 Client</h1> + +<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%} |