Working on Knockout model integration into existing authentication settings editor view.

This commit is contained in:
Matt Scott 2023-04-09 10:26:07 -04:00
parent 737e104912
commit 827da59ae2
No known key found for this signature in database
GPG Key ID: A9A0AFFC0E079001
3 changed files with 55 additions and 23 deletions

View File

@ -93,6 +93,7 @@ class Setting(db.Model):
'google_oauth_client_secret': '',
'google_oauth_scope': 'openid email profile',
'google_base_url': 'https://www.googleapis.com/oauth2/v3/',
'google_oauth_auto_configure': True,
'google_oauth_metadata_url': 'https://accounts.google.com/.well-known/openid-configuration',
'google_token_url': 'https://oauth2.googleapis.com/token',
'google_authorize_url': 'https://accounts.google.com/o/oauth2/v2/auth',
@ -103,6 +104,7 @@ class Setting(db.Model):
'github_oauth_secret': '',
'github_oauth_scope': 'email',
'github_oauth_api_url': 'https://api.github.com/user',
'github_oauth_auto_configure': False,
'github_oauth_metadata_url': '',
'github_oauth_token_url': 'https://github.com/login/oauth/access_token',
'github_oauth_authorize_url': 'https://github.com/login/oauth/authorize',
@ -113,6 +115,7 @@ class Setting(db.Model):
'azure_oauth_secret': '',
'azure_oauth_scope': 'User.Read openid email profile',
'azure_oauth_api_url': 'https://graph.microsoft.com/v1.0/',
'azure_oauth_auto_configure': True,
'azure_oauth_metadata_url': '',
'azure_oauth_token_url': '',
'azure_oauth_authorize_url': '',
@ -132,6 +135,7 @@ class Setting(db.Model):
'oidc_oauth_secret': '',
'oidc_oauth_scope': 'email',
'oidc_oauth_api_url': '',
'oidc_oauth_auto_configure': True,
'oidc_oauth_metadata_url': '',
'oidc_oauth_token_url': '',
'oidc_oauth_authorize_url': '',

View File

