@passflow/core 0.39.4 → 0.41.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;
@@ -3056,7 +3067,7 @@ export declare class AuthAPI {
3056
3067
  * ends a sign-in is.
3057
3068
  */
3058
3069
  validateEmailCode(payload: PassflowEmailCodePayload): Promise<PassflowAuthorizationResponse>;
3059
- logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean): Promise<PassflowLogoutResponse>;
3070
+ logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean, postLogoutRedirectUri?: string): Promise<PassflowLogoutResponse>;
3060
3071
  /** Reads the signed-in user. An invalid session rejects. */
3061
3072
  validateSession(): Promise<PassflowSessionUser>;
3062
3073
  sendPasswordResetEmail(payload: PassflowSendPasswordResetEmailPayload, options?: PassflowAuthOptions): Promise<PassflowSuccessResponse>;
@@ -4462,8 +4473,29 @@ export type LogOutOptions = {
4462
4473
  * After a hosted sign-in: where the hosted login sends the browser once its own session has
4463
4474
  * ended. It must match one of the app's registered redirect URLs; an unmatched one leaves the
4464
4475
  * user on the Passflow server's start page. Default: the address the hosted sign-in landed on.
4476
+ *
4477
+ * When set, it is also sent as `post_logout_redirect_uri` in the logout request. For a session
4478
+ * from a SAML connection the server then returns the browser there after the identity
4479
+ * provider's single logout, instead of its own signed-out page. The server ignores an address
4480
+ * that is not a registered redirect URL. Needs Passflow server v0.137.1 or later; older servers
4481
+ * ignore it.
4465
4482
  */
4466
4483
  postLogoutRedirectUri?: string;
4484
+ /**
4485
+ * When the logout answer carries `saml_logout_url` (a session from a SAML connection with
4486
+ * SP-initiated logout), send the browser there after the local sign-out, so the identity
4487
+ * provider ends its session too. Default false: the URL is only returned. A hosted sign-in's
4488
+ * `/oidc/end_session` visit takes precedence; the URL is still returned then.
4489
+ */
4490
+ followSamlLogout?: boolean;
4491
+ };
4492
+ /** What `logOut()` resolves with. */
4493
+ export type LogOutResult = {
4494
+ /**
4495
+ * The SAML identity provider's logout address, when the server returned one: an http or https
4496
+ * URL. The local session is already cleared; visiting it ends the session at the provider.
4497
+ */
4498
+ samlLogoutUrl?: string;
4467
4499
  };
4468
4500
  /** How this instance's refresh controller coordinates (architecture §3.3, §3.4). */
