@dereekb/dbx-firebase 13.28.0 → 13.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ import { readableError, SPACE_STRING_SPLIT_JOIN, separateValues, generatePkceCod
6
6
  import { DbxInjectionComponent, DbxActionDirective, DbxActionHandlerDirective, DbxActionValueDirective, DbxActionButtonDirective, DBX_INJECTION_COMPONENT_DATA, DbxRouterService, clean, dbxRouteParamReaderInstance, completeOnDestroy, DbxActionEnforceModifiedDirective, DbxAppAuthRouterService } from '@dereekb/dbx-core';
7
7
  import { of, map, first, switchMap, tap, BehaviorSubject } from 'rxjs';
8
8
  import * as i1$1 from '@dereekb/dbx-form';
9
- import { dbxForgeListSelectionField, AbstractConfigAsyncForgeFormDirective, DbxForgeFormComponentImportsModule, dbxForgeFormComponentProviders, DBX_FORGE_FORM_COMPONENT_TEMPLATE, DbxActionFormDirective, dbxForgeValueSelectionField, dbxForgeTextField, dbxForgeSearchableStringChipField, isWebsiteUrlValidator, dbxForgeContainer, dbxForgePickableChipField, pickableValueFieldValuesConfigForStaticLabeledValues, DbxFormSourceDirective, DbxFormValueChangeDirective } from '@dereekb/dbx-form';
9
+ import { dbxForgeListSelectionField, AbstractConfigAsyncForgeFormDirective, DbxForgeFormComponentImportsModule, dbxForgeFormComponentProviders, DBX_FORGE_FORM_COMPONENT_TEMPLATE, DbxActionFormDirective, dbxForgePickableChipField, pickableValueFieldValuesConfigForStaticLabeledValues, dbxForgeValueSelectionField, dbxForgeTextField, dbxForgeSearchableStringChipField, isWebsiteUrlValidator, dbxForgeContainer, DbxFormSourceDirective, DbxFormValueChangeDirective } from '@dereekb/dbx-form';
10
10
  import { successResult } from '@dereekb/rxjs';
11
11
  import { toSignal } from '@angular/core/rxjs-interop';
12
12
  import { DbxFirebaseAuthService, AbstractDbxFirebaseDocumentStore, firebaseDocumentStoreCreateFunction, firebaseDocumentStoreUpdateFunction, firebaseDocumentStoreDeleteFunction, AbstractDbxFirebaseCollectionStore, DbxFirebaseCollectionStoreDirective, provideDbxFirebaseCollectionStoreDirective, DbxFirebaseCollectionListDirective, DbxFirebaseCollectionChangeDirective, DbxFirebaseDocumentStoreDirective, provideDbxFirebaseDocumentStoreDirective } from '@dereekb/dbx-firebase';
@@ -480,6 +480,7 @@ const DEFAULT_OIDC_CLIENT_NAME_PARAM_KEY = 'client_name';
480
480
  const DEFAULT_OIDC_CLIENT_URI_PARAM_KEY = 'client_uri';
481
481
  const DEFAULT_OIDC_LOGO_URI_PARAM_KEY = 'logo_uri';
482
482
  const DEFAULT_OIDC_SCOPES_PARAM_KEY = 'scopes';
483
+ const DEFAULT_OIDC_REQUIRED_SCOPES_PARAM_KEY = 'requiredScopes';
483
484
  const DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS = ['client_secret_post', 'client_secret_basic'];
484
485
  /**
485
486
  * Abstract configuration class used as a DI token for app-level OIDC settings.
@@ -487,6 +488,11 @@ const DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS = ['client_secret_post', 'client_
487
488
  * Apps provide a concrete implementation via `provideDbxFirebaseOidc()`.
488
489
  */
489
490
  class DbxFirebaseOidcConfig {
491
+ /**
492
+ * Available provider profiles for admin assignment on the client form. When set, the client form
493
+ * renders a provider-profile multi-select. Leave unset when the app defines no provider profiles.
494
+ */
495
+ availableProviderProfiles;
490
496
  /**
491
497
  * Optional API origin (scheme + host, e.g. `https://api.example.com`) prepended to the OIDC
492
498
  * authorization and interaction endpoint paths when set.
@@ -543,6 +549,9 @@ class DbxFirebaseOidcConfigService {
543
549
  get availableScopes() {
544
550
  return this.config.availableScopes;
545
551
  }
552
+ get availableProviderProfiles() {
553
+ return this.config.availableProviderProfiles;
554
+ }
546
555
  get oidcAuthorizationEndpointApiPath() {
547
556
  const origin = this.config.oidcApiOrigin ?? '';
548
557
  return `${origin}${this.config.oidcAuthorizationEndpointApiPath ?? DEFAULT_OIDC_AUTHORIZATION_ENDPOINT_PATH}`;
@@ -841,6 +850,7 @@ class DbxOAuthConsentComponent {
841
850
  clientUriParamReader = dbxRouteParamReaderInstance(this.dbxRouterService, DEFAULT_OIDC_CLIENT_URI_PARAM_KEY);
842
851
  logoUriParamReader = dbxRouteParamReaderInstance(this.dbxRouterService, DEFAULT_OIDC_LOGO_URI_PARAM_KEY);
843
852
  scopesParamReader = dbxRouteParamReaderInstance(this.dbxRouterService, DEFAULT_OIDC_SCOPES_PARAM_KEY);
853
+ requiredScopesParamReader = dbxRouteParamReaderInstance(this.dbxRouterService, DEFAULT_OIDC_REQUIRED_SCOPES_PARAM_KEY);
844
854
  // Signals from route params
845
855
  routeUid = toSignal(this.interactionUidParamReader.value$);
846
856
  routeClientId = toSignal(this.clientIdParamReader.value$);
@@ -848,6 +858,7 @@ class DbxOAuthConsentComponent {
848
858
  routeClientUri = toSignal(this.clientUriParamReader.value$);
849
859
  routeLogoUri = toSignal(this.logoUriParamReader.value$);
850
860
  routeScopes = toSignal(this.scopesParamReader.value$);
861
+ routeRequiredScopes = toSignal(this.requiredScopesParamReader.value$);
851
862
  // Auth state — undefined until Firebase resolves to avoid a flash between 'unknown' → 'no_user'/'user'
852
863
  isLoggedIn = toSignal(this.dbxFirebaseAuthService.isLoggedIn$);
853
864
  // Resolved values
@@ -871,10 +882,15 @@ class DbxOAuthConsentComponent {
871
882
  componentClass: this.config()?.consentScopeListViewClass ?? this.oidcConfigService.consentScopeListViewClass ?? DbxFirebaseOAuthConsentScopeDefaultViewComponent
872
883
  }), ...(ngDevMode ? [{ debugName: "scopeInjectionConfigSignal" }] : /* istanbul ignore next */ []));
