about summary refs log tree commit diff
path: root/gn_auth
diff options
context:
space:
mode:
Diffstat (limited to 'gn_auth')
-rw-r--r--gn_auth/auth/authorisation/users/admin/views.py12
-rw-r--r--gn_auth/templates/admin/register-client.html16
2 files changed, 19 insertions, 9 deletions
diff --git a/gn_auth/auth/authorisation/users/admin/views.py b/gn_auth/auth/authorisation/users/admin/views.py
index a4c4033..e0ebdf3 100644
--- a/gn_auth/auth/authorisation/users/admin/views.py
+++ b/gn_auth/auth/authorisation/users/admin/views.py
@@ -46,6 +46,17 @@ admin = Blueprint("admin", __name__)
 class RegisterClientError(Exception):
     """Error to raise in case of client registration issues"""
 
+_FORM_GRANT_TYPES_ = ({
+    "name": "Authorization Code",
+    "value": "authorization_code"
+}, {
+    "name": "Refresh Token",
+    "value": "refresh_token"
+}, {
+    "name": "JWT Bearer Token",
+    "value": "urn:ietf:params:oauth:grant-type:jwt-bearer"
+})
+
 @admin.before_request
 def update_expires():
     """Update session expiration."""
@@ -183,6 +194,7 @@ def register_client():
             "admin/register-client.html",
             scope=current_app.config["OAUTH2_SCOPE"],
             users=with_db_connection(__list_users__),
+            granttypes=_FORM_GRANT_TYPES_,
             current_user=session.session_user())
 
     form = request.form
diff --git a/gn_auth/templates/admin/register-client.html b/gn_auth/templates/admin/register-client.html
index 5d525c5..20d7aa2 100644
--- a/gn_auth/templates/admin/register-client.html
+++ b/gn_auth/templates/admin/register-client.html
@@ -43,19 +43,17 @@
     <br /><br />
     <fieldset>
       <legend>Supported grant types</legend>
+      {%for granttype in granttypes%}
       <input name="grants[]"
 	     type="checkbox"
-	     value="authorization_code"
-	     id="chk-authorization-code"
+	     value="{{granttype.value}}"
+	     id="chk-{{granttype.name.lower().replace(' ', '-')}}"
 	     checked="checked" />
-      <label for="chk-authorization-code">Authorization Code</label>
+      <label for="chk-{{granttype.name.lower().replace(' ', '-')}}">
+        {{granttype.name}}
+      </label>
       <br /><br />
-
-      <input name="grants[]"
-	     type="checkbox"
-	     value="refresh_token"
-	     id="chk-refresh-token" />
-      <label for="chk-refresh-token">Refresh Token</label>
+      {%endfor%}
     </fieldset>
   </fieldset>