@dereekb/dbx-firebase 13.4.0 → 13.4.2

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.
@@ -269,9 +269,13 @@ const DEFAULT_OIDC_TOKEN_ENDPOINT_AUTH_METHODS = ['client_secret_post', 'client_
269
269
  * Apps provide a concrete implementation via `provideDbxFirebaseOidc()`.
270
270
  */
271
271
  class DbxFirebaseOidcConfig {
272
- /** Path to the authorization endpoint. Defaults to '/oidc/auth'. */
272
+ /**
273
+ * Path to the authorization endpoint. Defaults to '/oidc/auth'.
274
+ */
273
275
  oidcAuthorizationEndpointApiPath;
274
- /** Base path for interaction endpoints. Defaults to '/interaction'. */
276
+ /**
277
+ * Base path for interaction endpoints. Defaults to '/interaction'.
278
+ */
275
279
  oidcInteractionEndpointApiPath;
276
280
  /**
277
281
  * Supported token endpoint authentication methods.
@@ -347,7 +351,7 @@ class DbxFirebaseOAuthConsentScopeDefaultViewComponent extends AbstractDbxFireba
347
351
  return [
348
352
  ...knownScopes.map((name) => {
349
353
  const details = availableScopes.find((s) => s.value === name);
350
- return { name, description: details.description ?? '' };
354
+ return { name, description: details?.description ?? '' };
351
355
  }),
352
356
  ...unknownScopes.map((name) => ({ name, description: 'unknown' }))
353
357
  ];
@@ -394,6 +398,8 @@ class DbxFirebaseOidcInteractionService {
394
398
  _oidcConfig = inject(DbxFirebaseOidcConfigService);
395
399
  /**
396
400
  * Base URL for the interaction API, derived from the OIDC config service.
401
+ *
402
+ * @returns The base URL string for the OIDC interaction endpoint.
397
403
  */
398
404
  get baseUrl() {
399
405
  return this._oidcConfig.oidcInteractionEndpointApiPath;
@@ -403,6 +409,7 @@ class DbxFirebaseOidcInteractionService {
403
409
  *
404
410
  * Automatically attaches the current user's Firebase ID token.
405
411
  *
412
+ * @param uid - The OIDC interaction UID identifying the current login interaction.
406
413
  * @returns Observable that emits the redirect URL from the server response.
407
414
  */
408
415
  submitLogin(uid) {
@@ -413,6 +420,8 @@ class DbxFirebaseOidcInteractionService {
413
420
  *
414
421
  * Automatically attaches the current user's Firebase ID token.
415
422
  *
423
+ * @param uid - The OIDC interaction UID identifying the current consent interaction.
424
+ * @param approved - Whether the user approved or denied the consent request.
416
425
  * @returns Observable that emits the redirect URL from the server response.
417
426
  */
418
427
  submitConsent(uid, approved) {
@@ -632,6 +641,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
632
641
  * Creates fields for the OAuth client create form.
633
642
  *
634
643
  * Includes `token_endpoint_auth_method` which is immutable after creation.
644
+ *
645
+ * @param config - Optional configuration for field generation, including mode and allowed auth methods.
646
+ * @returns Array of FormlyFieldConfig for the client creation form.
635
647
  */
636
648
  function oidcEntryClientFormFields(config) {
637
649
  const fields = [];
@@ -641,6 +653,12 @@ function oidcEntryClientFormFields(config) {
641
653
  fields.push(...oidcEntryClientUpdateFormFields());
642
654
  return fields;
643
655
  }
656
+ /**
657
+ * Creates a value selection field for choosing the token endpoint authentication method.
658
+ *
659
+ * @param config - Optional configuration to filter the available auth method options.
660
+ * @returns A FormlyFieldConfig for the token endpoint auth method selector.
661
+ */
644
662
  function oidcClientTokenEndpointAuthMethodField(config) {
645
663
  const allowedAuthMethods = config?.tokenEndpointAuthMethods;
646
664
  const options = allowedAuthMethods?.length ? ALL_OIDC_TOKEN_ENDPOINT_AUTH_METHOD_OPTIONS.filter((o) => allowedAuthMethods.includes(o.value)) : ALL_OIDC_TOKEN_ENDPOINT_AUTH_METHOD_OPTIONS;
@@ -656,10 +674,17 @@ function oidcClientTokenEndpointAuthMethodField(config) {
656
674
  * Creates fields for updating an existing OAuth client.
657
675
  *
658
676
  * Excludes `token_endpoint_auth_method` (immutable after creation).
677
+ *
678
+ * @returns Array of FormlyFieldConfig for the client update form.
659
679
  */
660
680
  function oidcEntryClientUpdateFormFields() {
661
681
  return [oidcClientNameField(), oidcClientRedirectUrisField(), oidcClientJwksUriField(), oidcClientLogoUriField(), oidcClientHomepageUriField()];
662
682
  }
683
+ /**
684
+ * Creates a text field for the OAuth client display name.
685
+ *
686
+ * @returns A FormlyFieldConfig for the client name input.
687
+ */
663
688
  function oidcClientNameField() {
664
689
  return textField({
665
690
  key: 'client_name',
@@ -669,6 +694,11 @@ function oidcClientNameField() {
669
694
  maxLength: 200
670
695
  });
671
696
  }
697
+ /**
698
+ * Creates a searchable chip field for entering redirect URIs.
699
+ *
700
+ * @returns A FormlyFieldConfig for the redirect URIs input.
701
+ */
672
702
  function oidcClientRedirectUrisField() {
673
703
  return searchableStringChipField({
674
704
  key: 'redirect_uris',
@@ -681,6 +711,11 @@ function oidcClientRedirectUrisField() {
681
711
  displayForValue: (values) => of(values.map((v) => ({ ...v, label: v.value })))
682
712
  });
683
713
  }
714
+ /**
715
+ * Creates a text field for the client's JWKS URI. Only visible when using private_key_jwt authentication.
716
+ *
717
+ * @returns A FormlyFieldConfig for the JWKS URI input.
718
+ */
684
719
  function oidcClientJwksUriField() {
685
720
  return textField({
686
721
  key: 'jwks_uri',
@@ -692,6 +727,11 @@ function oidcClientJwksUriField() {
692
727
  }
693
728
  });
694
729
  }
730
+ /**
731
+ * Creates a text field for the optional client logo URL.
732
+ *
733
+ * @returns A FormlyFieldConfig for the logo URI input.
734
+ */
695
735
  function oidcClientLogoUriField() {
696
736
  return textField({
697
737
  key: 'logo_uri',
@@ -700,6 +740,11 @@ function oidcClientLogoUriField() {
700
740
  required: false
701
741
  });
702
742
  }
743
+ /**
744
+ * Creates a text field for the optional client homepage URL.
745
+ *
746
+ * @returns A FormlyFieldConfig for the homepage URL input.
747
+ */
703
748
  function oidcClientHomepageUriField() {
704
749
  return textField({
705
750
  key: 'client_uri',
@@ -710,10 +755,18 @@ function oidcClientHomepageUriField() {
710
755
  }
711
756
  /**
712
757
  * Assembles the form fields for the OAuth test client form.
758
+ *
759
+ * @param config - Configuration providing available redirect URIs and scopes for the test form.
760
+ * @returns Array of FormlyFieldConfig for the test client form.
713
761
  */
714
762
  function oidcEntryClientTestFormFields(config) {
715
763
  return [oidcClientTestClientIdField(), oidcClientTestRedirectUriField(config.redirectUris), oidcClientTestScopesField(config.availableScopes)];
716
764
  }
765
+ /**
766
+ * Creates a read-only text field displaying the OAuth client ID.
767
+ *
768
+ * @returns A FormlyFieldConfig for the client ID display.
769
+ */
717
770
  function oidcClientTestClientIdField() {
718
771
  return textField({
719
772
  key: 'client_id',
@@ -721,6 +774,12 @@ function oidcClientTestClientIdField() {
721
774
  readonly: true
722
775
  });
723
776
  }
777
+ /**
778
+ * Creates a selection field for choosing one of the client's registered redirect URIs for testing.
779
+ *
780
+ * @param redirectUris - The registered redirect URIs to display as options.
781
+ * @returns A FormlyFieldConfig for the redirect URI selector.
782
+ */
724
783
  function oidcClientTestRedirectUriField(redirectUris) {
725
784
  const options = redirectUris.map((uri) => ({ label: uri, value: uri }));
726
785
  return valueSelectionField({
@@ -731,6 +790,12 @@ function oidcClientTestRedirectUriField(redirectUris) {
731
790
  options
732
791
  });
733
792
  }
793
+ /**
794
+ * Creates a pickable chip field for selecting scopes to request during the test flow.
795
+ *
796
+ * @param availableScopes - The available scopes to display as selectable options.
797
+ * @returns A FormlyFieldConfig for the scopes selector.
798
+ */
734
799
  function oidcClientTestScopesField(availableScopes) {
735
800
  return pickableItemChipField({
736
801
  key: 'scopes',
@@ -835,11 +900,11 @@ class DbxFirebaseOidcEntryClientListViewItemClientComponent {
835
900
  entry = input.required(...(ngDevMode ? [{ debugName: "entry" }] : []));
836
901
  get name() {
837
902
  const payload = this.entry().payload;
838
- return payload?.['client_name'] || 'OAuth Client';
903
+ return payload?.client_name || 'OAuth Client';
839
904
  }
840
905
  get clientId() {
841
906
  const payload = this.entry().payload;
842
- return payload?.['client_id'] || '';
907
+ return payload?.client_id || '';
843
908
  }
844
909
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: DbxFirebaseOidcEntryClientListViewItemClientComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
845
910
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.0", type: DbxFirebaseOidcEntryClientListViewItemClientComponent, isStandalone: true, selector: "dbx-firebase-oidc-client-list-view-item-client", inputs: { entry: { classPropertyName: "entry", publicName: "entry", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
@@ -915,7 +980,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
915
980
  }]
916
981
  }] });
917
982
 
918
- /** Document store for a single {@link OidcEntry}. */
983
+ /**
984
+ * Document store for a single {@link OidcEntry}.
985
+ */
919
986
  class OidcEntryDocumentStore extends AbstractDbxFirebaseDocumentStore {
920
987
  oidcModelFunctions = inject(OidcModelFunctions);
921
988
  _latestClientSecret$ = completeOnDestroy(new BehaviorSubject(undefined));
@@ -1033,9 +1100,13 @@ function base64UrlEncode(bytes) {
1033
1100
  class DbxFirebaseOidcEntryClientTestComponent {
1034
1101
  oidcEntryDocumentStore = inject(OidcEntryDocumentStore);
1035
1102
  oidcConfigService = inject(DbxFirebaseOidcConfigService);
1036
- /** Scopes the user can pick from. Overrides the service default when provided. */
1103
+ /**
1104
+ * Scopes the user can pick from. Overrides the service default when provided.
1105
+ */
1037
1106
  availableScopes = input(undefined, ...(ngDevMode ? [{ debugName: "availableScopes" }] : []));
1038
- /** Path to the authorization endpoint. Overrides the service default when provided. */
1107
+ /**
1108
+ * Path to the authorization endpoint. Overrides the service default when provided.
1109
+ */
1039
1110
  oidcAuthorizationEndpointApiPath = input(undefined, ...(ngDevMode ? [{ debugName: "oidcAuthorizationEndpointApiPath" }] : []));
1040
1111
  resolvedAvailableScopes = computed(() => this.availableScopes() ?? this.oidcConfigService.availableScopes, ...(ngDevMode ? [{ debugName: "resolvedAvailableScopes" }] : []));
1041
1112
  resolvedAuthorizationEndpointPath = computed(() => this.oidcAuthorizationEndpointApiPath() ?? this.oidcConfigService.oidcAuthorizationEndpointApiPath, ...(ngDevMode ? [{ debugName: "resolvedAuthorizationEndpointPath" }] : []));
@@ -1065,7 +1136,9 @@ class DbxFirebaseOidcEntryClientTestComponent {
1065
1136
  codeChallenge = signal('', ...(ngDevMode ? [{ debugName: "codeChallenge" }] : []));
1066
1137
  state = signal(generateRandomString(), ...(ngDevMode ? [{ debugName: "state" }] : []));
1067
1138
  nonce = signal(generateRandomString(), ...(ngDevMode ? [{ debugName: "nonce" }] : []));
1068
- /** The current form value, updated by the form via dbxFormValueChange. */
1139
+ /**
1140
+ * The current form value, updated by the form via dbxFormValueChange.
1141
+ */
1069
1142
  formValue = signal(undefined, ...(ngDevMode ? [{ debugName: "formValue" }] : []));
1070
1143
  authorizationUrlSignal = computed(() => {
1071
1144
  const clientId = this.clientIdSignal();
@@ -1107,7 +1180,7 @@ class DbxFirebaseOidcEntryClientTestComponent {
1107
1180
  this._updateCodeChallenge();
1108
1181
  }
1109
1182
  _updateCodeChallenge() {
1110
- generatePkceCodeChallenge(this.codeVerifier()).then((challenge) => {
1183
+ void generatePkceCodeChallenge(this.codeVerifier()).then((challenge) => {
1111
1184
  this.codeChallenge.set(challenge);
1112
1185
  });
1113
1186
  }
@@ -1286,7 +1359,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
1286
1359
  }]
1287
1360
  }] });
1288
1361
 
1289
- /** Collection store for querying {@link OidcEntry} documents. */
1362
+ /**
1363
+ * Collection store for querying {@link OidcEntry} documents.
1364
+ */
1290
1365
  class OidcEntryCollectionStore extends AbstractDbxFirebaseCollectionStore {
1291
1366
  constructor() {
1292
1367
  super({ firestoreCollection: inject(OidcModelFirestoreCollections).oidcEntryCollection });
@@ -1298,7 +1373,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
1298
1373
  type: Injectable
1299
1374
  }], ctorParameters: () => [] });
1300
1375
 
1301
- /** Directive providing a {@link OidcEntryCollectionStore} for querying {@link OidcEntry} documents. */
1376
+ /**
1377
+ * Directive providing a {@link OidcEntryCollectionStore} for querying {@link OidcEntry} documents.
1378
+ */
1302
1379
  class OidcEntryCollectionStoreDirective extends DbxFirebaseCollectionStoreDirective {
1303
1380
  constructor() {
1304
1381
  super(inject(OidcEntryCollectionStore));
@@ -1315,7 +1392,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
1315
1392
  }]
1316
1393
  }], ctorParameters: () => [] });
1317
1394
 
1318
- /** Directive providing a {@link OidcEntryDocumentStore} for accessing a single {@link OidcEntry} document. */
1395
+ /**
1396
+ * Directive providing a {@link OidcEntryDocumentStore} for accessing a single {@link OidcEntry} document.
1397
+ */
1319
1398
  class OidcEntryDocumentStoreDirective extends DbxFirebaseDocumentStoreDirective {
1320
1399
  constructor() {
1321
1400
  super(inject(OidcEntryDocumentStore));
@@ -1334,6 +1413,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
1334
1413
 
1335
1414
  /**
1336
1415
  * Provider factory for the {@link OidcModelFirestoreCollections}.
1416
+ *
1417
+ * @param appCollection - The application's Firestore collection that must implement {@link OidcModelFirestoreCollections}.
1418
+ * @returns The validated OidcModelFirestoreCollections instance.
1337
1419
  */
1338
1420
  function provideOidcModelFirestoreCollections(appCollection) {
1339
1421
  if (!appCollection.oidcEntryCollection) {
@@ -1347,6 +1429,9 @@ function provideOidcModelFirestoreCollections(appCollection) {
1347
1429
  * When `oauthInteractionRoute` is configured in {@link DbxFirebaseOidcConfig}, an app initializer
1348
1430
  * is registered that adds that route to the {@link DbxAppAuthRouterService} ignored routes set,
1349
1431
  * preventing auth effects from redirecting away during the OIDC interaction flow.
1432
+ *
1433
+ * @param config - Configuration specifying the app collection class, OIDC settings, and provider options.
1434
+ * @returns EnvironmentProviders for the OIDC module.
1350
1435
  */
1351
1436
  function provideDbxFirebaseOidc(config) {
1352
1437
  const providers = [{ provide: DbxFirebaseOidcConfig, useValue: config.oidcConfig }, DbxFirebaseOidcConfigService];