873
884
  /**
874
- * Scopes the user cannot deselect. Forwarded to the view, which shows
875
- * them as a static "Always granted" hint above the selection list.
885
+ * Scopes the user cannot deselect. `openid` is always required; any scopes the client's assigned
886
+ * provider profiles force-require are appended (the server surfaces them via the `requiredScopes`
887
+ * interaction param). Forwarded to the view, which shows them as a static "Always granted" hint
888
+ * above the selection list.
876
889
  */
877
- requiredScopes = OAUTH_CONSENT_REQUIRED_SCOPES;
890
+ requiredScopesSignal = computed(() => {
891
+ const serverRequiredScopes = (this.routeRequiredScopes() ?? '').split(' ').filter(Boolean);
892
+ return Array.from(new Set([...OAUTH_CONSENT_REQUIRED_SCOPES, ...serverRequiredScopes]));
893
+ }, ...(ngDevMode ? [{ debugName: "requiredScopesSignal" }] : /* istanbul ignore next */ []));
878
894
  consentStateCaseSignal = computed(() => {
879
895
  const isLoggedIn = this.isLoggedIn();
880
896
  let result;
@@ -896,6 +912,7 @@ class DbxOAuthConsentComponent {
896
912
  this.clientUriParamReader.destroy();
897
913
  this.logoUriParamReader.destroy();
898
914
  this.scopesParamReader.destroy();
915
+ this.requiredScopesParamReader.destroy();
899
916
  }
900
917
  /**
901
918
  * Handles the Approve action. Pulls the form's selected scope array
@@ -940,7 +957,7 @@ class DbxOAuthConsentComponent {
940
957
  };
941
958
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.11", ngImport: i0, type: DbxOAuthConsentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
942
959
  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: `
943
- <dbx-firebase-oauth-consent-view [details]="resolvedDetailsSignal()" [consentStateCase]="consentStateCaseSignal()" [scopeInjectionConfig]="scopeInjectionConfigSignal()" [requiredScopes]="requiredScopes" [approveHandler]="handleApprove" [denyHandler]="handleDeny">
960
+ <dbx-firebase-oauth-consent-view [details]="resolvedDetailsSignal()" [consentStateCase]="consentStateCaseSignal()" [scopeInjectionConfig]="scopeInjectionConfigSignal()" [requiredScopes]="requiredScopesSignal()" [approveHandler]="handleApprove" [denyHandler]="handleDeny">
944
961
  <ng-content />
945
962
  </dbx-firebase-oauth-consent-view>
946
963
  `, isInline: true, dependencies: [{ kind: "component", type: DbxFirebaseOAuthConsentViewComponent, selector: "dbx-firebase-oauth-consent-view", inputs: ["details", "consentStateCase", "scopeInjectionConfig", "requiredScopes", "approveHandler", "denyHandler"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -952,7 +969,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.11", ngImpo
952
969
  standalone: true,
953
970
  imports: [DbxFirebaseOAuthConsentViewComponent],
954
971
  template: `
955
- <dbx-firebase-oauth-consent-view [details]="resolvedDetailsSignal()" [consentStateCase]="consentStateCaseSignal()" [scopeInjectionConfig]="scopeInjectionConfigSignal()" [requiredScopes]="requiredScopes" [approveHandler]="handleApprove" [denyHandler]="handleDeny">
972
+ <dbx-firebase-oauth-consent-view [details]="resolvedDetailsSignal()" [consentStateCase]="consentStateCaseSignal()" [scopeInjectionConfig]="scopeInjectionConfigSignal()" [requiredScopes]="requiredScopesSignal()" [approveHandler]="handleApprove" [denyHandler]="handleDeny">
956
973
  <ng-content />
957
974
  </dbx-firebase-oauth-consent-view>
958
975
  `,
@@ -977,8 +994,31 @@ function oidcEntryClientForgeFormFields(config) {
977
994
  fields.push(oidcClientTokenEndpointAuthMethodForgeField(config));
978
995
  }
979
996
  fields.push(...oidcEntryClientUpdateForgeFormFields());
997
+ if (config?.providerProfiles?.length) {
998
+ fields.push(oidcClientProviderProfilesForgeField(config.providerProfiles));
999
+ }
980
1000
  return { fields };
981
1001
  }
1002
+ /**
1003
+ * Creates a forge pickable chip field for assigning provider profiles to the client.
1004
+ *
1005
+ * Admin-only in effect: the server strips `dbx_provider_profiles` from non-admin create/update
1006
+ * requests, so a non-admin's selection is ignored.
1007
+ *
1008
+ * @param providerProfiles - The available provider profiles to display as selectable options.
1009
+ * @returns A forge pickable chip field for provider profile assignment.
1010
+ */
1011
+ function oidcClientProviderProfilesForgeField(providerProfiles) {
1012
+ return dbxForgePickableChipField({
1013
+ key: 'dbx_provider_profiles',
1014
+ label: 'Provider Profiles',
1015
+ hint: 'Admin-only. Assign provider profiles to unlock otherwise-restricted scopes for this client.',
1016
+ props: {
1017
+ showSelectAllButton: false,
1018
+ ...pickableValueFieldValuesConfigForStaticLabeledValues(providerProfiles)
1019
+ }
1020
+ });
1021
+ }
982
1022
  /**
983
1023
  * Creates a forge value selection field for choosing the token endpoint authentication method.
984
1024
  *
@@ -1177,7 +1217,8 @@ class DbxFirebaseOidcEntryClientForgeFormComponent extends AbstractConfigAsyncFo
1177
1217
  if (config) {
1178
1218
  result = oidcEntryClientForgeFormFields({
1179
1219
  ...config,
1180
- tokenEndpointAuthMethods: this._oidcConfigService.tokenEndpointAuthMethods
1220
+ tokenEndpointAuthMethods: this._oidcConfigService.tokenEndpointAuthMethods,
1221
+ providerProfiles: this._oidcConfigService.availableProviderProfiles ?? undefined
1181
1222
  });
1182
1223
  }
1183
1224
  else {
@@ -1804,7 +1845,8 @@ class DbxFirebaseOidcEntryClientUpdateComponent {
1804
1845
  client_name: payload.client_name ?? '',
1805
1846
  redirect_uris: payload.redirect_uris ?? [],
1806
1847
  logo_uri: payload.logo_uri,
1807
- client_uri: payload.client_uri
1848
+ client_uri: payload.client_uri,
1849
+ dbx_provider_profiles: payload.dbx_provider_profiles ?? undefined
1808
1850
  };
1809
1851
  return formValue;
1810
1852
  }));
@@ -1988,5 +2030,5 @@ function provideDbxFirebaseOidc(config) {
1988
2030
  * Generated bundle index. Do not edit.
1989
2031
  */
1990
2032
 
1991
- 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 };
2033
+ 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_REQUIRED_SCOPES_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, oidcClientProviderProfilesForgeField, oidcClientRedirectUrisForgeField, oidcClientTestClientIdForgeField, oidcClientTestRedirectUriForgeField, oidcClientTestScopesForgeField, oidcClientTokenEndpointAuthMethodForgeField, oidcEntryClientForgeFormFields, oidcEntryClientTestForgeFormFields, oidcEntryClientUpdateForgeFormFields, provideDbxFirebaseOidc, provideOidcModelFirestoreCollections };
1992
2034
  //# sourceMappingURL=dereekb-dbx-firebase-oidc.mjs.map