feat(sso): adding the ability to define a custom display name for sso (#4529)

* feat(sso): adding the ability to define a custom display name for sso

* adding openapi-deref.json

* make the display_name field optional

* Update ee-repo-ref.txt
This commit is contained in:
Alexander Petric
2024-10-15 11:32:39 -04:00
committed by GitHub
parent 4199c1c47d
commit 3bf4d4f43e
12 changed files with 69 additions and 12 deletions
+1 -1
View File
@@ -1 +1 @@
8e3fbda05392e641c15262924dc0df47cc42d036
eb79a4e23a2d133a3a964065b354f569e98f1224
+12 -2
View File
@@ -3932,8 +3932,18 @@
"oauth": {
"type": "array",
"items": {
"type": "string"
}
"type": "object",
"properties": {
"type": {
"type": "string"
},
"display_name": {
"type": "string"
}
},
"required": [
"type"
]
},
"saml": {
"type": "string"
+8 -1
View File
@@ -2789,7 +2789,14 @@ paths:
oauth:
type: array
items:
type: string
type: object
properties:
type:
type: string
display_name:
type: string
required:
- type
saml:
type: string
required:
@@ -52,6 +52,10 @@
>
<input type="text" placeholder="yourorg" bind:value={org} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Custom Name</span>
<input type="text" placeholder="Custom Name" bind:value={value['display_name']} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Client Id</span>
<input type="text" placeholder="Client Id" bind:value={value['id']} />
@@ -52,6 +52,10 @@
>
<input type="text" placeholder="yourorg" bind:value={org} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Custom Name</span>
<input type="text" placeholder="Custom Name" bind:value={value['display_name']} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Client Id</span>
<input type="text" placeholder="Client Id" bind:value={value['id']} />
@@ -372,6 +372,10 @@
/>
</div>
<div class="p-2 border rounded">
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Custom Name</span>
<input type="text" placeholder="Custom Name" bind:value={oauths[k]['display_name']} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Client Id</span>
<input
@@ -61,6 +61,10 @@
>
<input type="text" placeholder="Base URL" bind:value={baseUrl} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Custom Name</span>
<input type="text" placeholder="Custom Name" bind:value={value['display_name']} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Client Id</span>
<input type="text" placeholder="Client Id" bind:value={value['id']} />
@@ -52,6 +52,10 @@
>
<input type="text" placeholder="yourorg" bind:value={org} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Custom Name</span>
<input type="text" placeholder="Custom Name" bind:value={value['display_name']} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Client Id</span>
<input type="text" placeholder="Client Id" bind:value={value['id']} />
+16 -8
View File
@@ -55,9 +55,14 @@
const providersType = providers.map((p) => p.type as string)
let showPassword = false
let logins: string[] | undefined = undefined
let logins: OAuthLogin[] | undefined = undefined
let saml: string | undefined = undefined
type OAuthLogin = {
type: string
displayName: string
}
async function login(): Promise<void> {
if (!email || !password) {
sendUserToast('Please fill in both email and password', true)
@@ -144,7 +149,10 @@
async function loadLogins() {
const allLogins = await OauthService.listOauthLogins()
logins = allLogins.oauth
logins = allLogins.oauth.map(login => ({
type: login.type,
displayName: login.display_name || login.type
}))
saml = allLogins.saml
showPassword = (logins.length == 0 && !saml) || (email != undefined && email.length > 0)
@@ -205,26 +213,26 @@
<Skeleton layout={[0.5, [2.375]]} />
{/each}
{:else}
{#each providers as { type, icon, name }}
{#if logins?.includes(type)}
{#each providers as { type, icon }}
{#if logins?.some(login => login.type === type)}
<Button
color="light"
variant="border"
startIcon={{ icon, classes: 'h-4' }}
on:click={() => storeRedirect(type)}
>
{name}
{logins.find(login => login.type === type)?.displayName}
</Button>
{/if}
{/each}
{#each logins.filter((x) => !providersType?.includes(x)) as login}
{#each logins.filter((login) => !providersType?.includes(login.type)) as login}
<Button
color="dark"
variant="border"
btnClasses="mt-2 w-full !border-gray-300"
on:click={() => storeRedirect(login)}
on:click={() => storeRedirect(login.type)}
>
{login}
{login.displayName}
</Button>
{/each}
{/if}
@@ -50,6 +50,10 @@
>
{#if enabled}
<div class="p-2 rounded border">
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Custom Name</span>
<input type="text" placeholder="Custom Name" bind:value={value['display_name']} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Client Id</span>
<input type="text" placeholder="Client Id" bind:value={value['id']} />
@@ -66,6 +66,10 @@
</div>
</div>
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Custom Name</span>
<input type="text" placeholder="Custom Name" bind:value={value['display_name']} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm"
>Client Id <Tooltip
@@ -52,6 +52,10 @@
>
<input type="text" placeholder="yourorg" bind:value={org} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Custom Name</span>
<input type="text" placeholder="Custom Name" bind:value={value['display_name']} />
</label>
<label class="block pb-2">
<span class="text-primary font-semibold text-sm">Client Id</span>
<input type="text" placeholder="Client Id" bind:value={value['id']} />