@passflow/core 0.39.4 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1348,6 +1348,11 @@ export type PassflowSuccessResponse = {
1348
1348
  };
1349
1349
  export type PassflowLogoutResponse = {
1350
1350
  status: 'ok';
1351
+ /**
1352
+ * Where the browser goes to end the user's session at the SAML identity provider: set for a
1353
+ * session from a SAML connection with SP-initiated logout.
1354
+ */
1355
+ saml_logout_url?: string;
1351
1356
  };
1352
1357
  /** The signed-in user, as `GET /user/me` answers: the user object itself. */
1353
1358
  export interface PassflowSessionUser {
@@ -1767,6 +1772,7 @@ export type PassflowFederatedStartBody = {
1767
1772
  code_challenge?: string;
1768
1773
  code_challenge_method?: 'S256';
1769
1774
  state?: string;
1775
+ login_hint?: string;
1770
1776
  };
1771
1777
  export type PassflowFederatedStartResponse = {
1772
1778
  auth_url: string;
@@ -1919,12 +1925,17 @@ export type PassflowFederatedAuthPayload = {
1919
1925
  state?: string;
1920
1926
  /** The hosted login's OIDC parent sign-in, when the federated sign-in runs under one. */
1921
1927
  parent_challenge_id?: string;
1928
+ /**
1929
+ * The email the user typed, passed to the identity provider so it can skip asking again. Sent
1930
+ * only for a `conn_<connection_id>` provider; a social provider ignores it.
1931
+ */
1932
+ login_hint?: string;
1922
1933
  };
1923
1934
  export type PassflowFederatedAuthExtendedPayload = PassflowFederatedAuthPayload & {
1924
1935
  device?: string;
1925
1936
  };
1926
1937
  /** An enterprise start: the federated start's fields, with the connection or email instead of a provider. */
1927
- export type PassflowEnterpriseAuthPayload = Omit<PassflowFederatedAuthPayload, 'provider'> & PassflowEnterpriseTarget;
1938
+ export type PassflowEnterpriseAuthPayload = Omit<PassflowFederatedAuthPayload, 'provider' | 'login_hint'> & PassflowEnterpriseTarget;
1928
1939
  export type PassflowValidatePayload = {
1929
1940
  otp: string;
1930
1941
  device: string;
@@ -4464,6 +4475,21 @@ export type LogOutOptions = {
4464
4475
  * user on the Passflow server's start page. Default: the address the hosted sign-in landed on.
4465
4476
  */
4466
4477
  postLogoutRedirectUri?: string;
4478
+ /**
4479
+ * When the logout answer carries `saml_logout_url` (a session from a SAML connection with
4480
+ * SP-initiated logout), send the browser there after the local sign-out, so the identity
4481
+ * provider ends its session too. Default false: the URL is only returned. A hosted sign-in's
4482
+ * `/oidc/end_session` visit takes precedence; the URL is still returned then.
4483
+ */
4484
+ followSamlLogout?: boolean;
4485
+ };
4486
+ /** What `logOut()` resolves with. */
4487
+ export type LogOutResult = {
4488
+ /**
4489
+ * The SAML identity provider's logout address, when the server returned one: an http or https
4490
+ * URL. The local session is already cleared; visiting it ends the session at the provider.
4491
+ */
4492
+ samlLogoutUrl?: string;
4467
4493
  };
4468
4494
  /** How this instance's refresh controller coordinates (architecture §3.3, §3.4). */
4469
4495
  export type AuthServiceRefreshOptions = {
@@ -4681,9 +4707,13 @@ export declare class AuthService {
4681
4707
  *
4682
4708
  * Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
4683
4709
  *
4684
- * @returns the `sub` of the session that ended, when known
4710
+ * @returns the `sub` of the session that ended, when known, and the SAML identity provider's
4711
+ * logout address when the logout answer carried one
4685
4712
  */
4686
- logOut(): Promise<string | undefined>;
4713
+ logOut(): Promise<{
4714
+ userId?: string;
4715
+ samlLogoutUrl?: string;
4716
+ }>;
4687
4717
  /**
4688
4718
  * `Passflow.reset()`: the same local sign-out, synchronously, with no
4689
4719
  * API call and no lock. Emits no `SignOut`; the caller emits one.
@@ -4700,7 +4730,11 @@ export declare class AuthService {
4700
4730
  * sign-in landed on. Read before `logOut()`, which deletes what it is built from.
4701
4731
  */
4702
4732
  hostedEndSessionUrl(postLogoutRedirectUri?: string): string | undefined;
4703
- /** The logout API call. Server-side cleanup is best effort: every failure is ignored. */
4733
+ /**
4734
+ * The logout API call. Server-side cleanup is best effort: every failure is ignored.
4735
+ *
4736
+ * @returns the answer's `saml_logout_url` when it is an http or https URL
4737
+ */
4704
4738
  private callLogoutApi;
4705
4739
  /** Deletes every local trace of the session (both delivery modes) and clears the token cache. */
4706
4740
  private clearLocalSession;
@@ -6961,9 +6995,18 @@ export declare class Passflow {
6961
6995
  * sign-in landed on. Code after `await logOut()` may then not run. A sign-in made in the app
6962
6996
  * itself never navigates.
6963
6997
  *
6998
+ * A session from a SAML connection with SP-initiated logout also has a session at the identity
6999
+ * provider. The server then answers with its logout address, returned as `samlLogoutUrl` after
7000
+ * the local session is cleared. With `followSamlLogout: true` the page goes there after the one
7001
+ * `SignOut`; otherwise nothing navigates for it. A hosted sign-in's `/oidc/end_session` visit
7002
+ * takes precedence over it.
7003
+ *
6964
7004
  * @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
6965
7005
  * of the app's registered redirect URLs
6966
- * @returns Promise that resolves when sign-out is complete
7006
+ * @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
7007
+ * the server returns one
7008
+ * @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
7009
+ * `{}` otherwise
6967
7010
  * @throws {PassflowError} If sign-out request fails
6968
7011
  *
6969
7012
  * @example
@@ -6977,7 +7020,7 @@ export declare class Passflow {
6977
7020
  * }
6978
7021
  * ```
6979
7022
  */
6980
- logOut(options?: LogOutOptions): Promise<void>;
7023
+ logOut(options?: LogOutOptions): Promise<LogOutResult>;
6981
7024
  /**
6982
7025
  * Initiate federated authentication (OAuth) with a popup window.
6983
7026
  *
package/dist/index.d.ts CHANGED
@@ -1348,6 +1348,11 @@ export type PassflowSuccessResponse = {
1348
1348
  };
1349
1349
  export type PassflowLogoutResponse = {
1350
1350
  status: 'ok';
1351
+ /**
1352
+ * Where the browser goes to end the user's session at the SAML identity provider: set for a
1353
+ * session from a SAML connection with SP-initiated logout.
1354
+ */
1355
+ saml_logout_url?: string;
1351
1356
  };
1352
1357
  /** The signed-in user, as `GET /user/me` answers: the user object itself. */
1353
1358
  export interface PassflowSessionUser {
@@ -1767,6 +1772,7 @@ export type PassflowFederatedStartBody = {
1767
1772
  code_challenge?: string;
1768
1773
  code_challenge_method?: 'S256';
1769
1774
  state?: string;
1775
+ login_hint?: string;
1770
1776
  };
1771
1777
  export type PassflowFederatedStartResponse = {
1772
1778
  auth_url: string;
@@ -1919,12 +1925,17 @@ export type PassflowFederatedAuthPayload = {
1919
1925
  state?: string;
1920
1926
  /** The hosted login's OIDC parent sign-in, when the federated sign-in runs under one. */
1921
1927
  parent_challenge_id?: string;
1928
+ /**
1929
+ * The email the user typed, passed to the identity provider so it can skip asking again. Sent
1930
+ * only for a `conn_<connection_id>` provider; a social provider ignores it.
1931
+ */
1932
+ login_hint?: string;
1922
1933
  };
1923
1934
  export type PassflowFederatedAuthExtendedPayload = PassflowFederatedAuthPayload & {
1924
1935
  device?: string;
1925
1936
  };
1926
1937
  /** An enterprise start: the federated start's fields, with the connection or email instead of a provider. */
1927
- export type PassflowEnterpriseAuthPayload = Omit<PassflowFederatedAuthPayload, 'provider'> & PassflowEnterpriseTarget;
1938
+ export type PassflowEnterpriseAuthPayload = Omit<PassflowFederatedAuthPayload, 'provider' | 'login_hint'> & PassflowEnterpriseTarget;
1928
1939
  export type PassflowValidatePayload = {
1929
1940
  otp: string;
1930
1941
  device: string;
@@ -4464,6 +4475,21 @@ export type LogOutOptions = {
4464
4475
  * user on the Passflow server's start page. Default: the address the hosted sign-in landed on.
4465
4476
  */
4466
4477
  postLogoutRedirectUri?: string;
4478
+ /**
4479
+ * When the logout answer carries `saml_logout_url` (a session from a SAML connection with
4480
+ * SP-initiated logout), send the browser there after the local sign-out, so the identity
4481
+ * provider ends its session too. Default false: the URL is only returned. A hosted sign-in's
4482
+ * `/oidc/end_session` visit takes precedence; the URL is still returned then.
4483
+ */
4484
+ followSamlLogout?: boolean;
4485
+ };
4486
+ /** What `logOut()` resolves with. */
4487
+ export type LogOutResult = {
4488
+ /**
4489
+ * The SAML identity provider's logout address, when the server returned one: an http or https
4490
+ * URL. The local session is already cleared; visiting it ends the session at the provider.
4491
+ */
4492
+ samlLogoutUrl?: string;
4467
4493
  };
4468
4494
  /** How this instance's refresh controller coordinates (architecture §3.3, §3.4). */
4469
4495
  export type AuthServiceRefreshOptions = {
@@ -4681,9 +4707,13 @@ export declare class AuthService {
4681
4707
  *
4682
4708
  * Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
4683
4709
  *
4684
- * @returns the `sub` of the session that ended, when known
4710
+ * @returns the `sub` of the session that ended, when known, and the SAML identity provider's
4711
+ * logout address when the logout answer carried one
4685
4712
  */
4686
- logOut(): Promise<string | undefined>;
4713
+ logOut(): Promise<{
4714
+ userId?: string;
4715
+ samlLogoutUrl?: string;
4716
+ }>;
4687
4717
  /**
4688
4718
  * `Passflow.reset()`: the same local sign-out, synchronously, with no
4689
4719
  * API call and no lock. Emits no `SignOut`; the caller emits one.
@@ -4700,7 +4730,11 @@ export declare class AuthService {
4700
4730
  * sign-in landed on. Read before `logOut()`, which deletes what it is built from.
4701
4731
  */
4702
4732
  hostedEndSessionUrl(postLogoutRedirectUri?: string): string | undefined;
4703
- /** The logout API call. Server-side cleanup is best effort: every failure is ignored. */
4733
+ /**
4734
+ * The logout API call. Server-side cleanup is best effort: every failure is ignored.
4735
+ *
4736
+ * @returns the answer's `saml_logout_url` when it is an http or https URL
4737
+ */
4704
4738
  private callLogoutApi;
4705
4739
  /** Deletes every local trace of the session (both delivery modes) and clears the token cache. */
4706
4740
  private clearLocalSession;
@@ -6961,9 +6995,18 @@ export declare class Passflow {
6961
6995
  * sign-in landed on. Code after `await logOut()` may then not run. A sign-in made in the app
6962
6996
  * itself never navigates.
6963
6997
  *
6998
+ * A session from a SAML connection with SP-initiated logout also has a session at the identity
6999
+ * provider. The server then answers with its logout address, returned as `samlLogoutUrl` after
7000
+ * the local session is cleared. With `followSamlLogout: true` the page goes there after the one
7001
+ * `SignOut`; otherwise nothing navigates for it. A hosted sign-in's `/oidc/end_session` visit
7002
+ * takes precedence over it.
7003
+ *
6964
7004
  * @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
6965
7005
  * of the app's registered redirect URLs
6966
- * @returns Promise that resolves when sign-out is complete
7006
+ * @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
7007
+ * the server returns one
7008
+ * @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
7009
+ * `{}` otherwise
6967
7010
  * @throws {PassflowError} If sign-out request fails
6968
7011
  *
6969
7012
  * @example
@@ -6977,7 +7020,7 @@ export declare class Passflow {
6977
7020
  * }
6978
7021
  * ```
6979
7022
  */
6980
- logOut(options?: LogOutOptions): Promise<void>;
7023
+ logOut(options?: LogOutOptions): Promise<LogOutResult>;
6981
7024
  /**
6982
7025
  * Initiate federated authentication (OAuth) with a popup window.
6983
7026
  *