4469
4501
  export type AuthServiceRefreshOptions = {
@@ -4681,9 +4713,14 @@ export declare class AuthService {
4681
4713
  *
4682
4714
  * Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
4683
4715
  *
4684
- * @returns the `sub` of the session that ended, when known
4716
+ * @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request when set
4717
+ * @returns the `sub` of the session that ended, when known, and the SAML identity provider's
4718
+ * logout address when the logout answer carried one
4685
4719
  */
4686
- logOut(): Promise<string | undefined>;
4720
+ logOut(postLogoutRedirectUri?: string): Promise<{
4721
+ userId?: string;
4722
+ samlLogoutUrl?: string;
4723
+ }>;
4687
4724
  /**
4688
4725
  * `Passflow.reset()`: the same local sign-out, synchronously, with no
4689
4726
  * API call and no lock. Emits no `SignOut`; the caller emits one.
@@ -4700,7 +4737,11 @@ export declare class AuthService {
4700
4737
  * sign-in landed on. Read before `logOut()`, which deletes what it is built from.
4701
4738
  */
4702
4739
  hostedEndSessionUrl(postLogoutRedirectUri?: string): string | undefined;
4703
- /** The logout API call. Server-side cleanup is best effort: every failure is ignored. */
4740
+ /**
4741
+ * The logout API call. Server-side cleanup is best effort: every failure is ignored.
4742
+ *
4743
+ * @returns the answer's `saml_logout_url` when it is an http or https URL
4744
+ */
4704
4745
  private callLogoutApi;
4705
4746
  /** Deletes every local trace of the session (both delivery modes) and clears the token cache. */
4706
4747
  private clearLocalSession;
@@ -6961,9 +7002,20 @@ export declare class Passflow {
6961
7002
  * sign-in landed on. Code after `await logOut()` may then not run. A sign-in made in the app
6962
7003
  * itself never navigates.
6963
7004
  *
7005
+ * A session from a SAML connection with SP-initiated logout also has a session at the identity
7006
+ * provider. The server then answers with its logout address, returned as `samlLogoutUrl` after
7007
+ * the local session is cleared. With `followSamlLogout: true` the page goes there after the one
7008
+ * `SignOut`; otherwise nothing navigates for it. A hosted sign-in's `/oidc/end_session` visit
7009
+ * takes precedence over it.
7010
+ *
6964
7011
  * @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
6965
- * of the app's registered redirect URLs
6966
- * @returns Promise that resolves when sign-out is complete
7012
+ * of the app's registered redirect URLs. When set it is also sent in the logout request, and
7013
+ * after a SAML single logout the server returns the browser there (Passflow server v0.137.1 or
7014
+ * later; older servers ignore it)
7015
+ * @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
7016
+ * the server returns one
7017
+ * @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
7018
+ * `{}` otherwise
6967
7019
  * @throws {PassflowError} If sign-out request fails
6968
7020
  *
6969
7021
  * @example
@@ -6977,7 +7029,7 @@ export declare class Passflow {
6977
7029
  * }
6978
7030
  * ```
6979
7031
  */
6980
- logOut(options?: LogOutOptions): Promise<void>;
7032
+ logOut(options?: LogOutOptions): Promise<LogOutResult>;
6981
7033
  /**
6982
7034
  * Initiate federated authentication (OAuth) with a popup window.
6983
7035
  *
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;
@@ -3056,7 +3067,7 @@ export declare class AuthAPI {
3056
3067
  * ends a sign-in is.
3057
3068
  */
3058
3069
  validateEmailCode(payload: PassflowEmailCodePayload): Promise<PassflowAuthorizationResponse>;
3059
- logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean): Promise<PassflowLogoutResponse>;
3070
+ logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean, postLogoutRedirectUri?: string): Promise<PassflowLogoutResponse>;
3060
3071
  /** Reads the signed-in user. An invalid session rejects. */
3061
3072
  validateSession(): Promise<PassflowSessionUser>;
3062
3073
  sendPasswordResetEmail(payload: PassflowSendPasswordResetEmailPayload, options?: PassflowAuthOptions): Promise<PassflowSuccessResponse>;
@@ -4462,8 +4473,29 @@ export type LogOutOptions = {
4462
4473
  * After a hosted sign-in: where the hosted login sends the browser once its own session has
4463
4474
  * ended. It must match one of the app's registered redirect URLs; an unmatched one leaves the
4464
4475
  * user on the Passflow server's start page. Default: the address the hosted sign-in landed on.
4476
+ *
4477
+ * When set, it is also sent as `post_logout_redirect_uri` in the logout request. For a session
4478
+ * from a SAML connection the server then returns the browser there after the identity
4479
+ * provider's single logout, instead of its own signed-out page. The server ignores an address
4480
+ * that is not a registered redirect URL. Needs Passflow server v0.137.1 or later; older servers
4481
+ * ignore it.
4465
4482
  */
4466
4483
  postLogoutRedirectUri?: string;
4484
+ /**
4485
+ * When the logout answer carries `saml_logout_url` (a session from a SAML connection with
4486
+ * SP-initiated logout), send the browser there after the local sign-out, so the identity
4487
+ * provider ends its session too. Default false: the URL is only returned. A hosted sign-in's
4488
+ * `/oidc/end_session` visit takes precedence; the URL is still returned then.
4489
+ */
4490
+ followSamlLogout?: boolean;
4491
+ };
4492
+ /** What `logOut()` resolves with. */
4493
+ export type LogOutResult = {
4494
+ /**
4495
+ * The SAML identity provider's logout address, when the server returned one: an http or https
4496
+ * URL. The local session is already cleared; visiting it ends the session at the provider.
4497
+ */
4498
+ samlLogoutUrl?: string;
4467
4499
  };
4468
4500
  /** How this instance's refresh controller coordinates (architecture §3.3, §3.4). */
4469
4501
  export type AuthServiceRefreshOptions = {
@@ -4681,9 +4713,14 @@ export declare class AuthService {
4681
4713
  *
4682
4714
  * Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
4683
4715
  *
4684
- * @returns the `sub` of the session that ended, when known
4716
+ * @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request when set
4717
+ * @returns the `sub` of the session that ended, when known, and the SAML identity provider's
4718
+ * logout address when the logout answer carried one
4685
4719
  */
4686
- logOut(): Promise<string | undefined>;
4720
+ logOut(postLogoutRedirectUri?: string): Promise<{
4721
+ userId?: string;
4722
+ samlLogoutUrl?: string;
4723
+ }>;
4687
4724
  /**
4688
4725
  * `Passflow.reset()`: the same local sign-out, synchronously, with no
4689
4726
  * API call and no lock. Emits no `SignOut`; the caller emits one.
@@ -4700,7 +4737,11 @@ export declare class AuthService {
4700
4737
  * sign-in landed on. Read before `logOut()`, which deletes what it is built from.
4701
4738
  */
4702
4739
  hostedEndSessionUrl(postLogoutRedirectUri?: string): string | undefined;
4703
- /** The logout API call. Server-side cleanup is best effort: every failure is ignored. */
4740
+ /**
4741
+ * The logout API call. Server-side cleanup is best effort: every failure is ignored.
4742
+ *
4743
+ * @returns the answer's `saml_logout_url` when it is an http or https URL
4744
+ */
4704
4745
  private callLogoutApi;
4705
4746
  /** Deletes every local trace of the session (both delivery modes) and clears the token cache. */
4706
4747
  private clearLocalSession;
@@ -6961,9 +7002,20 @@ export declare class Passflow {
6961
7002
  * sign-in landed on. Code after `await logOut()` may then not run. A sign-in made in the app
6962
7003
  * itself never navigates.
6963
7004
  *
7005
+ * A session from a SAML connection with SP-initiated logout also has a session at the identity
7006
+ * provider. The server then answers with its logout address, returned as `samlLogoutUrl` after
7007
+ * the local session is cleared. With `followSamlLogout: true` the page goes there after the one
7008
+ * `SignOut`; otherwise nothing navigates for it. A hosted sign-in's `/oidc/end_session` visit
7009
+ * takes precedence over it.
7010
+ *
6964
7011
  * @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
6965
- * of the app's registered redirect URLs
6966
- * @returns Promise that resolves when sign-out is complete
7012
+ * of the app's registered redirect URLs. When set it is also sent in the logout request, and
7013
+ * after a SAML single logout the server returns the browser there (Passflow server v0.137.1 or
7014
+ * later; older servers ignore it)
7015
+ * @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
7016
+ * the server returns one
7017
+ * @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
7018
+ * `{}` otherwise
6967
7019
  * @throws {PassflowError} If sign-out request fails
6968
7020
  *
6969
7021
  * @example
@@ -6977,7 +7029,7 @@ export declare class Passflow {
6977
7029
  * }
6978
7030
  * ```
6979
7031
  */
6980
- logOut(options?: LogOutOptions): Promise<void>;
7032
+ logOut(options?: LogOutOptions): Promise<LogOutResult>;
6981
7033
  /**
6982
7034
  * Initiate federated authentication (OAuth) with a popup window.
6983
7035
  *