diff --git a/frontend/src/lib/components/InstanceSettings.svelte b/frontend/src/lib/components/InstanceSettings.svelte index eb94b0add0..b988cc16cf 100644 --- a/frontend/src/lib/components/InstanceSettings.svelte +++ b/frontend/src/lib/components/InstanceSettings.svelte @@ -28,6 +28,9 @@ let values: Record = {} let initialOauths: Record = {} + let initialRequirePreexistingUserForOauth: boolean = false + let requirePreexistingUserForOauth: boolean = false + let ssoOrOauth: 'sso' | 'oauth' = 'sso' let serverConfig = {} let initialValues: Record = {} @@ -47,6 +50,9 @@ } } initialOauths = (await SettingService.getGlobal({ key: 'oauths' })) ?? {} + requirePreexistingUserForOauth = + (await SettingService.getGlobal({ key: 'require_preexisting_user_for_oauth' })) ?? false + initialRequirePreexistingUserForOauth = requirePreexistingUserForOauth oauths = JSON.parse(JSON.stringify(initialOauths)) initialValues = Object.fromEntries( ( @@ -111,6 +117,12 @@ }) initialOauths = JSON.parse(JSON.stringify(oauths)) } + if (initialRequirePreexistingUserForOauth !== requirePreexistingUserForOauth) { + await SettingService.setGlobal({ + key: 'require_preexisting_user_for_oauth', + requestBody: { value: requirePreexistingUserForOauth } + }) + } } else { console.error('Values not loaded') } @@ -201,34 +213,121 @@ {/if} {/if} {#if category == 'SSO/OAuth'} -
-

SSO

- {#if !$enterpriseLicense || $enterpriseLicense.endsWith('_pro')} - - Without EE, the number of SSO users is limited to 10. SCIM/SAML is available on EE - - {/if} +
+ + SSO + OAuth + +
+ +
+ {#if ssoOrOauth === 'sso'} + {#if !$enterpriseLicense || $enterpriseLicense.endsWith('_pro')} + + Without EE, the number of SSO users is limited to 10. SCIM/SAML is available on + EE + + {/if} + +
+ + When at least one of the below option is set, users will be able to login to + Windmill via their third-party account. +
To test SSO, the recommended workflow is to to save the settings and try to + login in an incognito window. +
+
+ + + + + + + + + + + + {#each Object.keys(oauths) as k} + {#if !['authelia', 'authentik', 'google', 'microsoft', 'github', 'gitlab', 'jumpcloud', 'okta', 'keycloak', 'slack', 'kanidm', 'zitadel'].includes(k) && 'login_config' in oauths[k]} + {#if oauths[k]} +
+
+ + { + delete oauths[k] + oauths = { ...oauths } + }} + /> +
+
+ + + {#if !windmillBuiltins.includes(k) && k != 'slack'} + + {/if} +
+
+ {/if} + {/if} + {/each} +
+
+ + +
+
+ +
+ {:else if ssoOrOauth === 'oauth'} + + When one of the below option is set, you will be able to create a specific + resource containing a token automatically generated by the third-party provider. +
+ To test it after setting an oauth client, go to the Resources menu and create a new + one of the type of your oauth client (i.e. a 'github' resource if you set Github OAuth). +
+
+ +
-
- - The recommended workflow is to to save your oauth setting and test them directly on - the login or resource page - -
- - - - - - - - - - - {#each Object.keys(oauths) as k} - {#if !['authelia', 'authentik', 'google', 'microsoft', 'github', 'gitlab', 'jumpcloud', 'okta', 'keycloak', 'slack', 'kanidm', 'zitadel'].includes(k) && 'login_config' in oauths[k]} - {#if oauths[k]} + {#if !('login_config' in oauths[k])} + {#if !['slack'].includes(k) && oauths[k]}
@@ -257,108 +356,48 @@ /> {#if !windmillBuiltins.includes(k) && k != 'slack'} - + {/if}
{/if} {/if} {/each} -
-
- - -
-

OAuth

- - After setting an oauth client, make sure that there is a corresponding resource type - with the same name with a "token" field in the admins workspace. - -
- -
- {#each Object.keys(oauths) as k} - {#if !['authelia', 'authentik', 'google', 'microsoft', 'github', 'gitlab', 'jumpcloud', 'okta', 'keycloak', 'slack', 'kanidm', 'zitadel'].includes(k) && !('login_config' in oauths[k])} - {#if oauths[k]} -
-
- - { - delete oauths[k] - oauths = { ...oauths } - }} - /> -
-
- - - {#if !windmillBuiltins.includes(k) && k != 'slack'} - - {/if} -
-
+
+ + {#if oauth_name == 'custom'} + + {:else} + {/if} - {/if} - {/each} - -
- - {#if oauth_name == 'custom'} - - {:else} - - {/if} - -
+ +
+ {/if}
{/if}
diff --git a/frontend/src/lib/components/instanceSettings.ts b/frontend/src/lib/components/instanceSettings.ts index 9fa0085a4b..66b09368d6 100644 --- a/frontend/src/lib/components/instanceSettings.ts +++ b/frontend/src/lib/components/instanceSettings.ts @@ -103,14 +103,7 @@ export const settings: Record = { ee_only: '' } ], - 'SSO/OAuth': [ - { - label: 'Require users to have been added manually to windmill to sign in through OAuth', - key: 'require_preexisting_user_for_oauth', - fieldType: 'boolean', - storage: 'setting' - } - ], + 'SSO/OAuth': [], Registries: [ { label: 'Pip Extra Index Url',