@aooth/auth-moost 0.1.49 → 0.1.50

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.mts CHANGED
@@ -3163,6 +3163,12 @@ declare class AuthWorkflow {
3163
3163
  * account falls back to the credentials form (where `users.login` rejects
3164
3164
  * it) instead of silently reaching consent.
3165
3165
  */
3166
+ /**
3167
+ * Account-state gate shared by the three no-password entry paths — the
3168
+ * silent-authorize probe, `sso-callback`'s success gate, and `prove-control`'s
3169
+ * candidate gate. A blocked account must never bind a subject on any of them.
3170
+ */
3171
+ protected isAccountBlocked(user: UserCredentials): boolean;
3166
3172
  protected probeSilentAuthz(ctx: AuthWfCtx, policy: AuthzReauthPolicy): Promise<boolean>;
3167
3173
  initInviteAdmin(ctx: AuthWfCtx): void;
3168
3174
  initInviteAccept(ctx: AuthWfCtx): void;
package/dist/index.mjs CHANGED
@@ -2438,6 +2438,14 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
2438
2438
  * account falls back to the credentials form (where `users.login` rejects
2439
2439
  * it) instead of silently reaching consent.
2440
2440
  */
2441
+ /**
2442
+ * Account-state gate shared by the three no-password entry paths — the
2443
+ * silent-authorize probe, `sso-callback`'s success gate, and `prove-control`'s
2444
+ * candidate gate. A blocked account must never bind a subject on any of them.
2445
+ */
2446
+ isAccountBlocked(user) {
2447
+ return user.account.locked || !user.account.active;
2448
+ }
2441
2449
  async probeSilentAuthz(ctx, policy) {
2442
2450
  const session = useAuth().getAuthContext();
2443
2451
  if (!session) return false;
@@ -2452,7 +2460,7 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
2452
2460
  } catch {
2453
2461
  return false;
2454
2462
  }
2455
- if (user.account.locked || !user.account.active) return false;
2463
+ if (this.isAccountBlocked(user)) return false;
2456
2464
  ctx.subject = session.userId;
2457
2465
  const authz = ctx.authz;
2458
2466
  authz.silent = true;
@@ -4860,7 +4868,7 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
4860
4868
  if (outcome.kind === "denied") return this.finishOAuth(ctx, "denied");
4861
4869
  if (outcome.kind === "needs-link") return this.stashPendingLink(ctx, profile, outcome.candidateUserId, redirect);
4862
4870
  const user = await this.users.getUser(outcome.userId);
4863
- if (user.account.locked || !user.account.active) return this.finishOAuth(ctx, "account-state");
4871
+ if (this.isAccountBlocked(user)) return this.finishOAuth(ctx, "account-state");
4864
4872
  ctx.subject = outcome.userId;
4865
4873
  ctx.oauth = {
4866
4874
  provider: profile.provider,
@@ -5078,7 +5086,7 @@ let AuthWorkflow = _AuthWorkflow = class AuthWorkflow {
5078
5086
  if (err instanceof UserAuthError && err.type === "LOCKED") throw this.throwPublic(ctx, wf, { formMessage: "Account locked, please try again later" });
5079
5087
  throw this.throwPublic(ctx, wf, { errors: { password: "Invalid password" } });
5080
5088
  }
5081
- if (candidate.account.locked || !candidate.account.active) {
5089
+ if (this.isAccountBlocked(candidate)) {
5082
5090
  delete ctx.pendingLink;
5083
5091
  return this.finishOAuth(ctx, "account-state");
5084
5092
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aooth/auth-moost",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "Moost auth integration for aoothjs — AuthGuard interceptor, useAuth composable, REST endpoints, workflows",
5
5
  "keywords": [
6
6
  "aoothjs",
@@ -59,10 +59,10 @@
59
59
  "dependencies": {
60
60
  "@atscript/moost-wf": "^0.1.121",
61
61
  "@wooksjs/http-body": "^0.7.19",
62
- "@aooth/arbac-moost": "^0.1.49",
63
- "@aooth/auth": "0.1.49",
64
- "@aooth/user": "0.1.49",
65
- "@aooth/idp": "0.1.49"
62
+ "@aooth/arbac-moost": "^0.1.50",
63
+ "@aooth/idp": "0.1.50",
64
+ "@aooth/auth": "0.1.50",
65
+ "@aooth/user": "0.1.50"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@atscript/core": "^0.1.82",