@ -46,7 +46,7 @@ let AuthenticationSettingsModel = function (user_data, csrf_token, selector) {
google_oauth_client_secret: '',
google_oauth_scope: '',
google_base_url: '',
google_oauth_auto_configure: false,
google_oauth_auto_configure: true,
google_oauth_metadata_url: '',
google_token_url: '',
google_authorize_url: '',
@ -68,7 +68,7 @@ let AuthenticationSettingsModel = function (user_data, csrf_token, selector) {
azure_oauth_secret: '',
azure_oauth_scope: '',
azure_oauth_api_url: '',
azure_oauth_auto_configure: false,
azure_oauth_auto_configure: true,
azure_oauth_metadata_url: '',
azure_oauth_token_url: '',
azure_oauth_authorize_url: '',
@ -88,7 +88,7 @@ let AuthenticationSettingsModel = function (user_data, csrf_token, selector) {
oidc_oauth_secret: '',
oidc_oauth_scope: '',
oidc_oauth_api_url: '',
oidc_oauth_auto_configure: false,
oidc_oauth_auto_configure: true,
oidc_oauth_metadata_url: '',
oidc_oauth_token_url: '',
oidc_oauth_authorize_url: '',

View File

@ -798,6 +798,13 @@
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<input type="checkbox" id="google_oauth_auto_configure"
name="google_oauth_auto_configure" class="checkbox"
data-bind="checked: google_oauth_auto_configure">
<label for="google_oauth_auto_configure">Enable Google
OAuth Auto-Configuration</label>
</div>
<div class="form-group" data-bind="visible: google_oauth_auto_configure">
<label for="google_oauth_metadata_url">Metadata
URL</label>
<input type="text" class="form-control"
@ -805,19 +812,19 @@
id="google_oauth_metadata_url"
placeholder="e.g. https://accounts.google.com/.well-known/openid-configuration"
data-error="Please input Metadata URL"
data-bind="enable: google_oauth_enabled, value: google_oauth_metadata_url, valueUpdate: 'afterkeydown'">
data-bind="enable: google_oauth_enabled() && google_oauth_auto_configure(), value: google_oauth_metadata_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<div class="form-group" data-bind="hidden: google_oauth_auto_configure">
<label for="google_token_url">Token URL</label>
<input type="text" class="form-control"
name="google_token_url" id="google_token_url"
placeholder="e.g. https://oauth2.googleapis.com/token"
data-error="Please input token URL"
data-bind="enable: google_oauth_enabled, value: google_token_url, valueUpdate: 'afterkeydown'">
data-bind="enable: google_oauth_enabled() && !google_oauth_auto_configure(), value: google_token_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<div class="form-group" data-bind="hidden: google_oauth_auto_configure">
<label for="google_authorize_url">Authorize
URL</label>
<input type="text" class="form-control"
@ -825,7 +832,7 @@
id="google_authorize_url"
placeholder="e.g. https://accounts.google.com/o/oauth2/v2/auth"
data-error="Please input Authorize URL"
data-bind="enable: google_oauth_enabled, value: google_authorize_url, valueUpdate: 'afterkeydown'">
data-bind="enable: google_oauth_enabled() && !google_oauth_auto_configure(), value: google_authorize_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
</fieldset>
@ -927,6 +934,13 @@
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<input type="checkbox" id="github_oauth_auto_configure"
name="github_oauth_auto_configure" class="checkbox"
data-bind="checked: github_oauth_auto_configure">
<label for="github_oauth_auto_configure">Enable GitHub
OAuth Auto-Configuration</label>
</div>
<div class="form-group" data-bind="visible: github_oauth_auto_configure">
<label for="github_oauth_metadata_url">Metadata
URL</label>
<input type="text" class="form-control"
@ -934,10 +948,10 @@
id="github_oauth_metadata_url"
placeholder="e.g. https://{yourDomain}/.well-known/oauth-metadata.json"
data-error="Please input Metadata URL"
data-bind="enable: github_oauth_enabled, value: github_oauth_metadata_url, valueUpdate: 'afterkeydown'">
data-bind="enable: github_oauth_enabled() && github_oauth_auto_configure(), value: github_oauth_metadata_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<div class="form-group" data-bind="hidden: github_oauth_auto_configure">
<label for="github_oauth_token_url">Token
URL</label>
<input type="text" class="form-control"
@ -945,10 +959,10 @@
id="github_oauth_token_url"
placeholder="e.g. https://github.com/login/oauth/access_token"
data-error="Please input Token URL"
data-bind="enable: github_oauth_enabled, value: github_oauth_token_url, valueUpdate: 'afterkeydown'">
data-bind="enable: github_oauth_enabled() && !github_oauth_auto_configure(), value: github_oauth_token_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<div class="form-group" data-bind="hidden: github_oauth_auto_configure">
<label for="github_oauth_authorize_url">Authorize
URL</label>
<input type="text" class="form-control"
@ -956,7 +970,7 @@
id="github_oauth_authorize_url"
placeholder="e.g. https://github.com/login/oauth/authorize"
data-error="Please input Authorize URL"
data-bind="enable: github_oauth_enabled, value: github_oauth_authorize_url, valueUpdate: 'afterkeydown'">
data-bind="enable: github_oauth_enabled() && !github_oauth_auto_configure(), value: github_oauth_authorize_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
</fieldset>
@ -1056,6 +1070,13 @@
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<input type="checkbox" id="azure_oauth_auto_configure"
name="azure_oauth_auto_configure" class="checkbox"
data-bind="checked: azure_oauth_auto_configure">
<label for="azure_oauth_auto_configure">Enable Azure
OAuth Auto-Configuration</label>
</div>
<div class="form-group" data-bind="visible: azure_oauth_auto_configure">
<label for="azure_oauth_metadata_url">Metadata
URL</label>
<input type="text" class="form-control"
@ -1063,20 +1084,20 @@
id="azure_oauth_metadata_url"
placeholder="e.g. https://login.microsoftonline.com/{TENANCY_ID}/v2.0/.well-known/openid-configuration"
data-error="Please input Metadata URL"
data-bind="enable: azure_oauth_enabled, value: azure_oauth_metadata_url, valueUpdate: 'afterkeydown'">
data-bind="enable: azure_oauth_enabled() && azure_oauth_auto_configure(), value: azure_oauth_metadata_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<div class="form-group" data-bind="hidden: azure_oauth_auto_configure">
<label for="azure_oauth_token_url">Token URL</label>
<input type="text" class="form-control"
name="azure_oauth_token_url"
id="azure_oauth_token_url"
placeholder="e.g. https://login.microsoftonline.com/{TENANCY_ID}/oauth2/v2.0/token"
data-error="Please input Token URL"
data-bind="enable: azure_oauth_enabled, value: azure_oauth_token_url, valueUpdate: 'afterkeydown'">
data-bind="enable: azure_oauth_enabled() && !azure_oauth_auto_configure(), value: azure_oauth_token_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<div class="form-group" data-bind="hidden: azure_oauth_auto_configure">
<label for="azure_oauth_authorize_url">Authorize
URL</label>
<input type="text" class="form-control"
@ -1084,7 +1105,7 @@
id="azure_oauth_authorize_url"
placeholder="e.g. https://login.microsoftonline.com/{TENANCY_ID}/oauth2/v2.0/authorize"
data-error="Please input Authorize URL"
data-bind="enable: azure_oauth_enabled, value: azure_oauth_authorize_url, valueUpdate: 'afterkeydown'">
data-bind="enable: azure_oauth_enabled() && !azure_oauth_auto_configure(), value: azure_oauth_authorize_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
</fieldset>
@ -1362,6 +1383,13 @@
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<input type="checkbox" id="oidc_oauth_auto_configure"
name="oidc_oauth_auto_configure" class="checkbox"
data-bind="checked: oidc_oauth_auto_configure">
<label for="oidc_oauth_auto_configure">Enable OIDC
OAuth Auto-Configuration</label>
</div>
<div class="form-group" data-bind="visible: oidc_oauth_auto_configure">
<label for="oidc_oauth_metadata_url">Metadata
URL</label>
<input type="text" class="form-control"
@ -1369,20 +1397,20 @@
id="oidc_oauth_metadata_url"
placeholder="e.g. https://{YOUR_DOMAIN}/login/oauth/.well-known/openid-configuration"
data-error="Please input Metadata URL"
data-bind="enable: oidc_oauth_enabled, value: oidc_oauth_metadata_url, valueUpdate: 'afterkeydown'">
data-bind="enable: oidc_oauth_enabled() && oidc_oauth_auto_configure(), value: oidc_oauth_metadata_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<div class="form-group" data-bind="hidden: oidc_oauth_auto_configure">
<label for="oidc_oauth_token_url">Token URL</label>
<input type="text" class="form-control"
name="oidc_oauth_token_url"
id="oidc_oauth_token_url"
placeholder="e.g. https://{YOUR_DOMAIN}/login/oauth/access_token"
data-error="Please input Token URL"
data-bind="enable: oidc_oauth_enabled, value: oidc_oauth_token_url, valueUpdate: 'afterkeydown'">
data-bind="enable: oidc_oauth_enabled() && !oidc_oauth_auto_configure(), value: oidc_oauth_token_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">
<div class="form-group" data-bind="hidden: oidc_oauth_auto_configure">
<label for="oidc_oauth_authorize_url">Authorize
URL</label>
<input type="text" class="form-control"
@ -1390,7 +1418,7 @@
id="oidc_oauth_authorize_url"
placeholder="e.g. https://{YOUR_DOMAIN}/login/oauth/authorize"
data-error="Please input Authorize URL"
data-bind="enable: oidc_oauth_enabled, value: oidc_oauth_authorize_url, valueUpdate: 'afterkeydown'">
data-bind="enable: oidc_oauth_enabled() && !oidc_oauth_auto_configure(), value: oidc_oauth_authorize_url, valueUpdate: 'afterkeydown'">
<span class="help-block with-errors"></span>
</div>
<div class="form-group">