@crombolo/entra 0.60.0 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -7
- package/provenance.json +41 -38
- package/src/server/index.ts +270 -0
- package/src/backoffice/entra-client.js +0 -40
- package/src/backoffice/entra-workspace.js +0 -347
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crombolo/entra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0",
|
|
4
4
|
"description": "Edit a Microsoft Entra sign-in from the Crombolo backoffice: tenant, app credentials and group mappings, over the provider the site declares in code.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Crombolo",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"id": "entra",
|
|
42
42
|
"name": "Microsoft Entra",
|
|
43
43
|
"server": "entraSettings",
|
|
44
|
-
"schemaVersion":
|
|
44
|
+
"schemaVersion": 6,
|
|
45
45
|
"settings": {
|
|
46
46
|
"section": {
|
|
47
47
|
"label": "Where the Entra settings are",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"permissions": {
|
|
57
|
-
"backoffice.code": "Shows the Microsoft Entra sign-in settings screen",
|
|
58
57
|
"identityProviders.read": "Shows the Microsoft Entra sign-in settings on its screen",
|
|
59
58
|
"identityProviders.write": "Saves the Entra settings an administrator changes there"
|
|
60
59
|
},
|
|
@@ -77,17 +76,17 @@
|
|
|
77
76
|
"type": "workspace",
|
|
78
77
|
"alias": "Crombolo.Workspace.Entra",
|
|
79
78
|
"name": "Microsoft Entra Workspace",
|
|
80
|
-
"element": "src/backoffice/entra-workspace.js",
|
|
81
79
|
"meta": {
|
|
82
80
|
"entityType": "crombolo-entra"
|
|
83
|
-
}
|
|
81
|
+
},
|
|
82
|
+
"screen": "sign-in"
|
|
84
83
|
}
|
|
85
84
|
]
|
|
86
85
|
},
|
|
87
86
|
"peerDependencies": {
|
|
88
|
-
"@crombolo/crombolo": ">=0.
|
|
87
|
+
"@crombolo/crombolo": ">=0.62.0"
|
|
89
88
|
},
|
|
90
89
|
"dependencies": {
|
|
91
|
-
"@crombolo/extension": "0.
|
|
90
|
+
"@crombolo/extension": "0.62.0"
|
|
92
91
|
}
|
|
93
92
|
}
|
package/provenance.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"format": 1,
|
|
3
|
-
"digest": "sha256-
|
|
3
|
+
"digest": "sha256-af2fa654941e9bb8b386435c05dd2a6c468ee7e365938b60300c99d225dda631",
|
|
4
4
|
"signature": {
|
|
5
5
|
"mediaType": "application/vnd.dev.sigstore.bundle.v0.3+json",
|
|
6
6
|
"verificationMaterial": {
|
|
7
7
|
"certificate": {
|
|
8
|
-
"rawBytes": "
|
|
8
|
+
"rawBytes": "MIIHBTCCBoygAwIBAgIULEbtdhbxXuoRDv1yfWWX2a36VQAwCgYIKoZIzj0EAwMwNzEVMBMGA1UEChMMc2lnc3RvcmUuZGV2MR4wHAYDVQQDExVzaWdzdG9yZS1pbnRlcm1lZGlhdGUwHhcNMjYxMTExMTI0OTUzWhcNMjYxMTExMTI1OTUzWjAAMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEp8KA40xTPvcUb9L0MBdwg9Dj3QoY56UjlfoRebDSu7z1smDjf+tqQS8+JQ24CmsyIIKjfUj9e63ALPeNwrHkA6OCBaswggWnMA4GA1UdDwEB/wQEAwIHgDATBgNVHSUEDDAKBggrBgEFBQcDAzAfBgNVHSMEGDAWgBTf0+nPViQRlvmo2OkoVaLGLhhkPzBnBgNVHREBAf8EXTBbhllodHRwczovL2dpdGh1Yi5jb20va2luZWNvLWF1L2Nyb21ib2xvLWNtcy8uZ2l0aHViL3dvcmtmbG93cy9yZWxlYXNlLnltbEByZWZzL3RhZ3MvdjAuNjIuMDA5BgorBgEEAYO/MAEBBCtodHRwczovL3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UueW1sQHJlZnMvdGFncy92MC42Mi4wMDgGCisGAQQBg78wARMEKgwoYWU2N2E1Mzk5OWIyMTQ3ZjE1N2JlMmQ3NDI2MmZlZTg2YjQ1MmMzMjAUBgorBgEEAYO/MAEUBAYMBHB1c2gwXQYKKwYBBAGDvzABFQRPDE1odHRwczovL2dpdGh1Yi5jb20va2luZWNvLWF1L2Nyb21ib2xvLWNtcy9hY3Rpb25zL3J1bnMvNDMwMTg2Nzk0OTYvYXR0ZW1wdHMvMTAWBgorBgEEAYO/MAEWBAgMBnB1YmxpYzBVBgorBgEEAYO/MAEYBEcMRXJlcG86a2luZWNvLWF1QDcwMTI3MDQ3L2Nyb21ib2xvLWNtc0AxNDAxNjA1ODY0OnJlZjpyZWZzL3RhZ3MvdjAuNjIuMDCBigYKKwYBBAHWeQIEAgR8BHoAeAB2AN09MGrGxxEyYxkeHJlnNwKiSl643jyt/4eKcoAvKe6OAAABocqoXQsAAAQDAEcwRQIgbVeszeYP77742unGs9peO1eGWAeQZMQu8qM1gTjcQsICIQDQduT9N4VlqHL6g4//Z+s0i47FoHzzkT8dYG8hsdlNkzAKBggqhkjOPQQDAwNnADBkAjBL5jkUyg/rV6Q4RZfY9Zfeu/du8GN3OEHW4X2C72ts+sCV4kqXl4Cp84C3Rz0HcAgCMHEmU8k/M1+5edOBjP+7ejyX7DoZxa2tjgIf9RtzX5TccKCVFDtLC+TAHkAMYocnSQ=="
|
|
9
9
|
},
|
|
10
10
|
"tlogEntries": [
|
|
11
11
|
{
|
|
12
|
-
"logIndex": "
|
|
12
|
+
"logIndex": "3810072430",
|
|
13
13
|
"logId": {
|
|
14
14
|
"keyId": "wNI9atQGlz+VWfO6LRygH4QUfY/8W4RFwiT5i5WRgB0="
|
|
15
15
|
},
|
|
@@ -17,33 +17,36 @@
|
|
|
17
17
|
"kind": "dsse",
|
|
18
18
|
"version": "0.0.1"
|
|
19
19
|
},
|
|
20
|
-
"integratedTime": "
|
|
20
|
+
"integratedTime": "1794401395",
|
|
21
21
|
"inclusionPromise": {
|
|
22
|
-
"signedEntryTimestamp": "
|
|
22
|
+
"signedEntryTimestamp": "MEUCIQC6dqlCLNiUqAm2gQjP2ut+ul60cW2IKROnKuPEZaNthAIgIW6Pt3dfx/iKpmquJl690H9k7MC77s+Lf2p8+rnG1TU="
|
|
23
23
|
},
|
|
24
24
|
"inclusionProof": {
|
|
25
|
-
"logIndex": "
|
|
26
|
-
"rootHash": "
|
|
27
|
-
"treeSize": "
|
|
25
|
+
"logIndex": "3688168168",
|
|
26
|
+
"rootHash": "Ow/UHFZ+gKsrOhwofHh26VvXmEdnF6+FXVyt69VTHmc=",
|
|
27
|
+
"treeSize": "3688168740",
|
|
28
28
|
"hashes": [
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
29
|
+
"EkGe1PipyeGCGJ/HJsZRvm3VTsS49n4vMKMJfVeRXkU=",
|
|
30
|
+
"RGFro//bMcaQkJQl4YbA9ML841YepD5CljeNueUde94=",
|
|
31
|
+
"DtwjeCa03MTrrp8F58uJHimbnvUxJ9+PrSrnb6hQ7M0=",
|
|
32
|
+
"GUisnkphSz7/n+JYQKnmv1TjGniQJ0X81FK7yzB+7S8=",
|
|
33
|
+
"BEA04GywaEA53ZQ35wjf8x03Ke9qPGxtpv+rowKV8tE=",
|
|
34
|
+
"orSwldrhKAK5606xMhXok+2l5I4FuiY5y+K53wrN4yA=",
|
|
35
|
+
"8uts/YXo7N5DaXnmJOb5AzrWxdnL/qJQJDAHb4PBMV0=",
|
|
36
|
+
"L3RJrAMBApU8Sx7CsvaSj5kfJ6D87WhhBk3Y90a4kpk=",
|
|
37
|
+
"vcdtQueDNexkFiMYv1D1hvAozUupol/OARGw1gWl1jw=",
|
|
38
|
+
"R7Shy4ZUJBnZGJmc8KfY97/r2x7iqgBWjXre7zpYtC0=",
|
|
39
|
+
"9bBIe6bNsNBH3QEj+1HaEm+rheT3cnAMWSh+e1e2Juk=",
|
|
40
|
+
"l8ifHfCcu0EVYJnE1R+DWhUXTSZTu3yqAajiy4cPjkw=",
|
|
41
|
+
"RherH2UN2hfI6gPGCBs6acME+sCqgsqCx3gBqCyu/6U=",
|
|
42
|
+
"EvOCrj+AQ09S/m4kezsVa5dX8OMU5hBwWCC2sa4MqRs=",
|
|
43
|
+
"/CzC/GcSfeYyxr6p+BF2Vp6V6dJfjTNMrIRXb2cduWM=",
|
|
44
|
+
"ZZBlzpOi9EWdgPvKO7InHcdM6lEQ5GHZx20H/9miZKk=",
|
|
45
|
+
"rbqMlT1u8u6DMAXFgEI36dAjywBjWiEwHy1mQbrNjew=",
|
|
46
|
+
"Z3tfvfEJT0yHchFSsqqbbNrAhC7kCDQsHwD5OHm35oU=",
|
|
47
|
+
"eBJha705ZuWMzapLh9OYURZmV/ZJACVLfvbQtF/d600=",
|
|
48
|
+
"Fi+BO6OXYoidtnICrZZRGVe4C0Do3dzZvsR7arPlpFc=",
|
|
49
|
+
"vIhOJ6KiGvig/14xSGhs6CC3a76vmTsrJ9v2cgfvvls=",
|
|
47
50
|
"5aDKaREuMwcynRhLn5m/9b0QE9pxbeQInhCcIC+n5YQ=",
|
|
48
51
|
"XPex1okR3Qf1VhXr/LVSojah9cB4R1RgvK/mRrmdWLY=",
|
|
49
52
|
"SlixnS34BhAO+yRI2FaGPSOh9V6JSVNPfLl1bHxrcQY=",
|
|
@@ -51,20 +54,20 @@
|
|
|
51
54
|
"xH/DCseLHr9eKoYT8qsORZK7zVdEGYWHuVtsVrD95wY="
|
|
52
55
|
],
|
|
53
56
|
"checkpoint": {
|
|
54
|
-
"envelope": "rekor.sigstore.dev - 1193050959916656506\
|
|
57
|
+
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"timestampVerificationData": {}
|
|
61
64
|
},
|
|
62
65
|
"dsseEnvelope": {
|
|
63
|
-
"payload": "
|
|
66
|
+
"payload": "eyJfdHlwZSI6Imh0dHBzOi8vaW4tdG90by5pby9TdGF0ZW1lbnQvdjEiLCJzdWJqZWN0IjpbeyJuYW1lIjoiY3JvbWJvbG8tYnVuZGxlIiwiZGlnZXN0Ijp7InNoYTI1NiI6ImFmMmZhNjU0OTQxZTliYjhiMzg2NDM1YzA1ZGQyYTZjNDY4ZWU3ZTM2NTkzOGI2MDMwMGM5OWQyMjVkZGE2MzEifX1dLCJwcmVkaWNhdGVUeXBlIjoiaHR0cHM6Ly9jcm9tYm9sby5kZXYvYnVuZGxlLXByb3ZlbmFuY2UvdjEiLCJwcmVkaWNhdGUiOnsiZm9ybWF0IjoxfX0=",
|
|
64
67
|
"payloadType": "application/vnd.in-toto+json",
|
|
65
68
|
"signatures": [
|
|
66
69
|
{
|
|
67
|
-
"sig": "
|
|
70
|
+
"sig": "MEUCIQDL+QLK+dFUEZMsHa3Y/2yf5/L0s/wMJIgnTXjCvn3ITgIgU5IewIfh/bVy384Y1wrK6wVMtlgiGDFghiHFqKRoglE="
|
|
68
71
|
}
|
|
69
72
|
]
|
|
70
73
|
}
|
|
@@ -72,15 +75,15 @@
|
|
|
72
75
|
"source": {
|
|
73
76
|
"issuer": "https://token.actions.githubusercontent.com",
|
|
74
77
|
"repository": "kineco-au/crombolo-cms",
|
|
75
|
-
"ref": "refs/tags/v0.
|
|
76
|
-
"commit": "
|
|
77
|
-
"workflow": "https://github.com/kineco-au/crombolo-cms/.github/workflows/release.yml@refs/tags/v0.
|
|
78
|
-
"run": "https://github.com/kineco-au/crombolo-cms/actions/runs/
|
|
78
|
+
"ref": "refs/tags/v0.62.0",
|
|
79
|
+
"commit": "ae67a53999b2147f157be2d74262fee86b452c32",
|
|
80
|
+
"workflow": "https://github.com/kineco-au/crombolo-cms/.github/workflows/release.yml@refs/tags/v0.62.0",
|
|
81
|
+
"run": "https://github.com/kineco-au/crombolo-cms/actions/runs/43018679496/attempts/1"
|
|
79
82
|
},
|
|
80
83
|
"links": {
|
|
81
|
-
"commit": "https://github.com/kineco-au/crombolo-cms/commit/
|
|
82
|
-
"tag": "https://github.com/kineco-au/crombolo-cms/releases/tag/v0.
|
|
83
|
-
"run": "https://github.com/kineco-au/crombolo-cms/actions/runs/
|
|
84
|
-
"log": "https://search.sigstore.dev/?logIndex=
|
|
84
|
+
"commit": "https://github.com/kineco-au/crombolo-cms/commit/ae67a53999b2147f157be2d74262fee86b452c32",
|
|
85
|
+
"tag": "https://github.com/kineco-au/crombolo-cms/releases/tag/v0.62.0",
|
|
86
|
+
"run": "https://github.com/kineco-au/crombolo-cms/actions/runs/43018679496/attempts/1",
|
|
87
|
+
"log": "https://search.sigstore.dev/?logIndex=3810072430"
|
|
85
88
|
}
|
|
86
89
|
}
|
package/src/server/index.ts
CHANGED
|
@@ -9,12 +9,28 @@
|
|
|
9
9
|
* administrators only, because a group mapping can make someone an administrator.
|
|
10
10
|
*/
|
|
11
11
|
import {
|
|
12
|
+
type BundleIdentityProviders,
|
|
12
13
|
type BundleRouteContext,
|
|
14
|
+
type BundleScreenContext,
|
|
13
15
|
type BundleSection,
|
|
16
|
+
button,
|
|
17
|
+
cell,
|
|
18
|
+
empty,
|
|
19
|
+
type Field,
|
|
20
|
+
field,
|
|
21
|
+
form,
|
|
22
|
+
notice,
|
|
14
23
|
type ProviderOverrideInput,
|
|
24
|
+
problem,
|
|
15
25
|
type RouteContext,
|
|
16
26
|
route,
|
|
27
|
+
row,
|
|
28
|
+
type ScreenResult,
|
|
17
29
|
type ServerBundle,
|
|
30
|
+
screen,
|
|
31
|
+
tab,
|
|
32
|
+
table,
|
|
33
|
+
tabs,
|
|
18
34
|
} from '@crombolo/extension'
|
|
19
35
|
import manifest from '../../package.json' with { type: 'json' }
|
|
20
36
|
|
|
@@ -86,12 +102,266 @@ async function entraProvider(context: Context) {
|
|
|
86
102
|
const adminOnly = () =>
|
|
87
103
|
json({ ok: false, message: 'Only an administrator can change how people sign in.' }, 403)
|
|
88
104
|
|
|
105
|
+
const AUDIENCE_NAMES: Record<string, string> = { user: 'Backoffice users', member: 'Members' }
|
|
106
|
+
|
|
107
|
+
type Provider = Awaited<ReturnType<BundleIdentityProviders['list']>>[number]
|
|
108
|
+
type SignInContext = BundleScreenContext<Capability>
|
|
109
|
+
|
|
110
|
+
const ADMIN_ONLY = 'Only an administrator can change how people sign in.'
|
|
111
|
+
|
|
112
|
+
/** A field's hint when an administrator changed it here rather than in the code. */
|
|
113
|
+
const changedHere = (provider: Provider, name: string) =>
|
|
114
|
+
provider.overridden.includes(name) ? 'Changed here, not in the code.' : undefined
|
|
115
|
+
|
|
116
|
+
/** Why a sign-in cannot be changed here, when it is locked (story 305). */
|
|
117
|
+
const lockedBecause = (provider: Provider) =>
|
|
118
|
+
provider.locked === 'config'
|
|
119
|
+
? "Locked by the site's configuration: it signs in by the code alone."
|
|
120
|
+
: provider.locked === 'environment'
|
|
121
|
+
? "Locked by the server's settings: it signs in by the code alone."
|
|
122
|
+
: undefined
|
|
123
|
+
|
|
124
|
+
/** One sign-in's form: what is in force, read-only for anyone but an administrator. */
|
|
125
|
+
function providerForm(
|
|
126
|
+
provider: Provider,
|
|
127
|
+
groups: Array<{ value: string; name: string }>,
|
|
128
|
+
isAdmin: boolean,
|
|
129
|
+
) {
|
|
130
|
+
const lock = lockedBecause(provider)
|
|
131
|
+
const canEdit = isAdmin && !lock
|
|
132
|
+
const readOnly = !canEdit
|
|
133
|
+
const hinted = (name: string, options: Record<string, unknown> = {}) => {
|
|
134
|
+
const hint = lock ?? changedHere(provider, name)
|
|
135
|
+
return { readOnly, ...(hint ? { hint } : {}), ...options }
|
|
136
|
+
}
|
|
137
|
+
const fields: Field[] = [
|
|
138
|
+
field.text('name', 'Button text', hinted('name')),
|
|
139
|
+
field.text('tenantId', 'Tenant ID', hinted('tenantId')),
|
|
140
|
+
field.text('clientId', 'Application (client) ID', hinted('clientId')),
|
|
141
|
+
field.secret('clientSecret', 'Client secret', {
|
|
142
|
+
readOnly,
|
|
143
|
+
hint: provider.missingSecret
|
|
144
|
+
? 'This sign-in goes somewhere the code did not name, so it needs its own secret. Enter it to sign people in again.'
|
|
145
|
+
: provider.hasClientSecret
|
|
146
|
+
? 'A secret is set. Enter a new one to replace it.'
|
|
147
|
+
: 'No secret is set.',
|
|
148
|
+
}),
|
|
149
|
+
field.boolean('autoCreate', 'Create accounts', hinted('autoCreate')),
|
|
150
|
+
field.boolean('linkByEmail', 'Link by email', hinted('linkByEmail')),
|
|
151
|
+
field.boolean('emailsVerified', 'Trust emails', hinted('emailsVerified')),
|
|
152
|
+
field.list(
|
|
153
|
+
'mappings',
|
|
154
|
+
'Group mappings',
|
|
155
|
+
[
|
|
156
|
+
field.text('claim', 'Entra group object ID', { required: true }),
|
|
157
|
+
field.choice(
|
|
158
|
+
'group',
|
|
159
|
+
'Group here',
|
|
160
|
+
groups.map((group) => ({ value: group.value, label: group.name })),
|
|
161
|
+
{ required: true },
|
|
162
|
+
),
|
|
163
|
+
],
|
|
164
|
+
hinted('groupMap', {
|
|
165
|
+
addLabel: 'Add a mapping',
|
|
166
|
+
hint: "An Entra group's object ID, and the group here its members join. Made to match on every sign-in.",
|
|
167
|
+
}),
|
|
168
|
+
),
|
|
169
|
+
// One per group, as the default groups are a set.
|
|
170
|
+
...groups.map((group) =>
|
|
171
|
+
field.boolean(`default.${group.value}`, `Default group: ${group.name}`, { readOnly }),
|
|
172
|
+
),
|
|
173
|
+
]
|
|
174
|
+
const key = { audience: provider.audience, id: provider.id }
|
|
175
|
+
const actions = [
|
|
176
|
+
...(canEdit
|
|
177
|
+
? [button('Save', 'save', { submit: true, look: 'primary' as const, input: key })]
|
|
178
|
+
: []),
|
|
179
|
+
button('Test connection', 'test', { input: key }),
|
|
180
|
+
...(isAdmin && (canEdit ? provider.overridden : provider.ignored).length > 0
|
|
181
|
+
? [
|
|
182
|
+
button(lock ? 'Clear the changes it ignores' : "Use the code's settings", 'reset', {
|
|
183
|
+
input: key,
|
|
184
|
+
look: 'danger' as const,
|
|
185
|
+
confirm: lock
|
|
186
|
+
? `Clear the changes made here before it was locked (${provider.ignored.join(', ')})? It signs in by the code either way.`
|
|
187
|
+
: `Put the ${AUDIENCE_NAMES[provider.audience]} sign-in back to what the code says? Every change made here goes.`,
|
|
188
|
+
}),
|
|
189
|
+
]
|
|
190
|
+
: []),
|
|
191
|
+
...(canEdit && provider.overridden.includes('clientSecret')
|
|
192
|
+
? [button('Remove the secret kept here', 'removeSecret', { input: key })]
|
|
193
|
+
: []),
|
|
194
|
+
]
|
|
195
|
+
return form(
|
|
196
|
+
fields,
|
|
197
|
+
{
|
|
198
|
+
name: provider.name,
|
|
199
|
+
tenantId: provider.tenantId ?? '',
|
|
200
|
+
clientId: provider.clientId,
|
|
201
|
+
autoCreate: provider.autoCreate,
|
|
202
|
+
linkByEmail: provider.linkByEmail,
|
|
203
|
+
emailsVerified: provider.emailsVerified,
|
|
204
|
+
mappings: Object.entries(provider.groupMap).map(([claim, group]) => ({ claim, group })),
|
|
205
|
+
...Object.fromEntries(
|
|
206
|
+
groups.map((group) => [
|
|
207
|
+
`default.${group.value}`,
|
|
208
|
+
provider.defaultGroups.includes(group.value),
|
|
209
|
+
]),
|
|
210
|
+
),
|
|
211
|
+
},
|
|
212
|
+
actions,
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** The whole screen: a tab per Entra sign-in the site declares, or what to do without one. */
|
|
217
|
+
async function signInScreen(
|
|
218
|
+
context: SignInContext,
|
|
219
|
+
said?: { notice?: string; problem?: string },
|
|
220
|
+
): Promise<ScreenResult> {
|
|
221
|
+
const host = context.bundle.identityProviders
|
|
222
|
+
const providers = (await host.list()).filter((p) => p.kind === 'entra')
|
|
223
|
+
const canEdit = context.principal?.isAdmin === true
|
|
224
|
+
const body = []
|
|
225
|
+
if (said?.problem) body.push(problem(said.problem))
|
|
226
|
+
if (!canEdit) body.push(notice(ADMIN_ONLY))
|
|
227
|
+
if (providers.length === 0)
|
|
228
|
+
body.push(
|
|
229
|
+
empty('No Entra sign-in', {
|
|
230
|
+
text: "The site's code declares Entra sign-ins with entra(); this screen changes their settings.",
|
|
231
|
+
}),
|
|
232
|
+
)
|
|
233
|
+
else
|
|
234
|
+
body.push(
|
|
235
|
+
tabs(
|
|
236
|
+
await Promise.all(
|
|
237
|
+
providers.map(async (provider) =>
|
|
238
|
+
tab(
|
|
239
|
+
`${provider.audience}-${provider.id}`,
|
|
240
|
+
`${AUDIENCE_NAMES[provider.audience]} — ${provider.name}`,
|
|
241
|
+
[
|
|
242
|
+
...(provider.missingSecret
|
|
243
|
+
? [
|
|
244
|
+
problem(
|
|
245
|
+
`${provider.name} signs nobody in: it goes somewhere the code did not name, without a secret of its own.`,
|
|
246
|
+
),
|
|
247
|
+
]
|
|
248
|
+
: []),
|
|
249
|
+
table(
|
|
250
|
+
['Redirect URL to register in Entra, after the site’s address'],
|
|
251
|
+
[row('callback', [cell.code(provider.callbackPath)])],
|
|
252
|
+
),
|
|
253
|
+
providerForm(provider, await host.groups(provider.audience), canEdit),
|
|
254
|
+
],
|
|
255
|
+
),
|
|
256
|
+
),
|
|
257
|
+
),
|
|
258
|
+
),
|
|
259
|
+
)
|
|
260
|
+
return {
|
|
261
|
+
screen: screen('Microsoft Entra', body),
|
|
262
|
+
...(said?.notice ? { notice: said.notice } : {}),
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** The provider an action names, when it is an Entra one the site declares. */
|
|
267
|
+
async function namedProvider(context: SignInContext): Promise<Provider | undefined> {
|
|
268
|
+
const { audience, id } = context.input as { audience?: string; id?: string }
|
|
269
|
+
return (await context.bundle.identityProviders.list()).find(
|
|
270
|
+
(p) => p.kind === 'entra' && p.audience === audience && p.id === id,
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** The form's values as the overrides `readOverrides` takes. */
|
|
275
|
+
function overridesFrom(values: Record<string, unknown>): ProviderOverrideInput {
|
|
276
|
+
const mappings = Array.isArray(values.mappings) ? values.mappings : []
|
|
277
|
+
return readOverrides({
|
|
278
|
+
name: values.name,
|
|
279
|
+
tenantId: values.tenantId,
|
|
280
|
+
clientId: values.clientId,
|
|
281
|
+
...('clientSecret' in values ? { clientSecret: values.clientSecret } : {}),
|
|
282
|
+
autoCreate: values.autoCreate,
|
|
283
|
+
linkByEmail: values.linkByEmail,
|
|
284
|
+
emailsVerified: values.emailsVerified,
|
|
285
|
+
groupMap: Object.fromEntries(
|
|
286
|
+
mappings.map((m: { claim?: unknown; group?: unknown }) => [
|
|
287
|
+
String(m.claim ?? ''),
|
|
288
|
+
String(m.group ?? ''),
|
|
289
|
+
]),
|
|
290
|
+
),
|
|
291
|
+
defaultGroups: Object.entries(values)
|
|
292
|
+
.filter(([key, on]) => key.startsWith('default.') && on === true)
|
|
293
|
+
.map(([key]) => key.slice('default.'.length)),
|
|
294
|
+
})
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Runs an administrator's change on the named sign-in, and answers the screen with what happened. */
|
|
298
|
+
const change =
|
|
299
|
+
(run: (context: SignInContext, provider: Provider) => Promise<string | { problem: string }>) =>
|
|
300
|
+
async (context: SignInContext) => {
|
|
301
|
+
if (context.principal?.isAdmin !== true) return signInScreen(context, { problem: ADMIN_ONLY })
|
|
302
|
+
const provider = await namedProvider(context)
|
|
303
|
+
if (!provider) return signInScreen(context, { problem: 'There is no such Entra sign-in.' })
|
|
304
|
+
const said = await run(context, provider)
|
|
305
|
+
return signInScreen(context, typeof said === 'string' ? { notice: said } : said)
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** The Entra screen (story 329), described for the back office to draw. */
|
|
309
|
+
const signInHandlers = {
|
|
310
|
+
view: (context: SignInContext) => signInScreen(context),
|
|
311
|
+
actions: {
|
|
312
|
+
save: change(async (context, provider) => {
|
|
313
|
+
const values = (context.input.values ?? {}) as Record<string, unknown>
|
|
314
|
+
const outcome = await context.bundle.identityProviders.update(
|
|
315
|
+
provider.audience,
|
|
316
|
+
provider.id,
|
|
317
|
+
overridesFrom(values),
|
|
318
|
+
)
|
|
319
|
+
if (!outcome.ok) return { problem: outcome.error }
|
|
320
|
+
context.bundle.log.info('{user} changed the {audience} Entra sign-in {id}', {
|
|
321
|
+
user: context.principal?.email,
|
|
322
|
+
audience: provider.audience,
|
|
323
|
+
id: provider.id,
|
|
324
|
+
})
|
|
325
|
+
return 'Saved. It applies at the next sign-in.'
|
|
326
|
+
}),
|
|
327
|
+
reset: change(async (context, provider) => {
|
|
328
|
+
await context.bundle.identityProviders.reset(provider.audience, provider.id)
|
|
329
|
+
context.bundle.log.info('{user} put the {audience} Entra sign-in {id} back to the code', {
|
|
330
|
+
user: context.principal?.email,
|
|
331
|
+
audience: provider.audience,
|
|
332
|
+
id: provider.id,
|
|
333
|
+
})
|
|
334
|
+
return "Put back to the code's settings."
|
|
335
|
+
}),
|
|
336
|
+
removeSecret: change(async (context, provider) => {
|
|
337
|
+
const outcome = await context.bundle.identityProviders.update(
|
|
338
|
+
provider.audience,
|
|
339
|
+
provider.id,
|
|
340
|
+
{
|
|
341
|
+
clientSecret: null,
|
|
342
|
+
},
|
|
343
|
+
)
|
|
344
|
+
return outcome.ok ? 'Client secret removed.' : { problem: outcome.error }
|
|
345
|
+
}),
|
|
346
|
+
async test(context: SignInContext) {
|
|
347
|
+
const provider = await namedProvider(context)
|
|
348
|
+
if (!provider) return signInScreen(context, { problem: 'There is no such Entra sign-in.' })
|
|
349
|
+
const result = await context.bundle.identityProviders.test(provider.audience, provider.id)
|
|
350
|
+
return signInScreen(
|
|
351
|
+
context,
|
|
352
|
+
result.ok ? { notice: result.message } : { problem: result.message },
|
|
353
|
+
)
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
}
|
|
357
|
+
|
|
89
358
|
/** The Entra settings screen's server half, for `bundles: [entraSettings()]` in `crombolo.config.ts`. */
|
|
90
359
|
export function entraSettings(options: EntraSettingsOptions = {}): ServerBundle<Capability> {
|
|
91
360
|
return {
|
|
92
361
|
id: ENTRA_BUNDLE_ID,
|
|
93
362
|
section: options.section ?? 'settings',
|
|
94
363
|
capabilities: CAPABILITIES,
|
|
364
|
+
screens: { 'sign-in': signInHandlers } as unknown as ServerBundle<Capability>['screens'],
|
|
95
365
|
// Back-office routes (story 211), behind the user and the section.
|
|
96
366
|
routes: [
|
|
97
367
|
route<unknown, unknown, BundleRouteContext<Capability>>(
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reads and drives this bundle's endpoints at
|
|
3
|
-
* `<backoffice>/crombolo/api/bundle/entra/*`. The session cookie carries the
|
|
4
|
-
* auth, as it does for the framework's own plugin endpoints; the base comes from
|
|
5
|
-
* `<base href>`, because the backoffice path is configurable.
|
|
6
|
-
*/
|
|
7
|
-
const base = () => {
|
|
8
|
-
const href = document.querySelector('base')?.getAttribute('href') ?? '/umbraco/'
|
|
9
|
-
return `${href.replace(/\/$/, '')}/crombolo/api/bundle/entra`
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const json = async (path, init) => {
|
|
13
|
-
const response = await fetch(`${base()}${path}`, {
|
|
14
|
-
credentials: 'include',
|
|
15
|
-
headers: {
|
|
16
|
-
accept: 'application/json',
|
|
17
|
-
...(init?.body ? { 'content-type': 'application/json' } : {}),
|
|
18
|
-
},
|
|
19
|
-
...init,
|
|
20
|
-
})
|
|
21
|
-
const body = await response.json().catch(() => ({}))
|
|
22
|
-
// A refusal carries a message the screen shows.
|
|
23
|
-
if (!response.ok && ![400, 403, 404].includes(response.status))
|
|
24
|
-
throw new Error(`The Entra settings endpoint answered ${response.status}`)
|
|
25
|
-
return body
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const at = (provider) =>
|
|
29
|
-
`/providers/${encodeURIComponent(provider.audience)}/${encodeURIComponent(provider.id)}`
|
|
30
|
-
|
|
31
|
-
export const listProviders = () => json('/providers')
|
|
32
|
-
|
|
33
|
-
export const listGroups = (audience) => json(`/groups/${encodeURIComponent(audience)}`)
|
|
34
|
-
|
|
35
|
-
export const saveProvider = (provider, changes) =>
|
|
36
|
-
json(at(provider), { method: 'PUT', body: JSON.stringify(changes) })
|
|
37
|
-
|
|
38
|
-
export const resetProvider = (provider) => json(at(provider), { method: 'DELETE' })
|
|
39
|
-
|
|
40
|
-
export const testProvider = (provider) => json(`${at(provider)}/test`, { method: 'POST' })
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Microsoft Entra screen, in Settings under Advanced (story 033).
|
|
3
|
-
*
|
|
4
|
-
* One card per Entra sign-in the site declares in code: for the backoffice, for
|
|
5
|
-
* members, or both. Each field shows what is in force and says when it was
|
|
6
|
-
* changed here rather than in code; saving changes only what differs, and
|
|
7
|
-
* "Use the code's settings" removes every change. The client secret is never
|
|
8
|
-
* shown: it can be replaced or removed, and the card says whether there is one.
|
|
9
|
-
*/
|
|
10
|
-
import '@umbraco-cms/backoffice/components'
|
|
11
|
-
import { css, html, nothing, repeat } from '@umbraco-cms/backoffice/external/lit'
|
|
12
|
-
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
13
|
-
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification'
|
|
14
|
-
import {
|
|
15
|
-
listGroups,
|
|
16
|
-
listProviders,
|
|
17
|
-
resetProvider,
|
|
18
|
-
saveProvider,
|
|
19
|
-
testProvider,
|
|
20
|
-
} from './entra-client.js'
|
|
21
|
-
|
|
22
|
-
const AUDIENCE = { user: 'Backoffice users', member: 'Members' }
|
|
23
|
-
|
|
24
|
-
/** What a card edits, from a provider as the server describes it. */
|
|
25
|
-
const draftOf = (provider) => ({
|
|
26
|
-
name: provider.name,
|
|
27
|
-
tenantId: provider.tenantId ?? '',
|
|
28
|
-
clientId: provider.clientId,
|
|
29
|
-
clientSecret: '',
|
|
30
|
-
autoCreate: provider.autoCreate,
|
|
31
|
-
linkByEmail: provider.linkByEmail,
|
|
32
|
-
emailsVerified: provider.emailsVerified,
|
|
33
|
-
mappings: Object.entries(provider.groupMap).map(([claim, group]) => ({ claim, group })),
|
|
34
|
-
defaultGroups: [...provider.defaultGroups],
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
export default class CromboloEntraWorkspaceElement extends UmbLitElement {
|
|
38
|
-
static properties = {
|
|
39
|
-
_providers: { state: true },
|
|
40
|
-
_drafts: { state: true },
|
|
41
|
-
_groups: { state: true },
|
|
42
|
-
_canEdit: { state: true },
|
|
43
|
-
_loading: { state: true },
|
|
44
|
-
_problem: { state: true },
|
|
45
|
-
_results: { state: true },
|
|
46
|
-
_busy: { state: true },
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
#notifications
|
|
50
|
-
|
|
51
|
-
constructor() {
|
|
52
|
-
super()
|
|
53
|
-
this._providers = []
|
|
54
|
-
this._drafts = {}
|
|
55
|
-
this._groups = { user: [], member: [] }
|
|
56
|
-
this._canEdit = false
|
|
57
|
-
this._loading = true
|
|
58
|
-
this._problem = ''
|
|
59
|
-
this._results = {}
|
|
60
|
-
this._busy = ''
|
|
61
|
-
this.consumeContext(UMB_NOTIFICATION_CONTEXT, (context) => {
|
|
62
|
-
this.#notifications = context
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
connectedCallback() {
|
|
67
|
-
super.connectedCallback()
|
|
68
|
-
this.#load()
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async #load() {
|
|
72
|
-
this._loading = true
|
|
73
|
-
try {
|
|
74
|
-
const result = await listProviders()
|
|
75
|
-
this._providers = result.providers ?? []
|
|
76
|
-
this._canEdit = Boolean(result.canEdit)
|
|
77
|
-
this._drafts = Object.fromEntries(this._providers.map((p) => [this.#key(p), draftOf(p)]))
|
|
78
|
-
const audiences = [...new Set(this._providers.map((p) => p.audience))]
|
|
79
|
-
const groups = { user: [], member: [] }
|
|
80
|
-
for (const audience of audiences) groups[audience] = (await listGroups(audience)).groups ?? []
|
|
81
|
-
this._groups = groups
|
|
82
|
-
this._problem = ''
|
|
83
|
-
} catch (error) {
|
|
84
|
-
this._problem = error instanceof Error ? error.message : String(error)
|
|
85
|
-
} finally {
|
|
86
|
-
this._loading = false
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
#key(provider) {
|
|
91
|
-
return `${provider.audience}:${provider.id}`
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
#change(provider, field, value) {
|
|
95
|
-
const key = this.#key(provider)
|
|
96
|
-
this._drafts = { ...this._drafts, [key]: { ...this._drafts[key], [field]: value } }
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
#setMapping(provider, index, field, value) {
|
|
100
|
-
const draft = this._drafts[this.#key(provider)]
|
|
101
|
-
const mappings = draft.mappings.map((m, i) => (i === index ? { ...m, [field]: value } : m))
|
|
102
|
-
this.#change(provider, 'mappings', mappings)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** Only what differs from what is in force goes to the server. */
|
|
106
|
-
#changes(provider) {
|
|
107
|
-
const draft = this._drafts[this.#key(provider)]
|
|
108
|
-
const changes = {}
|
|
109
|
-
for (const field of [
|
|
110
|
-
'name',
|
|
111
|
-
'tenantId',
|
|
112
|
-
'clientId',
|
|
113
|
-
'autoCreate',
|
|
114
|
-
'linkByEmail',
|
|
115
|
-
'emailsVerified',
|
|
116
|
-
])
|
|
117
|
-
if (draft[field] !== (provider[field] ?? '')) changes[field] = draft[field]
|
|
118
|
-
if (draft.clientSecret) changes.clientSecret = draft.clientSecret
|
|
119
|
-
const map = Object.fromEntries(
|
|
120
|
-
draft.mappings.filter((m) => m.claim.trim() && m.group).map((m) => [m.claim.trim(), m.group]),
|
|
121
|
-
)
|
|
122
|
-
if (JSON.stringify(map) !== JSON.stringify(provider.groupMap)) changes.groupMap = map
|
|
123
|
-
if (JSON.stringify(draft.defaultGroups) !== JSON.stringify(provider.defaultGroups))
|
|
124
|
-
changes.defaultGroups = draft.defaultGroups
|
|
125
|
-
return changes
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
async #run(provider, label, action) {
|
|
129
|
-
this._busy = this.#key(provider)
|
|
130
|
-
try {
|
|
131
|
-
const result = await action()
|
|
132
|
-
if (result.ok === false) {
|
|
133
|
-
this.#notifications?.peek('danger', { data: { message: result.message } })
|
|
134
|
-
return
|
|
135
|
-
}
|
|
136
|
-
this.#notifications?.peek('positive', { data: { message: label } })
|
|
137
|
-
await this.#load()
|
|
138
|
-
} catch (error) {
|
|
139
|
-
this.#notifications?.peek('danger', {
|
|
140
|
-
data: { message: error instanceof Error ? error.message : String(error) },
|
|
141
|
-
})
|
|
142
|
-
} finally {
|
|
143
|
-
this._busy = ''
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
#save(provider) {
|
|
148
|
-
const changes = this.#changes(provider)
|
|
149
|
-
if (Object.keys(changes).length === 0) return
|
|
150
|
-
return this.#run(provider, 'Entra settings saved', () => saveProvider(provider, changes))
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
#removeSecret(provider) {
|
|
154
|
-
return this.#run(provider, 'Client secret removed', () =>
|
|
155
|
-
saveProvider(provider, { clientSecret: null }),
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
#reset(provider) {
|
|
160
|
-
return this.#run(provider, "Using the code's settings again", () => resetProvider(provider))
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async #test(provider) {
|
|
164
|
-
this._busy = this.#key(provider)
|
|
165
|
-
try {
|
|
166
|
-
const result = await testProvider(provider)
|
|
167
|
-
this._results = { ...this._results, [this.#key(provider)]: result }
|
|
168
|
-
} finally {
|
|
169
|
-
this._busy = ''
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
render() {
|
|
174
|
-
return html`<umb-body-layout headline="Microsoft Entra">
|
|
175
|
-
${this._problem ? html`<uui-box><p class="problem">${this._problem}</p></uui-box>` : nothing}
|
|
176
|
-
${this._loading ? html`<uui-loader></uui-loader>` : this.#body()}
|
|
177
|
-
</umb-body-layout>`
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
#body() {
|
|
181
|
-
if (this._providers.length === 0)
|
|
182
|
-
return html`<uui-box headline="No Entra sign-in">
|
|
183
|
-
<p>
|
|
184
|
-
This site declares no Microsoft Entra sign-in. Add one with <code>entra()</code> in
|
|
185
|
-
<code>crombolo.config.ts</code>, under <code>backofficeIdentityProviders</code> or
|
|
186
|
-
<code>memberIdentityProviders</code>; its settings can then be changed here.
|
|
187
|
-
</p>
|
|
188
|
-
</uui-box>`
|
|
189
|
-
return html`
|
|
190
|
-
${
|
|
191
|
-
this._canEdit
|
|
192
|
-
? nothing
|
|
193
|
-
: html`<uui-box><p>Only an administrator can change how people sign in.</p></uui-box>`
|
|
194
|
-
}
|
|
195
|
-
${repeat(
|
|
196
|
-
this._providers,
|
|
197
|
-
(p) => this.#key(p),
|
|
198
|
-
(p) => this.#card(p),
|
|
199
|
-
)}
|
|
200
|
-
`
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
#label(provider, field, text) {
|
|
204
|
-
return html`${text}${
|
|
205
|
-
provider.overridden.includes(field)
|
|
206
|
-
? html` <uui-tag look="secondary" color="warning">Changed here</uui-tag>`
|
|
207
|
-
: nothing
|
|
208
|
-
}`
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
#card(provider) {
|
|
212
|
-
const draft = this._drafts[this.#key(provider)]
|
|
213
|
-
const groups = this._groups[provider.audience] ?? []
|
|
214
|
-
const disabled = !this._canEdit
|
|
215
|
-
const result = this._results[this.#key(provider)]
|
|
216
|
-
const busy = this._busy === this.#key(provider)
|
|
217
|
-
return html`<uui-box headline=${`${AUDIENCE[provider.audience]} — ${provider.name}`}>
|
|
218
|
-
<div slot="header-actions" class="actions">
|
|
219
|
-
<uui-button look="secondary" label="Test connection" ?disabled=${busy}
|
|
220
|
-
@click=${() => this.#test(provider)}>Test connection</uui-button>
|
|
221
|
-
${
|
|
222
|
-
this._canEdit && provider.overridden.length > 0
|
|
223
|
-
? html`<uui-button look="secondary" color="danger" label="Use the code's settings"
|
|
224
|
-
?disabled=${busy} @click=${() => this.#reset(provider)}>Use the code's settings</uui-button>`
|
|
225
|
-
: nothing
|
|
226
|
-
}
|
|
227
|
-
</div>
|
|
228
|
-
${result ? html`<p class=${result.ok ? 'ok' : 'problem'}>${result.message}</p>` : nothing}
|
|
229
|
-
<umb-property-layout label="Redirect URL" description="Register this with the app in Entra">
|
|
230
|
-
<code slot="editor">${window.location.origin}${provider.callbackPath}</code>
|
|
231
|
-
</umb-property-layout>
|
|
232
|
-
<umb-property-layout .label=${this.#label(provider, 'name', 'Button text')}>
|
|
233
|
-
<uui-input slot="editor" label="Button text" ?readonly=${disabled} .value=${draft.name}
|
|
234
|
-
@change=${(e) => this.#change(provider, 'name', e.target.value)}></uui-input>
|
|
235
|
-
</umb-property-layout>
|
|
236
|
-
<umb-property-layout .label=${this.#label(provider, 'tenantId', 'Tenant ID')}>
|
|
237
|
-
<uui-input slot="editor" label="Tenant ID" ?readonly=${disabled} .value=${draft.tenantId}
|
|
238
|
-
@change=${(e) => this.#change(provider, 'tenantId', e.target.value)}></uui-input>
|
|
239
|
-
</umb-property-layout>
|
|
240
|
-
<umb-property-layout .label=${this.#label(provider, 'clientId', 'Application (client) ID')}>
|
|
241
|
-
<uui-input slot="editor" label="Client ID" ?readonly=${disabled} .value=${draft.clientId}
|
|
242
|
-
@change=${(e) => this.#change(provider, 'clientId', e.target.value)}></uui-input>
|
|
243
|
-
</umb-property-layout>
|
|
244
|
-
<umb-property-layout .label=${this.#label(provider, 'clientSecret', 'Client secret')}
|
|
245
|
-
description=${provider.hasClientSecret ? 'A secret is set. Enter a new one to replace it.' : 'No secret is set.'}>
|
|
246
|
-
<div slot="editor" class="row">
|
|
247
|
-
<uui-input type="password" label="Client secret" autocomplete="off" ?readonly=${disabled}
|
|
248
|
-
.value=${draft.clientSecret} placeholder=${provider.hasClientSecret ? '••••••••' : ''}
|
|
249
|
-
@change=${(e) => this.#change(provider, 'clientSecret', e.target.value)}></uui-input>
|
|
250
|
-
${
|
|
251
|
-
this._canEdit && provider.overridden.includes('clientSecret')
|
|
252
|
-
? html`<uui-button look="secondary" label="Remove the secret kept here"
|
|
253
|
-
@click=${() => this.#removeSecret(provider)}>Remove</uui-button>`
|
|
254
|
-
: nothing
|
|
255
|
-
}
|
|
256
|
-
</div>
|
|
257
|
-
</umb-property-layout>
|
|
258
|
-
<umb-property-layout .label=${this.#label(provider, 'autoCreate', 'Create accounts')}
|
|
259
|
-
description="Create an account for someone signing in for the first time">
|
|
260
|
-
<uui-toggle slot="editor" label="Create accounts" ?disabled=${disabled} ?checked=${draft.autoCreate}
|
|
261
|
-
@change=${(e) => this.#change(provider, 'autoCreate', e.target.checked)}></uui-toggle>
|
|
262
|
-
</umb-property-layout>
|
|
263
|
-
<umb-property-layout .label=${this.#label(provider, 'linkByEmail', 'Link by email')}
|
|
264
|
-
description="Link a first sign-in to an existing account with the same, verified, email">
|
|
265
|
-
<uui-toggle slot="editor" label="Link by email" ?disabled=${disabled} ?checked=${draft.linkByEmail}
|
|
266
|
-
@change=${(e) => this.#change(provider, 'linkByEmail', e.target.checked)}></uui-toggle>
|
|
267
|
-
</umb-property-layout>
|
|
268
|
-
<umb-property-layout .label=${this.#label(provider, 'emailsVerified', 'Trust emails')}
|
|
269
|
-
description="Treat every email from this tenant as verified. Entra sends no verification claim.">
|
|
270
|
-
<uui-toggle slot="editor" label="Trust emails" ?disabled=${disabled} ?checked=${draft.emailsVerified}
|
|
271
|
-
@change=${(e) => this.#change(provider, 'emailsVerified', e.target.checked)}></uui-toggle>
|
|
272
|
-
</umb-property-layout>
|
|
273
|
-
<umb-property-layout .label=${this.#label(provider, 'groupMap', 'Group mappings')}
|
|
274
|
-
description="An Entra group's object ID, and the group here its members join. Made to match on every sign-in.">
|
|
275
|
-
<div slot="editor" class="mappings">
|
|
276
|
-
${draft.mappings.map(
|
|
277
|
-
(m, i) => html`<div class="row">
|
|
278
|
-
<uui-input label="Entra group object ID" placeholder="Entra group object ID" ?readonly=${disabled}
|
|
279
|
-
.value=${m.claim} @change=${(e) => this.#setMapping(provider, i, 'claim', e.target.value)}></uui-input>
|
|
280
|
-
<uui-select label="Group here" ?disabled=${disabled}
|
|
281
|
-
.options=${[{ name: 'Choose a group', value: '', selected: !m.group }, ...groups.map((g) => ({ name: g.name, value: g.value, selected: g.value === m.group }))]}
|
|
282
|
-
@change=${(e) => this.#setMapping(provider, i, 'group', e.target.value)}></uui-select>
|
|
283
|
-
${
|
|
284
|
-
disabled
|
|
285
|
-
? nothing
|
|
286
|
-
: html`<uui-button look="secondary" label="Remove mapping" compact
|
|
287
|
-
@click=${() =>
|
|
288
|
-
this.#change(
|
|
289
|
-
provider,
|
|
290
|
-
'mappings',
|
|
291
|
-
draft.mappings.filter((_, j) => j !== i),
|
|
292
|
-
)}>Remove</uui-button>`
|
|
293
|
-
}
|
|
294
|
-
</div>`,
|
|
295
|
-
)}
|
|
296
|
-
${
|
|
297
|
-
disabled
|
|
298
|
-
? nothing
|
|
299
|
-
: html`<uui-button look="secondary" label="Add a mapping" compact
|
|
300
|
-
@click=${() => this.#change(provider, 'mappings', [...draft.mappings, { claim: '', group: '' }])}>Add a mapping</uui-button>`
|
|
301
|
-
}
|
|
302
|
-
</div>
|
|
303
|
-
</umb-property-layout>
|
|
304
|
-
<umb-property-layout .label=${this.#label(provider, 'defaultGroups', 'Default groups')}
|
|
305
|
-
description="Groups a new account joins">
|
|
306
|
-
<div slot="editor" class="checks">
|
|
307
|
-
${groups.map(
|
|
308
|
-
(g) => html`<uui-checkbox label=${g.name} ?disabled=${disabled}
|
|
309
|
-
?checked=${draft.defaultGroups.includes(g.value)}
|
|
310
|
-
@change=${(e) =>
|
|
311
|
-
this.#change(
|
|
312
|
-
provider,
|
|
313
|
-
'defaultGroups',
|
|
314
|
-
e.target.checked
|
|
315
|
-
? [...draft.defaultGroups, g.value]
|
|
316
|
-
: draft.defaultGroups.filter((v) => v !== g.value),
|
|
317
|
-
)}>${g.name}</uui-checkbox>`,
|
|
318
|
-
)}
|
|
319
|
-
</div>
|
|
320
|
-
</umb-property-layout>
|
|
321
|
-
${
|
|
322
|
-
this._canEdit
|
|
323
|
-
? html`<div class="save">
|
|
324
|
-
<uui-button look="primary" color="positive" label="Save" ?disabled=${busy || Object.keys(this.#changes(provider)).length === 0}
|
|
325
|
-
@click=${() => this.#save(provider)}>Save</uui-button>
|
|
326
|
-
</div>`
|
|
327
|
-
: nothing
|
|
328
|
-
}
|
|
329
|
-
</uui-box>`
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
static styles = css`
|
|
333
|
-
:host { display: block; height: 100%; }
|
|
334
|
-
uui-box { margin-bottom: var(--uui-size-layout-1); }
|
|
335
|
-
.actions { display: flex; gap: var(--uui-size-space-3); }
|
|
336
|
-
.row { display: flex; gap: var(--uui-size-space-3); align-items: center; }
|
|
337
|
-
.row uui-input { flex: 1; }
|
|
338
|
-
.mappings, .checks { display: flex; flex-direction: column; gap: var(--uui-size-space-3); }
|
|
339
|
-
uui-input, uui-select { width: 100%; }
|
|
340
|
-
.save { display: flex; justify-content: flex-end; margin-top: var(--uui-size-space-5); }
|
|
341
|
-
.ok { color: var(--uui-color-positive); }
|
|
342
|
-
.problem { color: var(--uui-color-danger); }
|
|
343
|
-
code { word-break: break-all; }
|
|
344
|
-
`
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
customElements.define('crombolo-entra-workspace', CromboloEntraWorkspaceElement)
|