[#746] added microsoft oauth2 provider

This commit is contained in:
Gani Georgiev
2022-10-31 21:17:10 +02:00
parent bcb9c22685
commit 5298543ce4
41 changed files with 279 additions and 141 deletions
@@ -14,7 +14,7 @@
let isLoading = false;
function getProviderTitle(provider) {
return providersList[provider + "Auth"]?.title || CommonHelper.sentenize(auth.provider, false);
return providersList[provider + "Auth"]?.title || CommonHelper.sentenize(provider, false);
}
function getProviderIcon(provider) {
@@ -11,7 +11,7 @@
export let title;
export let icon = "";
export let config = {};
export let showSelfHostedFields = false;
export let optionsComponent;
let accordion;
@@ -82,29 +82,9 @@
</Field>
</div>
{#if showSelfHostedFields}
{#if optionsComponent}
<div class="col-lg-12">
<div class="section-title">Optional endpoints (if you self host the OAUTH2 service)</div>
<div class="grid">
<div class="col-lg-4">
<Field class="form-field" name="{key}.authUrl" let:uniqueId>
<label for={uniqueId}>Custom Auth URL</label>
<input type="url" id={uniqueId} bind:value={config.authUrl} />
</Field>
</div>
<div class="col-lg-4">
<Field class="form-field" name="{key}.tokenUrl" let:uniqueId>
<label for={uniqueId}>Custom Token URL</label>
<input type="text" id={uniqueId} bind:value={config.tokenUrl} />
</Field>
</div>
<div class="col-lg-4">
<Field class="form-field" name="{key}.userApiUrl" let:uniqueId>
<label for={uniqueId}>Custom User API URL</label>
<input type="text" id={uniqueId} bind:value={config.userApiUrl} />
</Field>
</div>
</div>
<svelte:component this={optionsComponent} {key} bind:config />
</div>
{/if}
</div>
@@ -99,7 +99,7 @@
{key}
title={provider.title}
icon={provider.icon || "ri-fingerprint-line"}
showSelfHostedFields={provider.selfHosted}
optionsComponent={provider.optionsComponent}
bind:config={formSettings[key]}
/>
{/each}
@@ -0,0 +1,40 @@
<script>
import Field from "@/components/base/Field.svelte";
export let key = "";
export let config = {};
</script>
<div class="section-title">Azure AD endpoints</div>
<div class="grid">
<div class="col-lg-12">
<Field class="form-field required" name="{key}.authUrl" let:uniqueId>
<label for={uniqueId}>Auth URL</label>
<input
type="url"
id={uniqueId}
required
placeholder="https://login.microsoftonline.com/YOUR_DIRECTORY_TENANT_ID/oauth2/v2.0/authorize"
bind:value={config.authUrl}
/>
<div class="help-block">
Eg. {`https://login.microsoftonline.com/YOUR_DIRECTORY_TENANT_ID/oauth2/v2.0/authorize`}
</div>
</Field>
</div>
<div class="col-lg-12">
<Field class="form-field required" name="{key}.tokenUrl" let:uniqueId>
<label for={uniqueId}>Token URL</label>
<input
type="text"
id={uniqueId}
required
placeholder="https://login.microsoftonline.com/YOUR_DIRECTORY_TENANT_ID/oauth2/v2.0/token"
bind:value={config.tokenUrl}
/>
<div class="help-block">
Eg. {`https://login.microsoftonline.com/YOUR_DIRECTORY_TENANT_ID/oauth2/v2.0/token`}
</div>
</Field>
</div>
</div>
@@ -0,0 +1,28 @@
<script>
import Field from "@/components/base/Field.svelte";
export let key = "";
export let config = {};
</script>
<div class="section-title">Selfhosted endpoints (optional)</div>
<div class="grid">
<div class="col-lg-4">
<Field class="form-field" name="{key}.authUrl" let:uniqueId>
<label for={uniqueId}>Auth URL</label>
<input type="url" id={uniqueId} bind:value={config.authUrl} />
</Field>
</div>
<div class="col-lg-4">
<Field class="form-field" name="{key}.tokenUrl" let:uniqueId>
<label for={uniqueId}>Token URL</label>
<input type="text" id={uniqueId} bind:value={config.tokenUrl} />
</Field>
</div>
<div class="col-lg-4">
<Field class="form-field" name="{key}.userApiUrl" let:uniqueId>
<label for={uniqueId}>User API URL</label>
<input type="text" id={uniqueId} bind:value={config.userApiUrl} />
</Field>
</div>
</div>