@passflow/core 0.40.0 → 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
@@ -3067,7 +3067,7 @@ export declare class AuthAPI {
3067
3067
  * ends a sign-in is.
3068
3068
  */
3069
3069
  validateEmailCode(payload: PassflowEmailCodePayload): Promise<PassflowAuthorizationResponse>;
3070
- logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean): Promise<PassflowLogoutResponse>;
3070
+ logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean, postLogoutRedirectUri?: string): Promise<PassflowLogoutResponse>;
3071
3071
  /** Reads the signed-in user. An invalid session rejects. */
3072
3072
  validateSession(): Promise<PassflowSessionUser>;
3073
3073
  sendPasswordResetEmail(payload: PassflowSendPasswordResetEmailPayload, options?: PassflowAuthOptions): Promise<PassflowSuccessResponse>;
@@ -4473,6 +4473,12 @@ export type LogOutOptions = {
4473
4473
  * After a hosted sign-in: where the hosted login sends the browser once its own session has
4474
4474
  * ended. It must match one of the app's registered redirect URLs; an unmatched one leaves the
4475
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.
4476
4482
  */
4477
4483
  postLogoutRedirectUri?: string;
4478
4484
  /**
@@ -4707,10 +4713,11 @@ export declare class AuthService {
4707
4713
  *
4708
4714
  * Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
4709
4715
  *
4716
+ * @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request when set
4710
4717
  * @returns the `sub` of the session that ended, when known, and the SAML identity provider's
4711
4718
  * logout address when the logout answer carried one
4712
4719
  */
4713
- logOut(): Promise<{
4720
+ logOut(postLogoutRedirectUri?: string): Promise<{
4714
4721
  userId?: string;
4715
4722
  samlLogoutUrl?: string;
4716
4723
  }>;
@@ -7002,7 +7009,9 @@ export declare class Passflow {
7002
7009
  * takes precedence over it.
7003
7010
  *
7004
7011
  * @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
7005
- * of the app's registered redirect URLs
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)
7006
7015
  * @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
7007
7016
  * the server returns one
7008
7017
  * @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
package/dist/index.d.ts CHANGED
@@ -3067,7 +3067,7 @@ export declare class AuthAPI {
3067
3067
  * ends a sign-in is.
3068
3068
  */
3069
3069
  validateEmailCode(payload: PassflowEmailCodePayload): Promise<PassflowAuthorizationResponse>;
3070
- logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean): Promise<PassflowLogoutResponse>;
3070
+ logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean, postLogoutRedirectUri?: string): Promise<PassflowLogoutResponse>;
3071
3071
  /** Reads the signed-in user. An invalid session rejects. */
3072
3072
  validateSession(): Promise<PassflowSessionUser>;
3073
3073
  sendPasswordResetEmail(payload: PassflowSendPasswordResetEmailPayload, options?: PassflowAuthOptions): Promise<PassflowSuccessResponse>;
@@ -4473,6 +4473,12 @@ export type LogOutOptions = {
4473
4473
  * After a hosted sign-in: where the hosted login sends the browser once its own session has
4474
4474
  * ended. It must match one of the app's registered redirect URLs; an unmatched one leaves the
4475
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.
4476
4482
  */
4477
4483
  postLogoutRedirectUri?: string;
4478
4484
  /**
@@ -4707,10 +4713,11 @@ export declare class AuthService {
4707
4713
  *
4708
4714
  * Emits no `SignOut`: `Passflow.logOut()` emits exactly one, after this resolves.
4709
4715
  *
4716
+ * @param postLogoutRedirectUri - sent as `post_logout_redirect_uri` in the logout request when set
4710
4717
  * @returns the `sub` of the session that ended, when known, and the SAML identity provider's
4711
4718
  * logout address when the logout answer carried one
4712
4719
  */
4713
- logOut(): Promise<{
4720
+ logOut(postLogoutRedirectUri?: string): Promise<{
4714
4721
  userId?: string;
4715
4722
  samlLogoutUrl?: string;
4716
4723
  }>;
@@ -7002,7 +7009,9 @@ export declare class Passflow {
7002
7009
  * takes precedence over it.
7003
7010
  *
7004
7011
  * @param options.postLogoutRedirectUri - where to return after a hosted sign-out; must match one
7005
- * of the app's registered redirect URLs
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)
7006
7015
  * @param options.followSamlLogout - navigate to the SAML identity provider's logout address when
7007
7016
  * the server returns one
7008
7017
  * @returns `{ samlLogoutUrl }` when the server returned the identity provider's logout address,
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ var a = "__passflowAntiBot", o = (e, t) => {
11
11
  if (typeof e != "object" || !e) return;
12
12
  let t = e[a];
13
13
  return typeof t == "object" && t ? t : void 0;
14
- }, c = "0.40.0", l = "X-Passflow-Clientid", u = "Authorization", d = "X-Passflow-DeviceId", f = "X-Passflow-DeviceType", p = "X-Passflow-Anti-Bot", m = "X-Passflow-Agent-Tool", h = "passflow_auth", g = c, _ = [
14
+ }, c = "0.41.0", l = "X-Passflow-Clientid", u = "Authorization", d = "X-Passflow-DeviceId", f = "X-Passflow-DeviceType", p = "X-Passflow-Anti-Bot", m = "X-Passflow-Agent-Tool", h = "passflow_auth", g = c, _ = [
15
15
  "id",
16
16
  "offline",
17
17
  "openid"
@@ -1151,12 +1151,13 @@ var bt = /* @__PURE__ */ function(e) {
1151
1151
  otp: e.otp
1152
1152
  }, B);
1153
1153
  }
1154
- logOut(e, t, n = !1) {
1155
- let r = n ? void 0 : {
1154
+ logOut(e, t, n = !1, r) {
1155
+ let i = n ? void 0 : {
1156
1156
  refresh_token: t,
1157
- device: e
1158
- }, i = n ? Ve.logout : R.logout;
1159
- return this.axiosClient.post(i, r);
1157
+ device: e,
1158
+ ...r ? { post_logout_redirect_uri: r } : {}
1159
+ }, a = n ? Ve.logout : R.logout;
1160
+ return this.axiosClient.post(a, i);
1160
1161
  }
1161
1162
  validateSession() {
1162
1163
  return this.axiosClient.get(R.validateSession);
@@ -4759,13 +4760,13 @@ var Oa = 10, ka = "The sign-in answered with a PKCE code, but its verifier is go
4759
4760
  throw W(this.subscribeStore, t), e;
4760
4761
  }
4761
4762
  }
4762
- async logOut() {
4763
- let e = this.refresh.identity(), t;
4764
- return await this.refresh.signOut(async (e) => {
4765
- t = await this.callLogoutApi(e), this.forgetPkceSignIn(), this.forgetPendingPasswordless(), this.emailChallenges.clear(), this.clearLocalSession();
4763
+ async logOut(e) {
4764
+ let t = this.refresh.identity(), n;
4765
+ return await this.refresh.signOut(async (t) => {
4766
+ n = await this.callLogoutApi(t, e), this.forgetPkceSignIn(), this.forgetPendingPasswordless(), this.emailChallenges.clear(), this.clearLocalSession();
4766
4767
  }), {
4767
- userId: e,
4768
- samlLogoutUrl: t
4768
+ userId: t,
4769
+ samlLogoutUrl: n
4769
4770
  };
4770
4771
  }
4771
4772
  resetSession() {
@@ -4782,7 +4783,7 @@ var Oa = 10, ka = "The sign-in answered with a PKCE code, but its verifier is go
4782
4783
  let r = this.storageManager.getToken(M.id_token) ?? this.storageManager.getIdToken();
4783
4784
  return r && (n.id_token_hint = r), `${this.url.replace(/\/+$/, "")}/oidc/end_session?${new URLSearchParams(n)}`;
4784
4785
  }
4785
- async callLogoutApi(e) {
4786
+ async callLogoutApi(e, t) {
4786
4787
  if (this.tokenDeliveryManager.isBFFMode() && this.tokenExchangeConfig?.logoutUrl) {
4787
4788
  try {
4788
4789
  await fetch(this.tokenExchangeConfig.logoutUrl, {
@@ -4792,9 +4793,9 @@ var Oa = 10, ka = "The sign-in answered with a PKCE code, but its verifier is go
4792
4793
  } catch {}
4793
4794
  return;
4794
4795
  }
4795
- let t = e ?? this.storageManager.getToken(M.refresh_token), n = this.storageManager.getDeviceId();
4796
+ let n = e ?? this.storageManager.getToken(M.refresh_token), r = this.storageManager.getDeviceId();
4796
4797
  try {
4797
- let e = await this.authApi.logOut(n, t, !this.appId);
4798
+ let e = await this.authApi.logOut(r, n, !this.appId, t);
4798
4799
  if (e.status !== "ok") throw Error("Logout failed");
4799
4800
  return Ta(e.saml_logout_url);
4800
4801
  } catch {
@@ -7682,7 +7683,7 @@ var Oa = 10, ka = "The sign-in answered with a PKCE code, but its verifier is go
7682
7683
  }
7683
7684
  async logOut(e = {}) {
7684
7685
  try {
7685
- let t = this.authService.hostedEndSessionUrl(e.postLogoutRedirectUri), { userId: n, samlLogoutUrl: r } = await this.authService.logOut(), i = t ?? (e.followSamlLogout ? r : void 0);
7686
+ let t = this.authService.hostedEndSessionUrl(e.postLogoutRedirectUri), { userId: n, samlLogoutUrl: r } = await this.authService.logOut(e.postLogoutRedirectUri), i = t ?? (e.followSamlLogout ? r : void 0);
7686
7687
  try {
7687
7688
  this.twoFactorService.clearPartialAuthState(), this.notifySignedOut(n), await this.submitSessionCheck();
7688
7689
  } finally {