@dereekb/dbx-firebase 13.11.14 → 13.11.16
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/fesm2022/dereekb-dbx-firebase-oidc.mjs +129 -102
- package/fesm2022/dereekb-dbx-firebase-oidc.mjs.map +1 -1
- package/fesm2022/dereekb-dbx-firebase.mjs +258 -173
- package/fesm2022/dereekb-dbx-firebase.mjs.map +1 -1
- package/package.json +11 -11
- package/types/dereekb-dbx-firebase-oidc.d.ts +28 -21
- package/types/dereekb-dbx-firebase.d.ts +93 -74
|
@@ -31,10 +31,10 @@ import { DatePipe, CommonModule } from '@angular/common';
|
|
|
31
31
|
class DbxFirebaseOAuthLoginViewComponent {
|
|
32
32
|
loginStateCase = input.required(...(ngDevMode ? [{ debugName: "loginStateCase" }] : /* istanbul ignore next */ []));
|
|
33
33
|
error = input(...(ngDevMode ? [undefined, { debugName: "error" }] : /* istanbul ignore next */ []));
|
|
34
|
-
|
|
34
|
+
resolvedErrorSignal = computed(() => {
|
|
35
35
|
const error = this.error();
|
|
36
36
|
return typeof error === 'string' ? readableError('ERROR', error) : error;
|
|
37
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
37
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedErrorSignal" }] : /* istanbul ignore next */ []));
|
|
38
38
|
retryClick = output();
|
|
39
39
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebaseOAuthLoginViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
40
40
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxFirebaseOAuthLoginViewComponent, isStandalone: true, selector: "dbx-firebase-oauth-login-view", inputs: { loginStateCase: { classPropertyName: "loginStateCase", publicName: "loginStateCase", isSignal: true, isRequired: true, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { retryClick: "retryClick" }, host: { classAttribute: "d-block dbx-firebase-oauth-login-view" }, ngImport: i0, template: `
|
|
@@ -54,7 +54,7 @@ class DbxFirebaseOAuthLoginViewComponent {
|
|
|
54
54
|
}
|
|
55
55
|
@case ('error') {
|
|
56
56
|
<dbx-button text="Retry" [raised]="true" (buttonClick)="retryClick.emit()"></dbx-button>
|
|
57
|
-
<dbx-error [error]="
|
|
57
|
+
<dbx-error [error]="resolvedErrorSignal()"></dbx-error>
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
</div>
|
|
@@ -83,7 +83,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
83
83
|
}
|
|
84
84
|
@case ('error') {
|
|
85
85
|
<dbx-button text="Retry" [raised]="true" (buttonClick)="retryClick.emit()"></dbx-button>
|
|
86
|
-
<dbx-error [error]="
|
|
86
|
+
<dbx-error [error]="resolvedErrorSignal()"></dbx-error>
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
</div>
|
|
@@ -145,19 +145,19 @@ class DbxFirebaseOAuthConsentViewComponent {
|
|
|
145
145
|
* No value is passed (`dbxActionValue` provides an empty payload).
|
|
146
146
|
*/
|
|
147
147
|
denyHandler = input.required(...(ngDevMode ? [{ debugName: "denyHandler" }] : /* istanbul ignore next */ []));
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
clientNameSignal = computed(() => this.details()?.client_name ?? '', ...(ngDevMode ? [{ debugName: "clientNameSignal" }] : /* istanbul ignore next */ []));
|
|
149
|
+
clientUriSignal = computed(() => this.details()?.client_uri, ...(ngDevMode ? [{ debugName: "clientUriSignal" }] : /* istanbul ignore next */ []));
|
|
150
|
+
logoUriSignal = computed(() => this.details()?.logo_uri, ...(ngDevMode ? [{ debugName: "logoUriSignal" }] : /* istanbul ignore next */ []));
|
|
151
|
+
scopesSignal = computed(() => SPACE_STRING_SPLIT_JOIN.splitStrings(this.details()?.scopes ?? ''), ...(ngDevMode ? [{ debugName: "scopesSignal" }] : /* istanbul ignore next */ []));
|
|
152
|
+
resolvedScopeInjectionConfigSignal = computed(() => {
|
|
153
153
|
const data = {
|
|
154
154
|
details: this.details(),
|
|
155
|
-
scopes: this.
|
|
156
|
-
clientName: this.
|
|
155
|
+
scopes: this.scopesSignal(),
|
|
156
|
+
clientName: this.clientNameSignal(),
|
|
157
157
|
requiredScopes: this.requiredScopes()
|
|
158
158
|
};
|
|
159
159
|
return { ...this.scopeInjectionConfig(), data };
|
|
160
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
160
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedScopeInjectionConfigSignal" }] : /* istanbul ignore next */ []));
|
|
161
161
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebaseOAuthConsentViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
162
162
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxFirebaseOAuthConsentViewComponent, isStandalone: true, selector: "dbx-firebase-oauth-consent-view", inputs: { details: { classPropertyName: "details", publicName: "details", isSignal: true, isRequired: false, transformFunction: null }, consentStateCase: { classPropertyName: "consentStateCase", publicName: "consentStateCase", isSignal: true, isRequired: true, transformFunction: null }, scopeInjectionConfig: { classPropertyName: "scopeInjectionConfig", publicName: "scopeInjectionConfig", isSignal: true, isRequired: true, transformFunction: null }, requiredScopes: { classPropertyName: "requiredScopes", publicName: "requiredScopes", isSignal: true, isRequired: false, transformFunction: null }, approveHandler: { classPropertyName: "approveHandler", publicName: "approveHandler", isSignal: true, isRequired: true, transformFunction: null }, denyHandler: { classPropertyName: "denyHandler", publicName: "denyHandler", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "d-block dbx-firebase-oauth-consent-view" }, ngImport: i0, template: `
|
|
163
163
|
<div class="dbx-firebase-oauth-consent-view">
|
|
@@ -170,27 +170,27 @@ class DbxFirebaseOAuthConsentViewComponent {
|
|
|
170
170
|
}
|
|
171
171
|
@case ('user') {
|
|
172
172
|
<div class="dbx-firebase-oauth-consent-header">
|
|
173
|
-
@if (
|
|
174
|
-
<h2>You're signing in to {{
|
|
173
|
+
@if (clientNameSignal()) {
|
|
174
|
+
<h2>You're signing in to {{ clientNameSignal() }}</h2>
|
|
175
175
|
}
|
|
176
176
|
<div class="dbx-firebase-oauth-consent-header-info dbx-flex">
|
|
177
|
-
<dbx-avatar [avatarUrl]="
|
|
177
|
+
<dbx-avatar [avatarUrl]="logoUriSignal()" [avatarStyle]="'square'" avatarIcon="apps"></dbx-avatar>
|
|
178
178
|
<span>
|
|
179
|
-
@if (
|
|
180
|
-
<a class="dbx-firebase-oauth-consent-client-uri" [href]="
|
|
179
|
+
@if (clientUriSignal()) {
|
|
180
|
+
<a class="dbx-firebase-oauth-consent-client-uri" [href]="clientUriSignal()" target="_blank" rel="noopener noreferrer">{{ clientUriSignal() }}</a>
|
|
181
181
|
}
|
|
182
182
|
</span>
|
|
183
183
|
</div>
|
|
184
184
|
</div>
|
|
185
|
-
@if (
|
|
185
|
+
@if (clientNameSignal()) {
|
|
186
186
|
<p class="dbx-firebase-oauth-consent-prompt">
|
|
187
|
-
<strong>{{
|
|
187
|
+
<strong>{{ clientNameSignal() }}</strong>
|
|
188
188
|
is requesting these permissions:
|
|
189
189
|
</p>
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
<div dbxAction dbxActionSnackbarError [dbxActionHandler]="approveHandler()">
|
|
193
|
-
<dbx-injection [config]="
|
|
193
|
+
<dbx-injection [config]="resolvedScopeInjectionConfigSignal()"></dbx-injection>
|
|
194
194
|
|
|
195
195
|
<div class="dbx-pt3 dbx-pb3 dbx-firebase-oauth-consent-actions">
|
|
196
196
|
<dbx-button dbxActionButton text="Approve" [raised]="true" color="primary"></dbx-button>
|
|
@@ -218,27 +218,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
218
218
|
}
|
|
219
219
|
@case ('user') {
|
|
220
220
|
<div class="dbx-firebase-oauth-consent-header">
|
|
221
|
-
@if (
|
|
222
|
-
<h2>You're signing in to {{
|
|
221
|
+
@if (clientNameSignal()) {
|
|
222
|
+
<h2>You're signing in to {{ clientNameSignal() }}</h2>
|
|
223
223
|
}
|
|
224
224
|
<div class="dbx-firebase-oauth-consent-header-info dbx-flex">
|
|
225
|
-
<dbx-avatar [avatarUrl]="
|
|
225
|
+
<dbx-avatar [avatarUrl]="logoUriSignal()" [avatarStyle]="'square'" avatarIcon="apps"></dbx-avatar>
|
|
226
226
|
<span>
|
|
227
|
-
@if (
|
|
228
|
-
<a class="dbx-firebase-oauth-consent-client-uri" [href]="
|
|
227
|
+
@if (clientUriSignal()) {
|
|
228
|
+
<a class="dbx-firebase-oauth-consent-client-uri" [href]="clientUriSignal()" target="_blank" rel="noopener noreferrer">{{ clientUriSignal() }}</a>
|
|
229
229
|
}
|
|
230
230
|
</span>
|
|
231
231
|
</div>
|
|
232
232
|
</div>
|
|
233
|
-
@if (
|
|
233
|
+
@if (clientNameSignal()) {
|
|
234
234
|
<p class="dbx-firebase-oauth-consent-prompt">
|
|
235
|
-
<strong>{{
|
|
235
|
+
<strong>{{ clientNameSignal() }}</strong>
|
|
236
236
|
is requesting these permissions:
|
|
237
237
|
</p>
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
<div dbxAction dbxActionSnackbarError [dbxActionHandler]="approveHandler()">
|
|
241
|
-
<dbx-injection [config]="
|
|
241
|
+
<dbx-injection [config]="resolvedScopeInjectionConfigSignal()"></dbx-injection>
|
|
242
242
|
|
|
243
243
|
<div class="dbx-pt3 dbx-pb3 dbx-firebase-oauth-consent-actions">
|
|
244
244
|
<dbx-button dbxActionButton text="Approve" [raised]="true" color="primary"></dbx-button>
|
|
@@ -401,7 +401,7 @@ const OAUTH_CONSENT_SCOPES_REQUIRED_VALIDATOR_KIND = 'mustSelectAtLeastOneScope'
|
|
|
401
401
|
/**
|
|
402
402
|
* Default message shown when the user has cleared every optional scope.
|
|
403
403
|
*/
|
|
404
|
-
const
|
|
404
|
+
const DEFAULT_OAUTH_CONSENT_SCOPES_REQUIRED_VALIDATOR_MESSAGE = 'Select at least one scope to grant.';
|
|
405
405
|
/**
|
|
406
406
|
* Builds a complete `FormConfig` ready to feed into a forge form component.
|
|
407
407
|
*
|
|
@@ -432,7 +432,7 @@ function oauthConsentScopesFormConfig(config) {
|
|
|
432
432
|
value,
|
|
433
433
|
validators,
|
|
434
434
|
validationMessages: {
|
|
435
|
-
[OAUTH_CONSENT_SCOPES_REQUIRED_VALIDATOR_KIND]:
|
|
435
|
+
[OAUTH_CONSENT_SCOPES_REQUIRED_VALIDATOR_KIND]: DEFAULT_OAUTH_CONSENT_SCOPES_REQUIRED_VALIDATOR_MESSAGE
|
|
436
436
|
},
|
|
437
437
|
props: {
|
|
438
438
|
listComponentClass: of(DbxFirebaseOAuthConsentScopeListComponent),
|
|
@@ -591,7 +591,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
591
591
|
class DbxFirebaseOAuthConsentScopeDefaultViewComponent {
|
|
592
592
|
_oidcConfigService = inject(DbxFirebaseOidcConfigService);
|
|
593
593
|
_data = inject(DBX_INJECTION_COMPONENT_DATA);
|
|
594
|
-
|
|
594
|
+
mappedScopesSignal = computed(() => {
|
|
595
595
|
const availableScopes = this._oidcConfigService.availableScopes;
|
|
596
596
|
const availableScopeValues = new Set(availableScopes.map((s) => s.value));
|
|
597
597
|
const { included: knownScopes, excluded: unknownScopes } = separateValues(this._data.scopes, (name) => availableScopeValues.has(name));
|
|
@@ -602,24 +602,24 @@ class DbxFirebaseOAuthConsentScopeDefaultViewComponent {
|
|
|
602
602
|
}),
|
|
603
603
|
...unknownScopes.map((name) => ({ name, description: 'unknown' }))
|
|
604
604
|
];
|
|
605
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
606
|
-
|
|
605
|
+
}, ...(ngDevMode ? [{ debugName: "mappedScopesSignal" }] : /* istanbul ignore next */ []));
|
|
606
|
+
optionalScopesSignal = computed(() => {
|
|
607
607
|
const requiredSet = new Set(this._data.requiredScopes ?? []);
|
|
608
|
-
return this.
|
|
609
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
610
|
-
|
|
608
|
+
return this.mappedScopesSignal().filter((scope) => !requiredSet.has(scope.name));
|
|
609
|
+
}, ...(ngDevMode ? [{ debugName: "optionalScopesSignal" }] : /* istanbul ignore next */ []));
|
|
610
|
+
alwaysGrantedLabelSignal = computed(() => {
|
|
611
611
|
const required = this._data.requiredScopes ?? [];
|
|
612
612
|
return required.length > 0 ? required.join(', ') : null;
|
|
613
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
614
|
-
|
|
615
|
-
optionalScopes: this.
|
|
616
|
-
}), ...(ngDevMode ? [{ debugName: "
|
|
613
|
+
}, ...(ngDevMode ? [{ debugName: "alwaysGrantedLabelSignal" }] : /* istanbul ignore next */ []));
|
|
614
|
+
formFieldsConfigSignal = computed(() => ({
|
|
615
|
+
optionalScopes: this.optionalScopesSignal()
|
|
616
|
+
}), ...(ngDevMode ? [{ debugName: "formFieldsConfigSignal" }] : /* istanbul ignore next */ []));
|
|
617
617
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebaseOAuthConsentScopeDefaultViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
618
618
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxFirebaseOAuthConsentScopeDefaultViewComponent, isStandalone: true, selector: "dbx-firebase-oauth-consent-scope-default-view", ngImport: i0, template: `
|
|
619
|
-
@if (
|
|
619
|
+
@if (alwaysGrantedLabelSignal(); as label) {
|
|
620
620
|
<p class="dbx-firebase-oauth-consent-always-granted dbx-hint">Always granted: {{ label }}</p>
|
|
621
621
|
}
|
|
622
|
-
<dbx-firebase-oauth-consent-scope-form dbxActionForm [config]="
|
|
622
|
+
<dbx-firebase-oauth-consent-scope-form dbxActionForm [config]="formFieldsConfigSignal()"></dbx-firebase-oauth-consent-scope-form>
|
|
623
623
|
`, isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseOAuthConsentScopeFormComponent, selector: "dbx-firebase-oauth-consent-scope-form" }, { kind: "directive", type: DbxActionFormDirective, selector: "[dbxActionForm]", inputs: ["dbxActionFormDisabledOnWorking", "dbxActionFormIsValid", "dbxActionFormIsEqual", "dbxActionFormIsModified", "dbxActionFormMapValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
624
624
|
}
|
|
625
625
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebaseOAuthConsentScopeDefaultViewComponent, decorators: [{
|
|
@@ -627,10 +627,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
627
627
|
args: [{
|
|
628
628
|
selector: 'dbx-firebase-oauth-consent-scope-default-view',
|
|
629
629
|
template: `
|
|
630
|
-
@if (
|
|
630
|
+
@if (alwaysGrantedLabelSignal(); as label) {
|
|
631
631
|
<p class="dbx-firebase-oauth-consent-always-granted dbx-hint">Always granted: {{ label }}</p>
|
|
632
632
|
}
|
|
633
|
-
<dbx-firebase-oauth-consent-scope-form dbxActionForm [config]="
|
|
633
|
+
<dbx-firebase-oauth-consent-scope-form dbxActionForm [config]="formFieldsConfigSignal()"></dbx-firebase-oauth-consent-scope-form>
|
|
634
634
|
`,
|
|
635
635
|
imports: [DbxFirebaseOAuthConsentScopeFormComponent, DbxActionFormDirective],
|
|
636
636
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -722,26 +722,33 @@ class DbxFirebaseOAuthLoginComponent {
|
|
|
722
722
|
isLoggedIn = toSignal(this.dbxFirebaseAuthService.isLoggedIn$);
|
|
723
723
|
submitting = signal(false, ...(ngDevMode ? [{ debugName: "submitting" }] : /* istanbul ignore next */ []));
|
|
724
724
|
errorMessage = signal(null, ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
725
|
-
|
|
725
|
+
loginStateCaseSignal = computed(() => {
|
|
726
|
+
const errorMessage = this.errorMessage();
|
|
727
|
+
const isLoggedIn = this.isLoggedIn();
|
|
728
|
+
let result;
|
|
726
729
|
if (this.submitting()) {
|
|
727
|
-
|
|
728
|
-
}
|
|
729
|
-
if (this.errorMessage()) {
|
|
730
|
-
return 'error';
|
|
730
|
+
result = 'submitting';
|
|
731
731
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
return 'unknown';
|
|
732
|
+
else if (errorMessage) {
|
|
733
|
+
result = 'error';
|
|
735
734
|
}
|
|
736
|
-
|
|
737
|
-
|
|
735
|
+
else {
|
|
736
|
+
if (isLoggedIn === undefined) {
|
|
737
|
+
result = 'unknown';
|
|
738
|
+
}
|
|
739
|
+
else if (isLoggedIn) {
|
|
740
|
+
result = 'user';
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
result = 'no_user';
|
|
744
|
+
}
|
|
738
745
|
}
|
|
739
|
-
return
|
|
740
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
746
|
+
return result;
|
|
747
|
+
}, ...(ngDevMode ? [{ debugName: "loginStateCaseSignal" }] : /* istanbul ignore next */ []));
|
|
741
748
|
constructor() {
|
|
742
749
|
// Auto-submit when user is logged in
|
|
743
750
|
effect(() => {
|
|
744
|
-
if (this.
|
|
751
|
+
if (this.loginStateCaseSignal() === 'user') {
|
|
745
752
|
this._submitIdToken();
|
|
746
753
|
}
|
|
747
754
|
});
|
|
@@ -780,7 +787,7 @@ class DbxFirebaseOAuthLoginComponent {
|
|
|
780
787
|
}
|
|
781
788
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebaseOAuthLoginComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
782
789
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: DbxFirebaseOAuthLoginComponent, isStandalone: true, selector: "dbx-firebase-oauth-login", host: { classAttribute: "d-block dbx-firebase-oauth-login" }, ngImport: i0, template: `
|
|
783
|
-
<dbx-firebase-oauth-login-view [loginStateCase]="
|
|
790
|
+
<dbx-firebase-oauth-login-view [loginStateCase]="loginStateCaseSignal()" [error]="errorMessage()" (retryClick)="retry()">
|
|
784
791
|
<ng-content />
|
|
785
792
|
</dbx-firebase-oauth-login-view>
|
|
786
793
|
`, isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseOAuthLoginViewComponent, selector: "dbx-firebase-oauth-login-view", inputs: ["loginStateCase", "error"], outputs: ["retryClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -792,7 +799,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
792
799
|
standalone: true,
|
|
793
800
|
imports: [DbxFirebaseOAuthLoginViewComponent],
|
|
794
801
|
template: `
|
|
795
|
-
<dbx-firebase-oauth-login-view [loginStateCase]="
|
|
802
|
+
<dbx-firebase-oauth-login-view [loginStateCase]="loginStateCaseSignal()" [error]="errorMessage()" (retryClick)="retry()">
|
|
796
803
|
<ng-content />
|
|
797
804
|
</dbx-firebase-oauth-login-view>
|
|
798
805
|
`,
|
|
@@ -847,8 +854,8 @@ class DbxOAuthConsentComponent {
|
|
|
847
854
|
// Auth state — undefined until Firebase resolves to avoid a flash between 'unknown' → 'no_user'/'user'
|
|
848
855
|
isLoggedIn = toSignal(this.dbxFirebaseAuthService.isLoggedIn$);
|
|
849
856
|
// Resolved values
|
|
850
|
-
|
|
851
|
-
|
|
857
|
+
resolvedInteractionUidSignal = computed(() => this.routeUid(), ...(ngDevMode ? [{ debugName: "resolvedInteractionUidSignal" }] : /* istanbul ignore next */ []));
|
|
858
|
+
resolvedDetailsSignal = computed(() => {
|
|
852
859
|
const client_id = this.routeClientId() ?? '';
|
|
853
860
|
const client_name = this.routeClientName();
|
|
854
861
|
const client_uri = this.routeClientUri();
|
|
@@ -861,26 +868,30 @@ class DbxOAuthConsentComponent {
|
|
|
861
868
|
logo_uri,
|
|
862
869
|
scopes
|
|
863
870
|
};
|
|
864
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
871
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedDetailsSignal" }] : /* istanbul ignore next */ []));
|
|
865
872
|
// Scope injection config: built from the configured scope list view class, falling back to config service, then the default
|
|
866
|
-
|
|
873
|
+
scopeInjectionConfigSignal = computed(() => ({
|
|
867
874
|
componentClass: this.config()?.consentScopeListViewClass ?? this.oidcConfigService.consentScopeListViewClass ?? DbxFirebaseOAuthConsentScopeDefaultViewComponent
|
|
868
|
-
}), ...(ngDevMode ? [{ debugName: "
|
|
875
|
+
}), ...(ngDevMode ? [{ debugName: "scopeInjectionConfigSignal" }] : /* istanbul ignore next */ []));
|
|
869
876
|
/**
|
|
870
877
|
* Scopes the user cannot deselect. Forwarded to the view, which shows
|
|
871
878
|
* them as a static "Always granted" hint above the selection list.
|
|
872
879
|
*/
|
|
873
880
|
requiredScopes = OAUTH_CONSENT_REQUIRED_SCOPES;
|
|
874
|
-
|
|
881
|
+
consentStateCaseSignal = computed(() => {
|
|
875
882
|
const isLoggedIn = this.isLoggedIn();
|
|
883
|
+
let result;
|
|
876
884
|
if (isLoggedIn === undefined) {
|
|
877
|
-
|
|
885
|
+
result = 'unknown';
|
|
878
886
|
}
|
|
879
|
-
if (
|
|
880
|
-
|
|
887
|
+
else if (isLoggedIn) {
|
|
888
|
+
result = 'user';
|
|
881
889
|
}
|
|
882
|
-
|
|
883
|
-
|
|
890
|
+
else {
|
|
891
|
+
result = 'no_user';
|
|
892
|
+
}
|
|
893
|
+
return result;
|
|
894
|
+
}, ...(ngDevMode ? [{ debugName: "consentStateCaseSignal" }] : /* istanbul ignore next */ []));
|
|
884
895
|
ngOnDestroy() {
|
|
885
896
|
this.interactionUidParamReader.destroy();
|
|
886
897
|
this.clientIdParamReader.destroy();
|
|
@@ -894,9 +905,12 @@ class DbxOAuthConsentComponent {
|
|
|
894
905
|
* straight off the form value (it already matches the API field name
|
|
895
906
|
* `grantedOIDCScopes`) and forwards it through `submitConsent`. On a
|
|
896
907
|
* successful response, hard-navigates to the OIDC server's redirect URL.
|
|
908
|
+
*
|
|
909
|
+
* @param formValue - Submitted form value containing the granted scope array.
|
|
910
|
+
* @param context - The Work context driving the approval flow.
|
|
897
911
|
*/
|
|
898
912
|
handleApprove = (formValue, context) => {
|
|
899
|
-
const uid = this.
|
|
913
|
+
const uid = this.resolvedInteractionUidSignal();
|
|
900
914
|
if (!uid) {
|
|
901
915
|
context.reject(new Error('Missing interaction UID'));
|
|
902
916
|
return;
|
|
@@ -911,9 +925,12 @@ class DbxOAuthConsentComponent {
|
|
|
911
925
|
/**
|
|
912
926
|
* Handles the Deny action. No payload is sent — the server returns
|
|
913
927
|
* `access_denied` to the OAuth client.
|
|
928
|
+
*
|
|
929
|
+
* @param _value - Unused form payload.
|
|
930
|
+
* @param context - The Work context driving the denial flow.
|
|
914
931
|
*/
|
|
915
932
|
handleDeny = (_value, context) => {
|
|
916
|
-
const uid = this.
|
|
933
|
+
const uid = this.resolvedInteractionUidSignal();
|
|
917
934
|
if (!uid) {
|
|
918
935
|
context.reject(new Error('Missing interaction UID'));
|
|
919
936
|
return;
|
|
@@ -926,7 +943,7 @@ class DbxOAuthConsentComponent {
|
|
|
926
943
|
};
|
|
927
944
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxOAuthConsentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
928
945
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.11", type: DbxOAuthConsentComponent, isStandalone: true, selector: "dbx-firebase-oauth-consent", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "d-block dbx-firebase-oauth-consent" }, ngImport: i0, template: `
|
|
929
|
-
<dbx-firebase-oauth-consent-view [details]="
|
|
946
|
+
<dbx-firebase-oauth-consent-view [details]="resolvedDetailsSignal()" [consentStateCase]="consentStateCaseSignal()" [scopeInjectionConfig]="scopeInjectionConfigSignal()" [requiredScopes]="requiredScopes" [approveHandler]="handleApprove" [denyHandler]="handleDeny">
|
|
930
947
|
<ng-content />
|
|
931
948
|
</dbx-firebase-oauth-consent-view>
|
|
932
949
|
`, isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseOAuthConsentViewComponent, selector: "dbx-firebase-oauth-consent-view", inputs: ["details", "consentStateCase", "scopeInjectionConfig", "requiredScopes", "approveHandler", "denyHandler"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -938,7 +955,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
938
955
|
standalone: true,
|
|
939
956
|
imports: [DbxFirebaseOAuthConsentViewComponent],
|
|
940
957
|
template: `
|
|
941
|
-
<dbx-firebase-oauth-consent-view [details]="
|
|
958
|
+
<dbx-firebase-oauth-consent-view [details]="resolvedDetailsSignal()" [consentStateCase]="consentStateCaseSignal()" [scopeInjectionConfig]="scopeInjectionConfigSignal()" [requiredScopes]="requiredScopes" [approveHandler]="handleApprove" [denyHandler]="handleDeny">
|
|
942
959
|
<ng-content />
|
|
943
960
|
</dbx-firebase-oauth-consent-view>
|
|
944
961
|
`,
|
|
@@ -1159,13 +1176,17 @@ function oidcClientTestScopesForgeField(availableScopes) {
|
|
|
1159
1176
|
class DbxFirebaseOidcEntryClientForgeFormComponent extends AbstractConfigAsyncForgeFormDirective {
|
|
1160
1177
|
_oidcConfigService = inject(DbxFirebaseOidcConfigService);
|
|
1161
1178
|
formConfig$ = this.currentConfig$.pipe(map((config) => {
|
|
1162
|
-
|
|
1163
|
-
|
|
1179
|
+
let result;
|
|
1180
|
+
if (config) {
|
|
1181
|
+
result = oidcEntryClientForgeFormFields({
|
|
1182
|
+
...config,
|
|
1183
|
+
tokenEndpointAuthMethods: this._oidcConfigService.tokenEndpointAuthMethods
|
|
1184
|
+
});
|
|
1164
1185
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1186
|
+
else {
|
|
1187
|
+
result = undefined;
|
|
1188
|
+
}
|
|
1189
|
+
return result;
|
|
1169
1190
|
}));
|
|
1170
1191
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebaseOidcEntryClientForgeFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1171
1192
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.11", type: DbxFirebaseOidcEntryClientForgeFormComponent, isStandalone: true, selector: "dbx-firebase-oidc-client-forge-form", providers: dbxForgeFormComponentProviders(), usesInheritance: true, ngImport: i0, template: "<dbx-forge></dbx-forge>", isInline: true, dependencies: [{ kind: "ngmodule", type: DbxForgeFormComponentImportsModule }, { kind: "component", type: i1$1.DbxForgeFormComponent, selector: "dbx-forge" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
@@ -1630,18 +1651,18 @@ class DbxFirebaseOidcEntryClientTestComponent {
|
|
|
1630
1651
|
* Path to the authorization endpoint. Overrides the service default when provided.
|
|
1631
1652
|
*/
|
|
1632
1653
|
oidcAuthorizationEndpointApiPath = input(undefined, ...(ngDevMode ? [{ debugName: "oidcAuthorizationEndpointApiPath" }] : /* istanbul ignore next */ []));
|
|
1633
|
-
|
|
1634
|
-
|
|
1654
|
+
resolvedAvailableScopesSignal = computed(() => this.availableScopes() ?? this.oidcConfigService.availableScopes, ...(ngDevMode ? [{ debugName: "resolvedAvailableScopesSignal" }] : /* istanbul ignore next */ []));
|
|
1655
|
+
resolvedAuthorizationEndpointPathSignal = computed(() => this.oidcAuthorizationEndpointApiPath() ?? this.oidcConfigService.oidcAuthorizationEndpointApiPath, ...(ngDevMode ? [{ debugName: "resolvedAuthorizationEndpointPathSignal" }] : /* istanbul ignore next */ []));
|
|
1635
1656
|
// MARK: Derived Store Data
|
|
1636
1657
|
redirectUrisSignal = toSignal(this.oidcEntryDocumentStore.data$.pipe(map((data) => data.payload?.redirect_uris ?? [])));
|
|
1637
1658
|
clientIdSignal = toSignal(this.oidcEntryDocumentStore.data$.pipe(map((data) => data.payload?.client_id)));
|
|
1638
1659
|
// MARK: Form Config
|
|
1639
|
-
|
|
1660
|
+
formConfigSignal = computed(() => {
|
|
1640
1661
|
const redirectUris = this.redirectUrisSignal() ?? [];
|
|
1641
|
-
const availableScopes = this.
|
|
1662
|
+
const availableScopes = this.resolvedAvailableScopesSignal();
|
|
1642
1663
|
console.log('formConfig:', { redirectUris, availableScopes });
|
|
1643
1664
|
return { redirectUris, availableScopes };
|
|
1644
|
-
}, ...(ngDevMode ? [{ debugName: "
|
|
1665
|
+
}, ...(ngDevMode ? [{ debugName: "formConfigSignal" }] : /* istanbul ignore next */ []));
|
|
1645
1666
|
formTemplate$ = this.oidcEntryDocumentStore.data$.pipe(map((data) => {
|
|
1646
1667
|
const payload = data.payload;
|
|
1647
1668
|
const formValue = {
|
|
@@ -1661,25 +1682,30 @@ class DbxFirebaseOidcEntryClientTestComponent {
|
|
|
1661
1682
|
*/
|
|
1662
1683
|
formValue = signal(undefined, ...(ngDevMode ? [{ debugName: "formValue" }] : /* istanbul ignore next */ []));
|
|
1663
1684
|
authorizationUrlSignal = computed(() => {
|
|
1685
|
+
const resolvedAuthorizationEndpointPath = this.resolvedAuthorizationEndpointPathSignal();
|
|
1664
1686
|
const clientId = this.clientIdSignal();
|
|
1665
1687
|
const codeChallenge = this.codeChallenge();
|
|
1666
1688
|
const state = this.state();
|
|
1667
1689
|
const nonce = this.nonce();
|
|
1668
1690
|
const formValue = this.formValue();
|
|
1691
|
+
let result;
|
|
1669
1692
|
if (!clientId || !codeChallenge || !formValue?.redirect_uri) {
|
|
1670
|
-
|
|
1693
|
+
result = undefined;
|
|
1671
1694
|
}
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1695
|
+
else {
|
|
1696
|
+
const params = new URLSearchParams({
|
|
1697
|
+
response_type: 'code',
|
|
1698
|
+
client_id: clientId,
|
|
1699
|
+
redirect_uri: formValue.redirect_uri,
|
|
1700
|
+
scope: (formValue.scopes ?? ['openid']).join(' '),
|
|
1701
|
+
state,
|
|
1702
|
+
nonce,
|
|
1703
|
+
code_challenge: codeChallenge,
|
|
1704
|
+
code_challenge_method: 'S256'
|
|
1705
|
+
});
|
|
1706
|
+
result = `${resolvedAuthorizationEndpointPath}?${params.toString()}`;
|
|
1707
|
+
}
|
|
1708
|
+
return result;
|
|
1683
1709
|
}, ...(ngDevMode ? [{ debugName: "authorizationUrlSignal" }] : /* istanbul ignore next */ []));
|
|
1684
1710
|
constructor() {
|
|
1685
1711
|
this._updateCodeChallenge();
|
|
@@ -1706,8 +1732,8 @@ class DbxFirebaseOidcEntryClientTestComponent {
|
|
|
1706
1732
|
}
|
|
1707
1733
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxFirebaseOidcEntryClientTestComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1708
1734
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.11", type: DbxFirebaseOidcEntryClientTestComponent, isStandalone: true, selector: "dbx-firebase-oidc-entry-client-test", inputs: { availableScopes: { classPropertyName: "availableScopes", publicName: "availableScopes", isSignal: true, isRequired: false, transformFunction: null }, oidcAuthorizationEndpointApiPath: { classPropertyName: "oidcAuthorizationEndpointApiPath", publicName: "oidcAuthorizationEndpointApiPath", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
|
1709
|
-
@if (
|
|
1710
|
-
<dbx-firebase-oidc-client-test-forge-form [dbxFormSource]="formTemplate$" dbxFormSourceMode="always" [config]="
|
|
1735
|
+
@if (formConfigSignal()) {
|
|
1736
|
+
<dbx-firebase-oidc-client-test-forge-form [dbxFormSource]="formTemplate$" dbxFormSourceMode="always" [config]="formConfigSignal()" (dbxFormValueChange)="onFormValueChange($event)"></dbx-firebase-oidc-client-test-forge-form>
|
|
1711
1737
|
<dbx-content-pit class="dbx-block dbx-mb3" [rounded]="true">
|
|
1712
1738
|
<dbx-detail-block class="dbx-pb4" icon="link" header="Authorization URL">
|
|
1713
1739
|
@if (authorizationUrlSignal()) {
|
|
@@ -1734,8 +1760,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
1734
1760
|
args: [{
|
|
1735
1761
|
selector: 'dbx-firebase-oidc-entry-client-test',
|
|
1736
1762
|
template: `
|
|
1737
|
-
@if (
|
|
1738
|
-
<dbx-firebase-oidc-client-test-forge-form [dbxFormSource]="formTemplate$" dbxFormSourceMode="always" [config]="
|
|
1763
|
+
@if (formConfigSignal()) {
|
|
1764
|
+
<dbx-firebase-oidc-client-test-forge-form [dbxFormSource]="formTemplate$" dbxFormSourceMode="always" [config]="formConfigSignal()" (dbxFormValueChange)="onFormValueChange($event)"></dbx-firebase-oidc-client-test-forge-form>
|
|
1739
1765
|
<dbx-content-pit class="dbx-block dbx-mb3" [rounded]="true">
|
|
1740
1766
|
<dbx-detail-block class="dbx-pb4" icon="link" header="Authorization URL">
|
|
1741
1767
|
@if (authorizationUrlSignal()) {
|
|
@@ -1903,6 +1929,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
|
|
|
1903
1929
|
*
|
|
1904
1930
|
* @param appCollection - The application's Firestore collection that must implement {@link OidcModelFirestoreCollections}.
|
|
1905
1931
|
* @returns The validated OidcModelFirestoreCollections instance.
|
|
1932
|
+
* @throws {Error} When `appCollection` does not expose an `oidcEntryCollection`.
|
|
1906
1933
|
*/
|
|
1907
1934
|
function provideOidcModelFirestoreCollections(appCollection) {
|
|
1908
1935
|
if (!appCollection.oidcEntryCollection) {
|
|
@@ -1946,5 +1973,5 @@ function provideDbxFirebaseOidc(config) {
|
|
|
1946
1973
|
* Generated bundle index. Do not edit.
|
|
1947
1974
|
*/
|
|
1948
1975
|
|
|
1949
|
-
export { AbstractDbxFirebaseOAuthConsentScopeViewComponent, DEFAULT_OIDC_AUTHORIZATION_ENDPOINT_PATH, DEFAULT_OIDC_CLIENT_ID_PARAM_KEY, DEFAULT_OIDC_CLIENT_NAME_PARAM_KEY, DEFAULT_OIDC_CLIENT_URI_PARAM_KEY, DEFAULT_OIDC_INTERACTION_ENDPOINT_PATH, DEFAULT_OIDC_INTERACTION_UID_PARAM_KEY, DEFAULT_OIDC_LOGO_URI_PARAM_KEY, DEFAULT_OIDC_SCOPES_PARAM_KEY, DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS, DbxFirebaseOAuthConsentScopeDefaultViewComponent, DbxFirebaseOAuthConsentScopeFormComponent, DbxFirebaseOAuthConsentScopeListComponent, DbxFirebaseOAuthConsentScopeListItemComponent, DbxFirebaseOAuthConsentScopeListViewComponent, DbxFirebaseOAuthConsentViewComponent, DbxFirebaseOAuthLoginComponent, DbxFirebaseOAuthLoginViewComponent, DbxFirebaseOidcConfig, DbxFirebaseOidcConfigService, DbxFirebaseOidcEntryClientCreateComponent, DbxFirebaseOidcEntryClientForgeFormComponent, DbxFirebaseOidcEntryClientListComponent, DbxFirebaseOidcEntryClientListViewComponent, DbxFirebaseOidcEntryClientListViewItemClientComponent, DbxFirebaseOidcEntryClientListViewItemComponent, DbxFirebaseOidcEntryClientListViewItemDefaultComponent, DbxFirebaseOidcEntryClientTestComponent, DbxFirebaseOidcEntryClientTestForgeFormComponent, DbxFirebaseOidcEntryClientUpdateComponent, DbxFirebaseOidcEntryClientViewComponent, DbxFirebaseOidcEntryGrantListComponent, DbxFirebaseOidcEntryGrantListContainerComponent, DbxFirebaseOidcEntryGrantListViewComponent, DbxFirebaseOidcEntryGrantListViewItemComponent, DbxFirebaseOidcInteractionService, DbxOAuthConsentComponent,
|
|
1976
|
+
export { AbstractDbxFirebaseOAuthConsentScopeViewComponent, DEFAULT_OAUTH_CONSENT_SCOPES_REQUIRED_VALIDATOR_MESSAGE, DEFAULT_OIDC_AUTHORIZATION_ENDPOINT_PATH, DEFAULT_OIDC_CLIENT_ID_PARAM_KEY, DEFAULT_OIDC_CLIENT_NAME_PARAM_KEY, DEFAULT_OIDC_CLIENT_URI_PARAM_KEY, DEFAULT_OIDC_INTERACTION_ENDPOINT_PATH, DEFAULT_OIDC_INTERACTION_UID_PARAM_KEY, DEFAULT_OIDC_LOGO_URI_PARAM_KEY, DEFAULT_OIDC_SCOPES_PARAM_KEY, DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS, DbxFirebaseOAuthConsentScopeDefaultViewComponent, DbxFirebaseOAuthConsentScopeFormComponent, DbxFirebaseOAuthConsentScopeListComponent, DbxFirebaseOAuthConsentScopeListItemComponent, DbxFirebaseOAuthConsentScopeListViewComponent, DbxFirebaseOAuthConsentViewComponent, DbxFirebaseOAuthLoginComponent, DbxFirebaseOAuthLoginViewComponent, DbxFirebaseOidcConfig, DbxFirebaseOidcConfigService, DbxFirebaseOidcEntryClientCreateComponent, DbxFirebaseOidcEntryClientForgeFormComponent, DbxFirebaseOidcEntryClientListComponent, DbxFirebaseOidcEntryClientListViewComponent, DbxFirebaseOidcEntryClientListViewItemClientComponent, DbxFirebaseOidcEntryClientListViewItemComponent, DbxFirebaseOidcEntryClientListViewItemDefaultComponent, DbxFirebaseOidcEntryClientTestComponent, DbxFirebaseOidcEntryClientTestForgeFormComponent, DbxFirebaseOidcEntryClientUpdateComponent, DbxFirebaseOidcEntryClientViewComponent, DbxFirebaseOidcEntryGrantListComponent, DbxFirebaseOidcEntryGrantListContainerComponent, DbxFirebaseOidcEntryGrantListViewComponent, DbxFirebaseOidcEntryGrantListViewItemComponent, DbxFirebaseOidcInteractionService, DbxOAuthConsentComponent, OAUTH_CONSENT_SCOPES_REQUIRED_VALIDATOR_KIND, OidcEntryCollectionStore, OidcEntryCollectionStoreDirective, OidcEntryDocumentStore, OidcEntryDocumentStoreDirective, oauthConsentScopesFormConfig, oidcClientHomepageUriForgeField, oidcClientJwksUriForgeField, oidcClientLogoUriForgeField, oidcClientNameForgeField, oidcClientRedirectUrisForgeField, oidcClientTestClientIdForgeField, oidcClientTestRedirectUriForgeField, oidcClientTestScopesForgeField, oidcClientTokenEndpointAuthMethodForgeField, oidcEntryClientForgeFormFields, oidcEntryClientTestForgeFormFields, oidcEntryClientUpdateForgeFormFields, provideDbxFirebaseOidc, provideOidcModelFirestoreCollections };
|
|
1950
1977
|
//# sourceMappingURL=dereekb-dbx-firebase-oidc.mjs.map
|