@sneat/auth-ui 0.27.19 → 0.27.21
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/esm2022/index.js +1 -0
- package/esm2022/index.js.map +1 -1
- package/esm2022/lib/pages/login-page/login-page.component.js +4 -3
- package/esm2022/lib/pages/login-page/login-page.component.js.map +1 -1
- package/esm2022/lib/pages/login-page/login-with-telegram.component.js +98 -50
- package/esm2022/lib/pages/login-page/login-with-telegram.component.js.map +1 -1
- package/esm2022/lib/pages/login-page/sneat-auth-with-telegram.service.js +19 -4
- package/esm2022/lib/pages/login-page/sneat-auth-with-telegram.service.js.map +1 -1
- package/esm2022/lib/pages/login-page/telegram-login-js.js +30 -0
- package/esm2022/lib/pages/login-page/telegram-login-js.js.map +1 -0
- package/esm2022/lib/pages/sneat-auth-routing.module.js +27 -0
- package/esm2022/lib/pages/sneat-auth-routing.module.js.map +1 -1
- package/esm2022/lib/sso/index.js +3 -0
- package/esm2022/lib/sso/index.js.map +1 -0
- package/esm2022/lib/sso/sso-api.service.js +64 -0
- package/esm2022/lib/sso/sso-api.service.js.map +1 -0
- package/esm2022/lib/sso/sso-callback-page.component.js +65 -0
- package/esm2022/lib/sso/sso-callback-page.component.js.map +1 -0
- package/esm2022/lib/sso/sso-errors.js +13 -0
- package/esm2022/lib/sso/sso-errors.js.map +1 -0
- package/esm2022/lib/sso/sso-login-page.component.js +102 -0
- package/esm2022/lib/sso/sso-login-page.component.js.map +1 -0
- package/esm2022/lib/sso/sso-onboarding-page.component.js +87 -0
- package/esm2022/lib/sso/sso-onboarding-page.component.js.map +1 -0
- package/esm2022/lib/sso/sso-settings-page.component.js +290 -0
- package/esm2022/lib/sso/sso-settings-page.component.js.map +1 -0
- package/esm2022/lib/sso/sso.models.js +17 -0
- package/esm2022/lib/sso/sso.models.js.map +1 -0
- package/index.d.ts +1 -0
- package/lib/pages/login-page/login-with-telegram.component.d.ts +14 -1
- package/lib/pages/login-page/sneat-auth-with-telegram.service.d.ts +15 -0
- package/lib/pages/login-page/telegram-login-js.d.ts +30 -0
- package/lib/pages/sneat-auth-routing.module.d.ts +1 -0
- package/lib/sso/index.d.ts +2 -0
- package/lib/sso/sso-api.service.d.ts +22 -0
- package/lib/sso/sso-callback-page.component.d.ts +13 -0
- package/lib/sso/sso-errors.d.ts +1 -0
- package/lib/sso/sso-login-page.component.d.ts +17 -0
- package/lib/sso/sso-onboarding-page.component.d.ts +19 -0
- package/lib/sso/sso-settings-page.component.d.ts +47 -0
- package/lib/sso/sso.models.d.ts +58 -0
- package/package.json +8 -2
- package/tsconfig.lib.prod.tsbuildinfo +1 -1
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { HttpErrorResponse } from '@angular/common/http';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, signal, } from '@angular/core';
|
|
3
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { ActivatedRoute } from '@angular/router';
|
|
6
|
+
import { IonBackButton, IonBadge, IonButton, IonButtons, IonCard, IonCardContent, IonContent, IonHeader, IonInput, IonItem, IonLabel, IonSpinner, IonText, IonTextarea, IonTitle, IonToolbar, } from '@ionic/angular';
|
|
7
|
+
import { SneatUserService } from '@sneat/auth-core';
|
|
8
|
+
import { firstValueFrom } from 'rxjs';
|
|
9
|
+
import { SsoApiService } from './sso-api.service';
|
|
10
|
+
import { ssoErrorMessage } from './sso-errors';
|
|
11
|
+
import { applicationBaseURL, emailDomain, } from './sso.models';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "@angular/forms";
|
|
14
|
+
export class SsoSettingsPageComponent {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.route = inject(ActivatedRoute);
|
|
17
|
+
this.sso = inject(SsoApiService);
|
|
18
|
+
this.userState = toSignal(inject(SneatUserService).userState);
|
|
19
|
+
this.spaceID = this.route.snapshot.paramMap.get('spaceID') ?? '';
|
|
20
|
+
this.spaceHomeURL = `/space/${this.route.snapshot.paramMap.get('spaceType') ?? 'company'}/${this.spaceID}`;
|
|
21
|
+
this.step = signal(1, /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
23
|
+
this.protocol = signal('oidc', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "protocol" }] : /* istanbul ignore next */ []));
|
|
25
|
+
this.providerPreset = signal('entra', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "providerPreset" }] : /* istanbul ignore next */ []));
|
|
27
|
+
this.domain = signal(this.route.snapshot.queryParamMap.get('domain') ?? '', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "domain" }] : /* istanbul ignore next */ []));
|
|
29
|
+
this.issuer = signal('', /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "issuer" }] : /* istanbul ignore next */ []));
|
|
31
|
+
this.clientID = signal('', /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "clientID" }] : /* istanbul ignore next */ []));
|
|
33
|
+
this.clientSecret = signal('', /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "clientSecret" }] : /* istanbul ignore next */ []));
|
|
35
|
+
this.loginHost = signal('', /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "loginHost" }] : /* istanbul ignore next */ []));
|
|
37
|
+
this.samlMetadata = signal('', /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "samlMetadata" }] : /* istanbul ignore next */ []));
|
|
39
|
+
this.config = signal(undefined, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
41
|
+
this.loading = signal(true, /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
43
|
+
this.busy = signal(false, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
45
|
+
this.error = signal(undefined, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
|
|
47
|
+
this.success = signal(this.route.snapshot.queryParamMap.has('activated')
|
|
48
|
+
? 'SSO was tested successfully and is now active.'
|
|
49
|
+
: undefined, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "success" }] : /* istanbul ignore next */ []));
|
|
51
|
+
this.isAdmin = computed(() => {
|
|
52
|
+
const roles = this.userState()?.record?.spaces?.[this.spaceID]?.roles ?? [];
|
|
53
|
+
return roles.some((role) => role === 'owner' || role === 'admin');
|
|
54
|
+
}, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "isAdmin" }] : /* istanbul ignore next */ []));
|
|
56
|
+
this.userRecordLoaded = computed(() => this.userState()?.record !== undefined, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "userRecordLoaded" }] : /* istanbul ignore next */ []));
|
|
58
|
+
this.isOIDC = computed(() => this.protocol() === 'oidc', /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "isOIDC" }] : /* istanbul ignore next */ []));
|
|
60
|
+
this.domainValid = computed(() => emailDomain(`admin@${this.domain()}`) ===
|
|
61
|
+
this.domain().trim().toLowerCase(), /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "domainValid" }] : /* istanbul ignore next */ []));
|
|
63
|
+
this.domainVerified = computed(() => !!this.config()?.domainVerification?.verifiedAt, /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "domainVerified" }] : /* istanbul ignore next */ []));
|
|
65
|
+
this.connectionValid = computed(() => {
|
|
66
|
+
if (this.isOIDC()) {
|
|
67
|
+
return (!!this.issuer().trim() &&
|
|
68
|
+
!!this.clientID().trim() &&
|
|
69
|
+
(!!this.clientSecret() || !!this.config()?.hasClientSecret));
|
|
70
|
+
}
|
|
71
|
+
return !!this.samlMetadata().trim() || !!this.config()?.hasSamlMetadata;
|
|
72
|
+
}, /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "connectionValid" }] : /* istanbul ignore next */ []));
|
|
74
|
+
this.samlMetadataURL = this.sso.samlMetadataURL();
|
|
75
|
+
this.oidcRedirectURL = `${applicationBaseURL()}/sso/callback`;
|
|
76
|
+
}
|
|
77
|
+
ngOnInit() {
|
|
78
|
+
void this.load();
|
|
79
|
+
}
|
|
80
|
+
chooseProvider(preset) {
|
|
81
|
+
if (this.busy()) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this.providerPreset.set(preset);
|
|
85
|
+
this.protocol.set(preset === 'generic_saml' ? 'saml' : 'oidc');
|
|
86
|
+
}
|
|
87
|
+
async prepareDomain() {
|
|
88
|
+
if (!this.isAdmin() || !this.domainValid() || this.busy()) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.beginOperation();
|
|
92
|
+
try {
|
|
93
|
+
const config = await firstValueFrom(this.sso.prepareDomain({
|
|
94
|
+
spaceID: this.spaceID,
|
|
95
|
+
emailDomain: this.domain().trim().toLowerCase(),
|
|
96
|
+
protocol: this.protocol(),
|
|
97
|
+
providerPreset: this.providerPreset(),
|
|
98
|
+
}));
|
|
99
|
+
this.config.set(config);
|
|
100
|
+
this.step.set(config.domainVerification?.verifiedAt ? 3 : 2);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
this.error.set(ssoErrorMessage(error));
|
|
104
|
+
}
|
|
105
|
+
finally {
|
|
106
|
+
this.busy.set(false);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async verifyDomain() {
|
|
110
|
+
if (this.busy()) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.beginOperation();
|
|
114
|
+
try {
|
|
115
|
+
const config = await firstValueFrom(this.sso.verifyDomain(this.spaceID));
|
|
116
|
+
this.config.set(config);
|
|
117
|
+
this.success.set('Domain ownership verified. Add the provider details.');
|
|
118
|
+
this.step.set(3);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
this.error.set(ssoErrorMessage(error));
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
124
|
+
this.busy.set(false);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async save() {
|
|
128
|
+
if (!this.isAdmin() ||
|
|
129
|
+
!this.domainVerified() ||
|
|
130
|
+
!this.connectionValid() ||
|
|
131
|
+
this.busy()) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
this.beginOperation();
|
|
135
|
+
try {
|
|
136
|
+
const config = await firstValueFrom(this.sso.saveConfig({
|
|
137
|
+
spaceID: this.spaceID,
|
|
138
|
+
protocol: this.protocol(),
|
|
139
|
+
providerPreset: this.providerPreset(),
|
|
140
|
+
emailDomain: this.domain().trim().toLowerCase(),
|
|
141
|
+
issuer: this.isOIDC() ? this.issuer().trim() : undefined,
|
|
142
|
+
clientID: this.isOIDC() ? this.clientID().trim() : undefined,
|
|
143
|
+
clientSecret: this.isOIDC() ? this.clientSecret() : undefined,
|
|
144
|
+
loginHost: this.loginHost().trim() || undefined,
|
|
145
|
+
samlIdpMetadataXML: this.isOIDC()
|
|
146
|
+
? undefined
|
|
147
|
+
: this.samlMetadata().trim(),
|
|
148
|
+
}));
|
|
149
|
+
this.config.set(config);
|
|
150
|
+
this.clientSecret.set('');
|
|
151
|
+
this.success.set('Configuration saved securely. Complete a real provider sign-in to activate it.');
|
|
152
|
+
this.step.set(4);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
this.error.set(ssoErrorMessage(error));
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
this.busy.set(false);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async testAndActivate() {
|
|
162
|
+
if (this.busy() || !this.domainVerified()) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
this.beginOperation();
|
|
166
|
+
try {
|
|
167
|
+
const result = await firstValueFrom(this.sso.startActivation(this.spaceID, applicationBaseURL()));
|
|
168
|
+
location.assign(result.authorizationURL);
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
this.error.set(ssoErrorMessage(error));
|
|
172
|
+
this.busy.set(false);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
editConnection() {
|
|
176
|
+
this.clearMessages();
|
|
177
|
+
this.step.set(3);
|
|
178
|
+
}
|
|
179
|
+
changeDomainOrProvider() {
|
|
180
|
+
this.clearMessages();
|
|
181
|
+
this.step.set(1);
|
|
182
|
+
}
|
|
183
|
+
async disable() {
|
|
184
|
+
if (this.busy() || this.config()?.status !== 'active') {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.beginOperation();
|
|
188
|
+
try {
|
|
189
|
+
const config = await firstValueFrom(this.sso.disable(this.spaceID));
|
|
190
|
+
this.config.set(config);
|
|
191
|
+
this.success.set('SSO is disabled. Regular sign-in remains available.');
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
this.error.set(ssoErrorMessage(error));
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
this.busy.set(false);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async deleteConfiguration() {
|
|
201
|
+
if (this.busy() ||
|
|
202
|
+
!confirm('Delete this SSO configuration and release its domain and login host?')) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
this.beginOperation();
|
|
206
|
+
try {
|
|
207
|
+
await firstValueFrom(this.sso.delete(this.spaceID));
|
|
208
|
+
this.config.set(undefined);
|
|
209
|
+
this.issuer.set('');
|
|
210
|
+
this.clientID.set('');
|
|
211
|
+
this.clientSecret.set('');
|
|
212
|
+
this.samlMetadata.set('');
|
|
213
|
+
this.loginHost.set('');
|
|
214
|
+
this.step.set(1);
|
|
215
|
+
this.success.set('SSO configuration deleted. The domain is available.');
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
this.error.set(ssoErrorMessage(error));
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
this.busy.set(false);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
beginOperation() {
|
|
225
|
+
this.busy.set(true);
|
|
226
|
+
this.clearMessages();
|
|
227
|
+
}
|
|
228
|
+
clearMessages() {
|
|
229
|
+
this.error.set(undefined);
|
|
230
|
+
this.success.set(undefined);
|
|
231
|
+
}
|
|
232
|
+
async load() {
|
|
233
|
+
try {
|
|
234
|
+
const config = await firstValueFrom(this.sso.getConfig(this.spaceID));
|
|
235
|
+
this.config.set(config);
|
|
236
|
+
this.domain.set(config.emailDomains[0] ?? this.domain());
|
|
237
|
+
this.protocol.set(config.protocol);
|
|
238
|
+
this.providerPreset.set(config.providerPreset ??
|
|
239
|
+
(config.protocol === 'saml' ? 'generic_saml' : 'generic_oidc'));
|
|
240
|
+
this.issuer.set(config.issuer);
|
|
241
|
+
this.clientID.set(config.clientID);
|
|
242
|
+
this.loginHost.set(config.loginHosts?.[0] ?? '');
|
|
243
|
+
if (config.status === 'active' ||
|
|
244
|
+
config.status === 'disabled' ||
|
|
245
|
+
config.hasClientSecret ||
|
|
246
|
+
config.hasSamlMetadata) {
|
|
247
|
+
this.step.set(4);
|
|
248
|
+
}
|
|
249
|
+
else if (config.domainVerification?.verifiedAt) {
|
|
250
|
+
this.step.set(3);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
this.step.set(2);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
if (!(error instanceof HttpErrorResponse) || error.status !== 404) {
|
|
258
|
+
this.error.set(ssoErrorMessage(error));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
this.loading.set(false);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SsoSettingsPageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
266
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: SsoSettingsPageComponent, isStandalone: true, selector: "sneat-sso-settings-page", ngImport: i0, template: "<ion-header>\n <ion-toolbar color=\"light\">\n <ion-buttons slot=\"start\">\n <ion-back-button [defaultHref]=\"spaceHomeURL\" />\n </ion-buttons>\n <ion-title>Enterprise SSO</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n @if (loading() || !userRecordLoaded()) {\n <div class=\"ion-text-center ion-padding\">\n <ion-spinner />\n <p>Loading SSO settings\u2026</p>\n </div>\n } @else if (!isAdmin()) {\n <ion-card color=\"danger\">\n <ion-card-content>\n <h1>Owner or admin access required</h1>\n <p>You do not have permission to configure SSO for this space.</p>\n </ion-card-content>\n </ion-card>\n } @else {\n <ion-card>\n <ion-card-content>\n <h1>Company sign-in</h1>\n <p>Set up OIDC or SAML without changing Sneat users or memberships.</p>\n <p aria-label=\"Setup progress\">\n Step {{ step() }} of 4\n @if (config(); as current) {\n \u00B7 Status:\n <ion-badge\n [color]=\"current.status === 'active' ? 'success' : 'medium'\"\n >{{ current.status }}</ion-badge\n >\n }\n </p>\n </ion-card-content>\n </ion-card>\n\n @if (step() === 1) {\n <ion-card>\n <ion-card-content>\n <h2>1. Choose your identity provider</h2>\n <p>Pick a guided preset or use a standards-based connection.</p>\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'entra' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('entra')\"\n >Microsoft Entra ID</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'okta' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('okta')\"\n >Okta</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'keycloak' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('keycloak')\"\n >Keycloak</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'generic_oidc' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('generic_oidc')\"\n >Generic OIDC</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'generic_saml' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('generic_saml')\"\n >SAML 2.0</ion-button\n >\n\n <ion-item class=\"ion-margin-top\">\n <ion-label position=\"stacked\">Primary email domain</ion-label>\n <ion-input\n name=\"email-domain\"\n placeholder=\"acme.com\"\n [ngModel]=\"domain()\"\n (ngModelChange)=\"domain.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-button\n expand=\"block\"\n class=\"ion-margin-top\"\n [disabled]=\"!domainValid() || busy()\"\n (click)=\"prepareDomain()\"\n >\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Continue to domain verification\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else if (step() === 2) {\n <ion-card>\n <ion-card-content>\n <h2>2. Prove control of {{ domain() }}</h2>\n <p>\n Add this TXT record in your DNS provider. This prevents an arbitrary\n identity provider from claiming somebody else\u2019s email domain.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">DNS record name</ion-label>\n <ion-input\n name=\"dns-record-name\"\n readonly\n [value]=\"config()?.domainVerification?.recordName\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">TXT value</ion-label>\n <ion-input\n name=\"dns-record-value\"\n readonly\n [value]=\"config()?.domainVerification?.recordValue\"\n />\n </ion-item>\n <p>\n <ion-text color=\"medium\"\n >DNS changes may need a few minutes to propagate.</ion-text\n >\n </p>\n <ion-button fill=\"clear\" (click)=\"changeDomainOrProvider()\"\n >Back</ion-button\n >\n <ion-button [disabled]=\"busy()\" (click)=\"verifyDomain()\">\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Check DNS record\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else if (step() === 3) {\n <ion-card>\n <ion-card-content>\n <h2>3. Connect {{ protocol().toUpperCase() }}</h2>\n @if (isOIDC()) {\n <p>\n Register <strong>{{ oidcRedirectURL }}</strong>\n as the provider redirect URI.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">OIDC issuer</ion-label>\n <ion-input\n name=\"issuer\"\n type=\"url\"\n placeholder=\"https://login.microsoftonline.com/tenant-id/v2.0\"\n [ngModel]=\"issuer()\"\n (ngModelChange)=\"issuer.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">Client ID</ion-label>\n <ion-input\n name=\"client-id\"\n autocomplete=\"off\"\n [ngModel]=\"clientID()\"\n (ngModelChange)=\"clientID.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">Client secret</ion-label>\n <ion-input\n name=\"client-secret\"\n type=\"password\"\n autocomplete=\"new-password\"\n [placeholder]=\"\n config()?.hasClientSecret\n ? 'Leave blank to keep it, or enter a replacement'\n : 'Required'\n \"\n [ngModel]=\"clientSecret()\"\n (ngModelChange)=\"clientSecret.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n } @else {\n <p>\n Give your IdP the DataTug service-provider metadata URL, then\n paste the IdP metadata XML below.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">SP metadata URL</ion-label>\n <ion-input\n name=\"saml-sp-metadata-url\"\n readonly\n [value]=\"samlMetadataURL\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">IdP metadata XML</ion-label>\n <ion-textarea\n name=\"saml-idp-metadata\"\n autoGrow=\"true\"\n rows=\"8\"\n [placeholder]=\"\n config()?.hasSamlMetadata\n ? 'Paste replacement metadata, or leave blank to keep it'\n : '<EntityDescriptor \u2026>'\n \"\n [ngModel]=\"samlMetadata()\"\n (ngModelChange)=\"samlMetadata.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n }\n\n <ion-item>\n <ion-label position=\"stacked\"\n >Company login host (optional)</ion-label\n >\n <ion-input\n name=\"login-host\"\n placeholder=\"acme.datatug.app\"\n [ngModel]=\"loginHost()\"\n (ngModelChange)=\"loginHost.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <p>\n <ion-text color=\"medium\"\n >A company host fixes the login page to this email domain. Only\n approved Sneat-owned host suffixes can be claimed.</ion-text\n >\n </p>\n <ion-button fill=\"clear\" (click)=\"changeDomainOrProvider()\"\n >Back</ion-button\n >\n <ion-button\n [disabled]=\"!connectionValid() || busy()\"\n (click)=\"save()\"\n >\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Save and continue\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else {\n <ion-card>\n <ion-card-content>\n <h2>4. Test and manage SSO</h2>\n <p>\n Saving does not activate SSO. Activation requires a complete,\n validated sign-in through your configured provider.\n </p>\n <ion-button [disabled]=\"busy()\" (click)=\"testAndActivate()\">\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n {{\n config()?.status === 'active'\n ? 'Test SSO again'\n : 'Test & Activate SSO'\n }}\n </ion-button>\n <ion-button\n fill=\"outline\"\n [disabled]=\"busy()\"\n (click)=\"editConnection()\"\n >\n Edit or rotate credentials\n </ion-button>\n @if (config()?.status === 'active') {\n <ion-button\n color=\"warning\"\n fill=\"outline\"\n [disabled]=\"busy()\"\n (click)=\"disable()\"\n >\n Disable SSO\n </ion-button>\n }\n <ion-button\n color=\"danger\"\n fill=\"clear\"\n [disabled]=\"busy()\"\n (click)=\"deleteConfiguration()\"\n >\n Delete configuration\n </ion-button>\n </ion-card-content>\n </ion-card>\n }\n\n @if (error()) {\n <ion-card color=\"danger\">\n <ion-card-content>{{ error() }}</ion-card-content>\n </ion-card>\n }\n @if (success()) {\n <ion-card color=\"success\">\n <ion-card-content>{{ success() }}</ion-card-content>\n </ion-card>\n }\n }\n</ion-content>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: IonBackButton, selector: "ion-back-button" }, { kind: "component", type: IonBadge, selector: "ion-badge", inputs: ["color", "mode"] }, { kind: "component", type: IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"], outputs: ["ionFocus", "ionBlur"] }, { kind: "component", type: IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: IonCard, selector: "ion-card", inputs: ["button", "color", "disabled", "download", "href", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonCardContent, selector: "ion-card-content", inputs: ["mode"] }, { kind: "component", type: IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"], outputs: ["ionScrollStart", "ionScroll", "ionScrollEnd"] }, { kind: "component", type: IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: IonInput, selector: "ion-input", inputs: ["accept", "autocapitalize", "autocomplete", "autocorrect", "autofocus", "clearInput", "clearOnEdit", "color", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "max", "maxlength", "min", "minlength", "mode", "multiple", "name", "pattern", "placeholder", "readonly", "required", "shape", "size", "spellcheck", "step", "type", "value"] }, { kind: "component", type: IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: IonSpinner, selector: "ion-spinner", inputs: ["color", "duration", "name", "paused"] }, { kind: "component", type: IonText, selector: "ion-text", inputs: ["color", "mode"] }, { kind: "component", type: IonTextarea, selector: "ion-textarea", inputs: ["autoGrow", "autocapitalize", "autofocus", "clearOnEdit", "color", "cols", "counter", "counterFormatter", "debounce", "disabled", "enterkeyhint", "errorText", "fill", "helperText", "inputmode", "label", "labelPlacement", "maxlength", "minlength", "mode", "name", "placeholder", "readonly", "required", "rows", "shape", "spellcheck", "value", "wrap"] }, { kind: "component", type: IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
267
|
+
}
|
|
268
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: SsoSettingsPageComponent, decorators: [{
|
|
269
|
+
type: Component,
|
|
270
|
+
args: [{ selector: 'sneat-sso-settings-page', changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
271
|
+
FormsModule,
|
|
272
|
+
IonBackButton,
|
|
273
|
+
IonBadge,
|
|
274
|
+
IonButton,
|
|
275
|
+
IonButtons,
|
|
276
|
+
IonCard,
|
|
277
|
+
IonCardContent,
|
|
278
|
+
IonContent,
|
|
279
|
+
IonHeader,
|
|
280
|
+
IonInput,
|
|
281
|
+
IonItem,
|
|
282
|
+
IonLabel,
|
|
283
|
+
IonSpinner,
|
|
284
|
+
IonText,
|
|
285
|
+
IonTextarea,
|
|
286
|
+
IonTitle,
|
|
287
|
+
IonToolbar,
|
|
288
|
+
], template: "<ion-header>\n <ion-toolbar color=\"light\">\n <ion-buttons slot=\"start\">\n <ion-back-button [defaultHref]=\"spaceHomeURL\" />\n </ion-buttons>\n <ion-title>Enterprise SSO</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n @if (loading() || !userRecordLoaded()) {\n <div class=\"ion-text-center ion-padding\">\n <ion-spinner />\n <p>Loading SSO settings\u2026</p>\n </div>\n } @else if (!isAdmin()) {\n <ion-card color=\"danger\">\n <ion-card-content>\n <h1>Owner or admin access required</h1>\n <p>You do not have permission to configure SSO for this space.</p>\n </ion-card-content>\n </ion-card>\n } @else {\n <ion-card>\n <ion-card-content>\n <h1>Company sign-in</h1>\n <p>Set up OIDC or SAML without changing Sneat users or memberships.</p>\n <p aria-label=\"Setup progress\">\n Step {{ step() }} of 4\n @if (config(); as current) {\n \u00B7 Status:\n <ion-badge\n [color]=\"current.status === 'active' ? 'success' : 'medium'\"\n >{{ current.status }}</ion-badge\n >\n }\n </p>\n </ion-card-content>\n </ion-card>\n\n @if (step() === 1) {\n <ion-card>\n <ion-card-content>\n <h2>1. Choose your identity provider</h2>\n <p>Pick a guided preset or use a standards-based connection.</p>\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'entra' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('entra')\"\n >Microsoft Entra ID</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'okta' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('okta')\"\n >Okta</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'keycloak' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('keycloak')\"\n >Keycloak</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'generic_oidc' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('generic_oidc')\"\n >Generic OIDC</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'generic_saml' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('generic_saml')\"\n >SAML 2.0</ion-button\n >\n\n <ion-item class=\"ion-margin-top\">\n <ion-label position=\"stacked\">Primary email domain</ion-label>\n <ion-input\n name=\"email-domain\"\n placeholder=\"acme.com\"\n [ngModel]=\"domain()\"\n (ngModelChange)=\"domain.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-button\n expand=\"block\"\n class=\"ion-margin-top\"\n [disabled]=\"!domainValid() || busy()\"\n (click)=\"prepareDomain()\"\n >\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Continue to domain verification\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else if (step() === 2) {\n <ion-card>\n <ion-card-content>\n <h2>2. Prove control of {{ domain() }}</h2>\n <p>\n Add this TXT record in your DNS provider. This prevents an arbitrary\n identity provider from claiming somebody else\u2019s email domain.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">DNS record name</ion-label>\n <ion-input\n name=\"dns-record-name\"\n readonly\n [value]=\"config()?.domainVerification?.recordName\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">TXT value</ion-label>\n <ion-input\n name=\"dns-record-value\"\n readonly\n [value]=\"config()?.domainVerification?.recordValue\"\n />\n </ion-item>\n <p>\n <ion-text color=\"medium\"\n >DNS changes may need a few minutes to propagate.</ion-text\n >\n </p>\n <ion-button fill=\"clear\" (click)=\"changeDomainOrProvider()\"\n >Back</ion-button\n >\n <ion-button [disabled]=\"busy()\" (click)=\"verifyDomain()\">\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Check DNS record\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else if (step() === 3) {\n <ion-card>\n <ion-card-content>\n <h2>3. Connect {{ protocol().toUpperCase() }}</h2>\n @if (isOIDC()) {\n <p>\n Register <strong>{{ oidcRedirectURL }}</strong>\n as the provider redirect URI.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">OIDC issuer</ion-label>\n <ion-input\n name=\"issuer\"\n type=\"url\"\n placeholder=\"https://login.microsoftonline.com/tenant-id/v2.0\"\n [ngModel]=\"issuer()\"\n (ngModelChange)=\"issuer.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">Client ID</ion-label>\n <ion-input\n name=\"client-id\"\n autocomplete=\"off\"\n [ngModel]=\"clientID()\"\n (ngModelChange)=\"clientID.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">Client secret</ion-label>\n <ion-input\n name=\"client-secret\"\n type=\"password\"\n autocomplete=\"new-password\"\n [placeholder]=\"\n config()?.hasClientSecret\n ? 'Leave blank to keep it, or enter a replacement'\n : 'Required'\n \"\n [ngModel]=\"clientSecret()\"\n (ngModelChange)=\"clientSecret.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n } @else {\n <p>\n Give your IdP the DataTug service-provider metadata URL, then\n paste the IdP metadata XML below.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">SP metadata URL</ion-label>\n <ion-input\n name=\"saml-sp-metadata-url\"\n readonly\n [value]=\"samlMetadataURL\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">IdP metadata XML</ion-label>\n <ion-textarea\n name=\"saml-idp-metadata\"\n autoGrow=\"true\"\n rows=\"8\"\n [placeholder]=\"\n config()?.hasSamlMetadata\n ? 'Paste replacement metadata, or leave blank to keep it'\n : '<EntityDescriptor \u2026>'\n \"\n [ngModel]=\"samlMetadata()\"\n (ngModelChange)=\"samlMetadata.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n }\n\n <ion-item>\n <ion-label position=\"stacked\"\n >Company login host (optional)</ion-label\n >\n <ion-input\n name=\"login-host\"\n placeholder=\"acme.datatug.app\"\n [ngModel]=\"loginHost()\"\n (ngModelChange)=\"loginHost.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <p>\n <ion-text color=\"medium\"\n >A company host fixes the login page to this email domain. Only\n approved Sneat-owned host suffixes can be claimed.</ion-text\n >\n </p>\n <ion-button fill=\"clear\" (click)=\"changeDomainOrProvider()\"\n >Back</ion-button\n >\n <ion-button\n [disabled]=\"!connectionValid() || busy()\"\n (click)=\"save()\"\n >\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Save and continue\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else {\n <ion-card>\n <ion-card-content>\n <h2>4. Test and manage SSO</h2>\n <p>\n Saving does not activate SSO. Activation requires a complete,\n validated sign-in through your configured provider.\n </p>\n <ion-button [disabled]=\"busy()\" (click)=\"testAndActivate()\">\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n {{\n config()?.status === 'active'\n ? 'Test SSO again'\n : 'Test & Activate SSO'\n }}\n </ion-button>\n <ion-button\n fill=\"outline\"\n [disabled]=\"busy()\"\n (click)=\"editConnection()\"\n >\n Edit or rotate credentials\n </ion-button>\n @if (config()?.status === 'active') {\n <ion-button\n color=\"warning\"\n fill=\"outline\"\n [disabled]=\"busy()\"\n (click)=\"disable()\"\n >\n Disable SSO\n </ion-button>\n }\n <ion-button\n color=\"danger\"\n fill=\"clear\"\n [disabled]=\"busy()\"\n (click)=\"deleteConfiguration()\"\n >\n Delete configuration\n </ion-button>\n </ion-card-content>\n </ion-card>\n }\n\n @if (error()) {\n <ion-card color=\"danger\">\n <ion-card-content>{{ error() }}</ion-card-content>\n </ion-card>\n }\n @if (success()) {\n <ion-card color=\"success\">\n <ion-card-content>{{ success() }}</ion-card-content>\n </ion-card>\n }\n }\n</ion-content>\n" }]
|
|
289
|
+
}] });
|
|
290
|
+
//# sourceMappingURL=sso-settings-page.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sso-settings-page.component.js","sourceRoot":"","sources":["../../../../../../../libs/auth/ui/src/lib/sso/sso-settings-page.component.ts","../../../../../../../libs/auth/ui/src/lib/sso/sso-settings-page.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EACL,uBAAuB,EACvB,SAAS,EAET,QAAQ,EACR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C,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACnB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,CAAC,KAAK,YAAY,iBAAiB,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAClE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;YACzC,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;8GArQU,wBAAwB;kGAAxB,wBAAwB,mFClErC,y8UAmTA,2CDpQI,WAAW,+VACX,aAAa,4DACb,QAAQ,iFACR,SAAS,sRACT,UAAU,8EACV,OAAO,yLACP,cAAc,+EACd,UAAU,kOACV,SAAS,oGACT,QAAQ,8eACR,OAAO,0NACP,QAAQ,6FACR,UAAU,yGACV,OAAO,gFACP,WAAW,iaACX,QAAQ,iFACR,UAAU;;2FAGD,wBAAwB;kBAxBpC,SAAS;+BACE,yBAAyB,mBAElB,uBAAuB,CAAC,MAAM,WACtC;wBACP,WAAW;wBACX,aAAa;wBACb,QAAQ;wBACR,SAAS;wBACT,UAAU;wBACV,OAAO;wBACP,cAAc;wBACd,UAAU;wBACV,SAAS;wBACT,QAAQ;wBACR,OAAO;wBACP,QAAQ;wBACR,UAAU;wBACV,OAAO;wBACP,WAAW;wBACX,QAAQ;wBACR,UAAU;qBACX","sourcesContent":["import { HttpErrorResponse } from '@angular/common/http';\nimport {\n ChangeDetectionStrategy,\n Component,\n OnInit,\n computed,\n inject,\n signal,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\nimport { ActivatedRoute } from '@angular/router';\nimport {\n IonBackButton,\n IonBadge,\n IonButton,\n IonButtons,\n IonCard,\n IonCardContent,\n IonContent,\n IonHeader,\n IonInput,\n IonItem,\n IonLabel,\n IonSpinner,\n IonText,\n IonTextarea,\n IonTitle,\n IonToolbar,\n} from '@ionic/angular';\nimport { SneatUserService } from '@sneat/auth-core';\nimport { firstValueFrom } from 'rxjs';\nimport { SsoApiService } from './sso-api.service';\nimport { ssoErrorMessage } from './sso-errors';\nimport {\n applicationBaseURL,\n emailDomain,\n SsoConfig,\n SsoProtocol,\n SsoProviderPreset,\n} from './sso.models';\n\n@Component({\n selector: 'sneat-sso-settings-page',\n templateUrl: './sso-settings-page.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n FormsModule,\n IonBackButton,\n IonBadge,\n IonButton,\n IonButtons,\n IonCard,\n IonCardContent,\n IonContent,\n IonHeader,\n IonInput,\n IonItem,\n IonLabel,\n IonSpinner,\n IonText,\n IonTextarea,\n IonTitle,\n IonToolbar,\n ],\n})\nexport class SsoSettingsPageComponent implements OnInit {\n private readonly route = inject(ActivatedRoute);\n private readonly sso = inject(SsoApiService);\n private readonly userState = toSignal(inject(SneatUserService).userState);\n\n protected readonly spaceID =\n this.route.snapshot.paramMap.get('spaceID') ?? '';\n protected readonly spaceHomeURL = `/space/${\n this.route.snapshot.paramMap.get('spaceType') ?? 'company'\n }/${this.spaceID}`;\n protected readonly step = signal(1);\n protected readonly protocol = signal<SsoProtocol>('oidc');\n protected readonly providerPreset = signal<SsoProviderPreset>('entra');\n protected readonly domain = signal(\n this.route.snapshot.queryParamMap.get('domain') ?? '',\n );\n protected readonly issuer = signal('');\n protected readonly clientID = signal('');\n protected readonly clientSecret = signal('');\n protected readonly loginHost = signal('');\n protected readonly samlMetadata = signal('');\n protected readonly config = signal<SsoConfig | undefined>(undefined);\n protected readonly loading = signal(true);\n protected readonly busy = signal(false);\n protected readonly error = signal<string | undefined>(undefined);\n protected readonly success = signal<string | undefined>(\n this.route.snapshot.queryParamMap.has('activated')\n ? 'SSO was tested successfully and is now active.'\n : undefined,\n );\n protected readonly isAdmin = computed(() => {\n const roles = this.userState()?.record?.spaces?.[this.spaceID]?.roles ?? [];\n return roles.some((role) => role === 'owner' || role === 'admin');\n });\n protected readonly userRecordLoaded = computed(\n () => this.userState()?.record !== undefined,\n );\n protected readonly isOIDC = computed(() => this.protocol() === 'oidc');\n protected readonly domainValid = computed(\n () =>\n emailDomain(`admin@${this.domain()}`) ===\n this.domain().trim().toLowerCase(),\n );\n protected readonly domainVerified = computed(\n () => !!this.config()?.domainVerification?.verifiedAt,\n );\n protected readonly connectionValid = computed(() => {\n if (this.isOIDC()) {\n return (\n !!this.issuer().trim() &&\n !!this.clientID().trim() &&\n (!!this.clientSecret() || !!this.config()?.hasClientSecret)\n );\n }\n return !!this.samlMetadata().trim() || !!this.config()?.hasSamlMetadata;\n });\n protected readonly samlMetadataURL = this.sso.samlMetadataURL();\n protected readonly oidcRedirectURL = `${applicationBaseURL()}/sso/callback`;\n\n ngOnInit(): void {\n void this.load();\n }\n\n protected chooseProvider(preset: SsoProviderPreset): void {\n if (this.busy()) {\n return;\n }\n this.providerPreset.set(preset);\n this.protocol.set(preset === 'generic_saml' ? 'saml' : 'oidc');\n }\n\n protected async prepareDomain(): Promise<void> {\n if (!this.isAdmin() || !this.domainValid() || this.busy()) {\n return;\n }\n this.beginOperation();\n try {\n const config = await firstValueFrom(\n this.sso.prepareDomain({\n spaceID: this.spaceID,\n emailDomain: this.domain().trim().toLowerCase(),\n protocol: this.protocol(),\n providerPreset: this.providerPreset(),\n }),\n );\n this.config.set(config);\n this.step.set(config.domainVerification?.verifiedAt ? 3 : 2);\n } catch (error) {\n this.error.set(ssoErrorMessage(error));\n } finally {\n this.busy.set(false);\n }\n }\n\n protected async verifyDomain(): Promise<void> {\n if (this.busy()) {\n return;\n }\n this.beginOperation();\n try {\n const config = await firstValueFrom(this.sso.verifyDomain(this.spaceID));\n this.config.set(config);\n this.success.set('Domain ownership verified. Add the provider details.');\n this.step.set(3);\n } catch (error) {\n this.error.set(ssoErrorMessage(error));\n } finally {\n this.busy.set(false);\n }\n }\n\n protected async save(): Promise<void> {\n if (\n !this.isAdmin() ||\n !this.domainVerified() ||\n !this.connectionValid() ||\n this.busy()\n ) {\n return;\n }\n this.beginOperation();\n try {\n const config = await firstValueFrom(\n this.sso.saveConfig({\n spaceID: this.spaceID,\n protocol: this.protocol(),\n providerPreset: this.providerPreset(),\n emailDomain: this.domain().trim().toLowerCase(),\n issuer: this.isOIDC() ? this.issuer().trim() : undefined,\n clientID: this.isOIDC() ? this.clientID().trim() : undefined,\n clientSecret: this.isOIDC() ? this.clientSecret() : undefined,\n loginHost: this.loginHost().trim() || undefined,\n samlIdpMetadataXML: this.isOIDC()\n ? undefined\n : this.samlMetadata().trim(),\n }),\n );\n this.config.set(config);\n this.clientSecret.set('');\n this.success.set(\n 'Configuration saved securely. Complete a real provider sign-in to activate it.',\n );\n this.step.set(4);\n } catch (error) {\n this.error.set(ssoErrorMessage(error));\n } finally {\n this.busy.set(false);\n }\n }\n\n protected async testAndActivate(): Promise<void> {\n if (this.busy() || !this.domainVerified()) {\n return;\n }\n this.beginOperation();\n try {\n const result = await firstValueFrom(\n this.sso.startActivation(this.spaceID, applicationBaseURL()),\n );\n location.assign(result.authorizationURL);\n } catch (error) {\n this.error.set(ssoErrorMessage(error));\n this.busy.set(false);\n }\n }\n\n protected editConnection(): void {\n this.clearMessages();\n this.step.set(3);\n }\n\n protected changeDomainOrProvider(): void {\n this.clearMessages();\n this.step.set(1);\n }\n\n protected async disable(): Promise<void> {\n if (this.busy() || this.config()?.status !== 'active') {\n return;\n }\n this.beginOperation();\n try {\n const config = await firstValueFrom(this.sso.disable(this.spaceID));\n this.config.set(config);\n this.success.set('SSO is disabled. Regular sign-in remains available.');\n } catch (error) {\n this.error.set(ssoErrorMessage(error));\n } finally {\n this.busy.set(false);\n }\n }\n\n protected async deleteConfiguration(): Promise<void> {\n if (\n this.busy() ||\n !confirm(\n 'Delete this SSO configuration and release its domain and login host?',\n )\n ) {\n return;\n }\n this.beginOperation();\n try {\n await firstValueFrom(this.sso.delete(this.spaceID));\n this.config.set(undefined);\n this.issuer.set('');\n this.clientID.set('');\n this.clientSecret.set('');\n this.samlMetadata.set('');\n this.loginHost.set('');\n this.step.set(1);\n this.success.set('SSO configuration deleted. The domain is available.');\n } catch (error) {\n this.error.set(ssoErrorMessage(error));\n } finally {\n this.busy.set(false);\n }\n }\n\n private beginOperation(): void {\n this.busy.set(true);\n this.clearMessages();\n }\n\n private clearMessages(): void {\n this.error.set(undefined);\n this.success.set(undefined);\n }\n\n private async load(): Promise<void> {\n try {\n const config = await firstValueFrom(this.sso.getConfig(this.spaceID));\n this.config.set(config);\n this.domain.set(config.emailDomains[0] ?? this.domain());\n this.protocol.set(config.protocol);\n this.providerPreset.set(\n config.providerPreset ??\n (config.protocol === 'saml' ? 'generic_saml' : 'generic_oidc'),\n );\n this.issuer.set(config.issuer);\n this.clientID.set(config.clientID);\n this.loginHost.set(config.loginHosts?.[0] ?? '');\n if (\n config.status === 'active' ||\n config.status === 'disabled' ||\n config.hasClientSecret ||\n config.hasSamlMetadata\n ) {\n this.step.set(4);\n } else if (config.domainVerification?.verifiedAt) {\n this.step.set(3);\n } else {\n this.step.set(2);\n }\n } catch (error) {\n if (!(error instanceof HttpErrorResponse) || error.status !== 404) {\n this.error.set(ssoErrorMessage(error));\n }\n } finally {\n this.loading.set(false);\n }\n }\n}\n","<ion-header>\n <ion-toolbar color=\"light\">\n <ion-buttons slot=\"start\">\n <ion-back-button [defaultHref]=\"spaceHomeURL\" />\n </ion-buttons>\n <ion-title>Enterprise SSO</ion-title>\n </ion-toolbar>\n</ion-header>\n\n<ion-content class=\"ion-padding\">\n @if (loading() || !userRecordLoaded()) {\n <div class=\"ion-text-center ion-padding\">\n <ion-spinner />\n <p>Loading SSO settings…</p>\n </div>\n } @else if (!isAdmin()) {\n <ion-card color=\"danger\">\n <ion-card-content>\n <h1>Owner or admin access required</h1>\n <p>You do not have permission to configure SSO for this space.</p>\n </ion-card-content>\n </ion-card>\n } @else {\n <ion-card>\n <ion-card-content>\n <h1>Company sign-in</h1>\n <p>Set up OIDC or SAML without changing Sneat users or memberships.</p>\n <p aria-label=\"Setup progress\">\n Step {{ step() }} of 4\n @if (config(); as current) {\n · Status:\n <ion-badge\n [color]=\"current.status === 'active' ? 'success' : 'medium'\"\n >{{ current.status }}</ion-badge\n >\n }\n </p>\n </ion-card-content>\n </ion-card>\n\n @if (step() === 1) {\n <ion-card>\n <ion-card-content>\n <h2>1. Choose your identity provider</h2>\n <p>Pick a guided preset or use a standards-based connection.</p>\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'entra' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('entra')\"\n >Microsoft Entra ID</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'okta' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('okta')\"\n >Okta</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'keycloak' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('keycloak')\"\n >Keycloak</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'generic_oidc' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('generic_oidc')\"\n >Generic OIDC</ion-button\n >\n <ion-button\n fill=\"outline\"\n [color]=\"providerPreset() === 'generic_saml' ? 'primary' : 'medium'\"\n (click)=\"chooseProvider('generic_saml')\"\n >SAML 2.0</ion-button\n >\n\n <ion-item class=\"ion-margin-top\">\n <ion-label position=\"stacked\">Primary email domain</ion-label>\n <ion-input\n name=\"email-domain\"\n placeholder=\"acme.com\"\n [ngModel]=\"domain()\"\n (ngModelChange)=\"domain.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-button\n expand=\"block\"\n class=\"ion-margin-top\"\n [disabled]=\"!domainValid() || busy()\"\n (click)=\"prepareDomain()\"\n >\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Continue to domain verification\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else if (step() === 2) {\n <ion-card>\n <ion-card-content>\n <h2>2. Prove control of {{ domain() }}</h2>\n <p>\n Add this TXT record in your DNS provider. This prevents an arbitrary\n identity provider from claiming somebody else’s email domain.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">DNS record name</ion-label>\n <ion-input\n name=\"dns-record-name\"\n readonly\n [value]=\"config()?.domainVerification?.recordName\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">TXT value</ion-label>\n <ion-input\n name=\"dns-record-value\"\n readonly\n [value]=\"config()?.domainVerification?.recordValue\"\n />\n </ion-item>\n <p>\n <ion-text color=\"medium\"\n >DNS changes may need a few minutes to propagate.</ion-text\n >\n </p>\n <ion-button fill=\"clear\" (click)=\"changeDomainOrProvider()\"\n >Back</ion-button\n >\n <ion-button [disabled]=\"busy()\" (click)=\"verifyDomain()\">\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Check DNS record\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else if (step() === 3) {\n <ion-card>\n <ion-card-content>\n <h2>3. Connect {{ protocol().toUpperCase() }}</h2>\n @if (isOIDC()) {\n <p>\n Register <strong>{{ oidcRedirectURL }}</strong>\n as the provider redirect URI.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">OIDC issuer</ion-label>\n <ion-input\n name=\"issuer\"\n type=\"url\"\n placeholder=\"https://login.microsoftonline.com/tenant-id/v2.0\"\n [ngModel]=\"issuer()\"\n (ngModelChange)=\"issuer.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">Client ID</ion-label>\n <ion-input\n name=\"client-id\"\n autocomplete=\"off\"\n [ngModel]=\"clientID()\"\n (ngModelChange)=\"clientID.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">Client secret</ion-label>\n <ion-input\n name=\"client-secret\"\n type=\"password\"\n autocomplete=\"new-password\"\n [placeholder]=\"\n config()?.hasClientSecret\n ? 'Leave blank to keep it, or enter a replacement'\n : 'Required'\n \"\n [ngModel]=\"clientSecret()\"\n (ngModelChange)=\"clientSecret.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n } @else {\n <p>\n Give your IdP the DataTug service-provider metadata URL, then\n paste the IdP metadata XML below.\n </p>\n <ion-item>\n <ion-label position=\"stacked\">SP metadata URL</ion-label>\n <ion-input\n name=\"saml-sp-metadata-url\"\n readonly\n [value]=\"samlMetadataURL\"\n />\n </ion-item>\n <ion-item>\n <ion-label position=\"stacked\">IdP metadata XML</ion-label>\n <ion-textarea\n name=\"saml-idp-metadata\"\n autoGrow=\"true\"\n rows=\"8\"\n [placeholder]=\"\n config()?.hasSamlMetadata\n ? 'Paste replacement metadata, or leave blank to keep it'\n : '<EntityDescriptor …>'\n \"\n [ngModel]=\"samlMetadata()\"\n (ngModelChange)=\"samlMetadata.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n }\n\n <ion-item>\n <ion-label position=\"stacked\"\n >Company login host (optional)</ion-label\n >\n <ion-input\n name=\"login-host\"\n placeholder=\"acme.datatug.app\"\n [ngModel]=\"loginHost()\"\n (ngModelChange)=\"loginHost.set($event)\"\n [disabled]=\"busy()\"\n />\n </ion-item>\n <p>\n <ion-text color=\"medium\"\n >A company host fixes the login page to this email domain. Only\n approved Sneat-owned host suffixes can be claimed.</ion-text\n >\n </p>\n <ion-button fill=\"clear\" (click)=\"changeDomainOrProvider()\"\n >Back</ion-button\n >\n <ion-button\n [disabled]=\"!connectionValid() || busy()\"\n (click)=\"save()\"\n >\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n Save and continue\n </ion-button>\n </ion-card-content>\n </ion-card>\n } @else {\n <ion-card>\n <ion-card-content>\n <h2>4. Test and manage SSO</h2>\n <p>\n Saving does not activate SSO. Activation requires a complete,\n validated sign-in through your configured provider.\n </p>\n <ion-button [disabled]=\"busy()\" (click)=\"testAndActivate()\">\n @if (busy()) {\n <ion-spinner name=\"lines-small\" slot=\"start\" />\n }\n {{\n config()?.status === 'active'\n ? 'Test SSO again'\n : 'Test & Activate SSO'\n }}\n </ion-button>\n <ion-button\n fill=\"outline\"\n [disabled]=\"busy()\"\n (click)=\"editConnection()\"\n >\n Edit or rotate credentials\n </ion-button>\n @if (config()?.status === 'active') {\n <ion-button\n color=\"warning\"\n fill=\"outline\"\n [disabled]=\"busy()\"\n (click)=\"disable()\"\n >\n Disable SSO\n </ion-button>\n }\n <ion-button\n color=\"danger\"\n fill=\"clear\"\n [disabled]=\"busy()\"\n (click)=\"deleteConfiguration()\"\n >\n Delete configuration\n </ion-button>\n </ion-card-content>\n </ion-card>\n }\n\n @if (error()) {\n <ion-card color=\"danger\">\n <ion-card-content>{{ error() }}</ion-card-content>\n </ion-card>\n }\n @if (success()) {\n <ion-card color=\"success\">\n <ion-card-content>{{ success() }}</ion-card-content>\n </ion-card>\n }\n }\n</ion-content>\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const ssoBrowserBindingStorageKey = 'sneat.sso.browser-binding.v1';
|
|
2
|
+
export function applicationBaseURL() {
|
|
3
|
+
return document.baseURI.replace(/\/+$/, '');
|
|
4
|
+
}
|
|
5
|
+
export function emailDomain(email) {
|
|
6
|
+
const normalized = email.trim().toLowerCase();
|
|
7
|
+
if (normalized.split('@').length !== 2) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const separator = normalized.lastIndexOf('@');
|
|
11
|
+
if (separator <= 0 || separator === normalized.length - 1) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const domain = normalized.slice(separator + 1);
|
|
15
|
+
return domain.includes('.') && !/[\s/@]/.test(domain) ? domain : undefined;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=sso.models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sso.models.js","sourceRoot":"","sources":["../../../../../../../libs/auth/ui/src/lib/sso/sso.models.ts"],"names":[],"mappings":"AA0EA,MAAM,CAAC,MAAM,2BAA2B,GAAG,8BAA8B,CAAC;AAE1E,MAAM,UAAU,kBAAkB;IAChC,OAAO,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,SAAS,IAAI,CAAC,IAAI,SAAS,KAAK,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E,CAAC","sourcesContent":["export interface SsoDiscovery {\n readonly domain: string;\n readonly configured: boolean;\n readonly fixedDomain: boolean;\n}\n\nexport type SsoProtocol = 'oidc' | 'saml';\n\nexport type SsoProviderPreset =\n | 'entra'\n | 'okta'\n | 'keycloak'\n | 'generic_oidc'\n | 'generic_saml';\n\nexport interface SsoConfigRequest {\n readonly spaceID: string;\n readonly protocol: SsoProtocol;\n readonly providerPreset: SsoProviderPreset;\n readonly emailDomain: string;\n readonly issuer?: string;\n readonly clientID?: string;\n readonly clientSecret?: string;\n readonly loginHost?: string;\n readonly samlIdpMetadataXML?: string;\n}\n\nexport interface SsoConfig {\n readonly spaceID: string;\n readonly protocol: SsoProtocol;\n readonly providerPreset?: SsoProviderPreset;\n readonly status:\n | 'draft'\n | 'configured'\n | 'verification_pending'\n | 'active'\n | 'disabled';\n readonly emailDomains: readonly string[];\n readonly issuer: string;\n readonly clientID: string;\n readonly hasClientSecret: boolean;\n readonly loginHosts?: readonly string[];\n readonly samlIdpEntityID?: string;\n readonly hasSamlMetadata: boolean;\n readonly domainVerification?: SsoDomainVerification;\n readonly verifiedAt?: string;\n readonly verifiedByUserID?: string;\n readonly disabledAt?: string;\n}\n\nexport interface SsoDomainVerification {\n readonly recordName: string;\n readonly recordValue: string;\n readonly verifiedAt?: string;\n}\n\nexport interface SsoDomainChallengeRequest {\n readonly spaceID: string;\n readonly emailDomain: string;\n readonly protocol: SsoProtocol;\n readonly providerPreset: SsoProviderPreset;\n}\n\nexport interface SsoStart {\n readonly authorizationURL: string;\n readonly browserBinding: string;\n}\n\nexport interface SsoExchange {\n readonly firebaseCustomToken: string;\n readonly userID: string;\n readonly spaceID: string;\n}\n\nexport const ssoBrowserBindingStorageKey = 'sneat.sso.browser-binding.v1';\n\nexport function applicationBaseURL(): string {\n return document.baseURI.replace(/\\/+$/, '');\n}\n\nexport function emailDomain(email: string): string | undefined {\n const normalized = email.trim().toLowerCase();\n if (normalized.split('@').length !== 2) {\n return undefined;\n }\n const separator = normalized.lastIndexOf('@');\n if (separator <= 0 || separator === normalized.length - 1) {\n return undefined;\n }\n const domain = normalized.slice(separator + 1);\n return domain.includes('.') && !/[\\s/@]/.test(domain) ? domain : undefined;\n}\n"]}
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
|
-
import { SneatAuthWithTelegramService } from './sneat-auth-with-telegram.service';
|
|
2
|
+
import { ITelegramOIDCNonce, SneatAuthWithTelegramService } from './sneat-auth-with-telegram.service';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Telegram login button. Bots with OpenID login configured server-side use
|
|
6
|
+
* Telegram's OpenID popup (telegram-login.js); others keep the legacy Login
|
|
7
|
+
* Widget (telegram-widget.js), e.g. the local dev bot.
|
|
8
|
+
*/
|
|
4
9
|
export declare class LoginWithTelegramComponent implements OnInit {
|
|
5
10
|
private readonly el;
|
|
6
11
|
private readonly document;
|
|
12
|
+
private readonly destroyRef;
|
|
13
|
+
private readonly errorLogger;
|
|
7
14
|
readonly authWithTelegram: SneatAuthWithTelegramService;
|
|
8
15
|
private readonly telegramLoginConfig;
|
|
9
16
|
constructor();
|
|
@@ -12,7 +19,13 @@ export declare class LoginWithTelegramComponent implements OnInit {
|
|
|
12
19
|
readonly size: import("@angular/core").InputSignal<"medium" | "small" | "large">;
|
|
13
20
|
readonly requestAccess: import("@angular/core").InputSignal<"write" | "read">;
|
|
14
21
|
readonly userPic: import("@angular/core").InputSignal<boolean>;
|
|
22
|
+
/** Set once the OpenID popup can be offered: Client ID plus a live nonce. */
|
|
23
|
+
protected readonly oidc: import("@angular/core").WritableSignal<ITelegramOIDCNonce | undefined>;
|
|
15
24
|
ngOnInit(): void;
|
|
25
|
+
protected loginWithOIDC(cfg: ITelegramOIDCNonce): void;
|
|
26
|
+
private startOIDC;
|
|
27
|
+
private refreshNonce;
|
|
28
|
+
private startLegacyWidget;
|
|
16
29
|
static ɵfac: i0.ɵɵFactoryDeclaration<LoginWithTelegramComponent, never>;
|
|
17
30
|
static ɵcmp: i0.ɵɵComponentDeclaration<LoginWithTelegramComponent, "sneat-login-with-telegram", never, { "isUserAuthenticated": { "alias": "isUserAuthenticated"; "required": false; "isSignal": true; }; "botID": { "alias": "botID"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "requestAccess": { "alias": "requestAccess"; "required": false; "isSignal": true; }; "userPic": { "alias": "userPic"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
18
31
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
1
2
|
import * as i0 from "@angular/core";
|
|
2
3
|
export interface ITelegramAuthData {
|
|
3
4
|
id: number;
|
|
@@ -8,11 +9,25 @@ export interface ITelegramAuthData {
|
|
|
8
9
|
auth_date: number;
|
|
9
10
|
hash: string;
|
|
10
11
|
}
|
|
12
|
+
/** What the server hands the page before it opens Telegram's OpenID popup. */
|
|
13
|
+
export interface ITelegramOIDCNonce {
|
|
14
|
+
clientID: string;
|
|
15
|
+
nonce: string;
|
|
16
|
+
}
|
|
11
17
|
export declare class SneatAuthWithTelegramService {
|
|
12
18
|
private readonly errorLogger;
|
|
13
19
|
private readonly apiService;
|
|
14
20
|
private readonly authService;
|
|
21
|
+
/** Legacy Login Widget: posts the widget's signed payload. */
|
|
15
22
|
loginWithTelegram(botID: string, tgAuthData: ITelegramAuthData, isUserAuthenticated: boolean): void;
|
|
23
|
+
/**
|
|
24
|
+
* Asks the server for the bot's OpenID Client ID and a fresh nonce. Fails
|
|
25
|
+
* with 400 for a bot that has no OpenID login configured server-side.
|
|
26
|
+
*/
|
|
27
|
+
getTelegramOIDCNonce(botID: string): Observable<ITelegramOIDCNonce>;
|
|
28
|
+
/** OpenID login: posts the id_token Telegram's popup returned. */
|
|
29
|
+
loginWithTelegramOIDC(botID: string, idToken: string, isUserAuthenticated: boolean): void;
|
|
30
|
+
private signIn;
|
|
16
31
|
static ɵfac: i0.ɵɵFactoryDeclaration<SneatAuthWithTelegramService, never>;
|
|
17
32
|
static ɵprov: i0.ɵɵInjectableDeclaration<SneatAuthWithTelegramService>;
|
|
18
33
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram's OpenID login library for websites.
|
|
3
|
+
* https://core.telegram.org/bots/telegram-login
|
|
4
|
+
*/
|
|
5
|
+
export declare const TELEGRAM_LOGIN_JS_URL = "https://oauth.telegram.org/js/telegram-login.js?6";
|
|
6
|
+
export interface ITelegramLoginOptions {
|
|
7
|
+
/** The bot's Client ID from @BotFather (Login Widget section). */
|
|
8
|
+
client_id: number;
|
|
9
|
+
/** Server-issued nonce; Telegram echoes it into the id_token. */
|
|
10
|
+
nonce?: string;
|
|
11
|
+
/**
|
|
12
|
+
* `['write']` asks permission for the bot to message the user. Because no
|
|
13
|
+
* `scope` is passed, the library also requests `profile`, whose `id` claim
|
|
14
|
+
* carries the numeric Telegram user ID the server signs in with.
|
|
15
|
+
*/
|
|
16
|
+
request_access?: string[];
|
|
17
|
+
lang?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ITelegramLoginResult {
|
|
20
|
+
id_token?: string;
|
|
21
|
+
user?: Record<string, unknown>;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
interface ITelegramLoginApi {
|
|
25
|
+
auth(options: ITelegramLoginOptions, callback: (result: ITelegramLoginResult) => void): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function telegramLoginApi(win: Window): ITelegramLoginApi | undefined;
|
|
28
|
+
/** Loads telegram-login.js once per document; resolves once it has loaded. */
|
|
29
|
+
export declare function loadTelegramLoginScript(doc: Document): Promise<void>;
|
|
30
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Routes } from '@angular/router';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
import * as i1 from "@angular/router";
|
|
4
|
+
export declare const ssoRoutes: Routes;
|
|
4
5
|
export declare const authRoutes: Routes;
|
|
5
6
|
export declare class SneatAuthRoutingModule {
|
|
6
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<SneatAuthRoutingModule, never>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { SsoConfig, SsoConfigRequest, SsoDomainChallengeRequest, SsoDiscovery, SsoExchange, SsoStart } from './sso.models';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class SsoApiService {
|
|
5
|
+
private readonly api;
|
|
6
|
+
private readonly apiBaseURL;
|
|
7
|
+
discover(email: string, loginHost?: string): Observable<SsoDiscovery>;
|
|
8
|
+
getConfig(spaceID: string): Observable<SsoConfig>;
|
|
9
|
+
saveConfig(request: SsoConfigRequest): Observable<SsoConfig>;
|
|
10
|
+
prepareDomain(request: SsoDomainChallengeRequest): Observable<SsoConfig>;
|
|
11
|
+
verifyDomain(spaceID: string): Observable<SsoConfig>;
|
|
12
|
+
disable(spaceID: string): Observable<SsoConfig>;
|
|
13
|
+
delete(spaceID: string): Observable<{
|
|
14
|
+
readonly deleted: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
samlMetadataURL(): string;
|
|
17
|
+
startActivation(spaceID: string, applicationBaseURL: string): Observable<SsoStart>;
|
|
18
|
+
startLogin(email: string, applicationBaseURL: string, loginHost?: string): Observable<SsoStart>;
|
|
19
|
+
exchange(code: string, browserBinding: string): Observable<SsoExchange>;
|
|
20
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SsoApiService, never>;
|
|
21
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SsoApiService>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OnInit } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class SsoCallbackPageComponent implements OnInit {
|
|
4
|
+
private readonly route;
|
|
5
|
+
private readonly router;
|
|
6
|
+
private readonly sso;
|
|
7
|
+
private readonly auth;
|
|
8
|
+
protected readonly error: import("@angular/core").WritableSignal<string | undefined>;
|
|
9
|
+
ngOnInit(): void;
|
|
10
|
+
private finishSignIn;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SsoCallbackPageComponent, never>;
|
|
12
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<SsoCallbackPageComponent, "sneat-sso-callback-page", never, {}, {}, never, never, true, never>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ssoErrorMessage(error: unknown): string;
|