aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gn_auth/auth/authorisation/users/admin/views.py5
-rw-r--r--gn_auth/templates/admin/view-oauth2-client.html25
2 files changed, 13 insertions, 17 deletions
diff --git a/gn_auth/auth/authorisation/users/admin/views.py b/gn_auth/auth/authorisation/users/admin/views.py
index 3018a62..b0bb2db 100644
--- a/gn_auth/auth/authorisation/users/admin/views.py
+++ b/gn_auth/auth/authorisation/users/admin/views.py
@@ -256,7 +256,8 @@ def view_client(client_id: uuid.UUID):
return render_template(
"admin/view-oauth2-client.html",
client=with_db_connection(partial(oauth2_client, client_id=client_id)),
- scope=current_app.config["OAUTH2_SCOPE"])
+ scope=current_app.config["OAUTH2_SCOPE"],
+ granttypes=_FORM_GRANT_TYPES_)
@admin.route("/edit-client", methods=["POST"])
@is_admin
@@ -283,7 +284,7 @@ def edit_client():
"redirect_uris": list(set(
[form["redirect_uri"]] +
form["other_redirect_uris"].split("\r\n"))),
- "grants": form.getlist("grants[]"),
+ "grant_types": form.getlist("grants[]"),
"scope": form.getlist("scope[]")
}
with_db_connection(partial(save_client, the_client=OAuth2Client(
diff --git a/gn_auth/templates/admin/view-oauth2-client.html b/gn_auth/templates/admin/view-oauth2-client.html
index 9bc2c0d..3ec0c51 100644
--- a/gn_auth/templates/admin/view-oauth2-client.html
+++ b/gn_auth/templates/admin/view-oauth2-client.html
@@ -49,24 +49,19 @@
<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 />
-
+ {%for granttype in granttypes%}
<input name="grants[]"
type="checkbox"
- value="refresh_token"
- id="chk:refresh-token"
- {%if "refresh_token" in client.client_metadata.grant_types%}
+ value="{{granttype.value}}"
+ id="chk-{{granttype.name.lower().replace(' ', '-')}}"
+ {%if granttype.value in client.client_metadata.grant_types%}
checked="checked"
- {%endif%} />
- <label for="chk:refresh-token">Refresh Token</label>
+ {%endif%} />
+ <label for="chk-{{granttype.name.lower().replace(' ', '-')}}">
+ {{granttype.name}}
+ </label>
+ <br /><br />
+ {%endfor%}
</fieldset>
<input type="submit" value="update client" />