@entifix/testing-auth 0.12.1 → 0.14.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.
@@ -23,7 +23,7 @@ export declare const stubAccessToken: (claims?: TokenClaims) => string;
23
23
  * ⚠️ **The real cookie, not a bypass.** The stub mints into `entifix_at`, the
24
24
  * cookie every entifix reader already looks for, so the middleware's presence
25
25
  * check, the Next shell's bearer forwarding and the service shell's
26
- * `requirePrincipal` all run exactly as they do for a real user. A stub that
26
+ * the session guard all run exactly as they do for a real user. A stub that
27
27
  * skipped the cookie path would leave that path proven by nothing but the one
28
28
  * application that happens to have an identity provider.
29
29
  */
@@ -40,7 +40,7 @@ const base64url = (value)=>Buffer.from(value).toString('base64').replace(/\+/g,
40
40
  * ⚠️ **The real cookie, not a bypass.** The stub mints into `entifix_at`, the
41
41
  * cookie every entifix reader already looks for, so the middleware's presence
42
42
  * check, the Next shell's bearer forwarding and the service shell's
43
- * `requirePrincipal` all run exactly as they do for a real user. A stub that
43
+ * the session guard all run exactly as they do for a real user. A stub that
44
44
  * skipped the cookie path would leave that path proven by nothing but the one
45
45
  * application that happens to have an identity provider.
46
46
  */ export const stubSessionCookie = (claims = STUB_CLAIMS)=>({
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/stub-principal.ts"],"sourcesContent":["import type { TokenClaims } from '@entifix/business';\nimport { ACCESS_COOKIE } from '@entifix/core';\n\n/**\n * The principal a stubbed application runs as when nobody configured one.\n *\n * `admin` rather than something narrower, because the point of the stub is to\n * let someone see entifix working before they decide how identity works for\n * them — a stub that hid half the screens would be demonstrating its own\n * restrictions, not the framework.\n */\nexport const STUB_CLAIMS: TokenClaims = {\n userId: 'stub-user',\n subject: 'stub-user',\n sessionId: 'stub-session',\n roles: ['admin'],\n};\n\nconst base64url = (value: string): string =>\n Buffer.from(value)\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n\n/**\n * A structurally valid, **deliberately unsigned** access token for these claims.\n *\n * The same shape `@entifix/testing-e2e`'s `seedSession` fabricates, so the two\n * never disagree about what a seeded session looks like. Only\n * {@link makeFixedTokenService} will accept it; a real `TokenService` rejects\n * the signature, which is the property that keeps a stub out of production.\n */\nexport const stubAccessToken = (claims: TokenClaims = STUB_CLAIMS): string => {\n const header = base64url(\n JSON.stringify({ alg: 'RS256', kid: 'entifix-stub', typ: 'JWT' }),\n );\n const payload = base64url(\n JSON.stringify({ ...claims, exp: Math.floor(Date.now() / 1000) + 3600 }),\n );\n return `${header}.${payload}.entifix-stub-not-a-signature`;\n};\n\n/**\n * The cookie to set so an application sees a signed-in session.\n *\n * ⚠️ **The real cookie, not a bypass.** The stub mints into `entifix_at`, the\n * cookie every entifix reader already looks for, so the middleware's presence\n * check, the Next shell's bearer forwarding and the service shell's\n * `requirePrincipal` all run exactly as they do for a real user. A stub that\n * skipped the cookie path would leave that path proven by nothing but the one\n * application that happens to have an identity provider.\n */\nexport const stubSessionCookie = (\n claims: TokenClaims = STUB_CLAIMS,\n): { readonly name: string; readonly value: string } => ({\n name: ACCESS_COOKIE,\n value: stubAccessToken(claims),\n});\n"],"names":["ACCESS_COOKIE","STUB_CLAIMS","userId","subject","sessionId","roles","base64url","value","Buffer","from","toString","replace","stubAccessToken","claims","header","JSON","stringify","alg","kid","typ","payload","exp","Math","floor","Date","now","stubSessionCookie","name"],"mappings":";AACA,SAASA,aAAa,QAAQ,gBAAgB;AAE9C;;;;;;;CAOC,GACD,OAAO,MAAMC,cAA2B;IACtCC,QAAQ;IACRC,SAAS;IACTC,WAAW;IACXC,OAAO;QAAC;KAAQ;AAClB,EAAE;AAEF,MAAMC,YAAY,CAACC,QACjBC,OAAOC,IAAI,CAACF,OACTG,QAAQ,CAAC,UACTC,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,OAAO;AAEpB;;;;;;;CAOC,GACD,OAAO,MAAMC,kBAAkB,CAACC,SAAsBZ,WAAW;IAC/D,MAAMa,SAASR,UACbS,KAAKC,SAAS,CAAC;QAAEC,KAAK;QAASC,KAAK;QAAgBC,KAAK;IAAM;IAEjE,MAAMC,UAAUd,UACdS,KAAKC,SAAS,CAAC,aAAKH;QAAQQ,KAAKC,KAAKC,KAAK,CAACC,KAAKC,GAAG,KAAK,QAAQ;;IAEnE,OAAO,GAAGX,OAAO,CAAC,EAAEM,QAAQ,6BAA6B,CAAC;AAC5D,EAAE;AAEF;;;;;;;;;CASC,GACD,OAAO,MAAMM,oBAAoB,CAC/Bb,SAAsBZ,WAAW,GACsB,CAAA;QACvD0B,MAAM3B;QACNO,OAAOK,gBAAgBC;IACzB,CAAA,EAAG"}
1
+ {"version":3,"sources":["../src/stub-principal.ts"],"sourcesContent":["import type { TokenClaims } from '@entifix/business';\nimport { ACCESS_COOKIE } from '@entifix/core';\n\n/**\n * The principal a stubbed application runs as when nobody configured one.\n *\n * `admin` rather than something narrower, because the point of the stub is to\n * let someone see entifix working before they decide how identity works for\n * them — a stub that hid half the screens would be demonstrating its own\n * restrictions, not the framework.\n */\nexport const STUB_CLAIMS: TokenClaims = {\n userId: 'stub-user',\n subject: 'stub-user',\n sessionId: 'stub-session',\n roles: ['admin'],\n};\n\nconst base64url = (value: string): string =>\n Buffer.from(value)\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n\n/**\n * A structurally valid, **deliberately unsigned** access token for these claims.\n *\n * The same shape `@entifix/testing-e2e`'s `seedSession` fabricates, so the two\n * never disagree about what a seeded session looks like. Only\n * {@link makeFixedTokenService} will accept it; a real `TokenService` rejects\n * the signature, which is the property that keeps a stub out of production.\n */\nexport const stubAccessToken = (claims: TokenClaims = STUB_CLAIMS): string => {\n const header = base64url(\n JSON.stringify({ alg: 'RS256', kid: 'entifix-stub', typ: 'JWT' }),\n );\n const payload = base64url(\n JSON.stringify({ ...claims, exp: Math.floor(Date.now() / 1000) + 3600 }),\n );\n return `${header}.${payload}.entifix-stub-not-a-signature`;\n};\n\n/**\n * The cookie to set so an application sees a signed-in session.\n *\n * ⚠️ **The real cookie, not a bypass.** The stub mints into `entifix_at`, the\n * cookie every entifix reader already looks for, so the middleware's presence\n * check, the Next shell's bearer forwarding and the service shell's\n * the session guard all run exactly as they do for a real user. A stub that\n * skipped the cookie path would leave that path proven by nothing but the one\n * application that happens to have an identity provider.\n */\nexport const stubSessionCookie = (\n claims: TokenClaims = STUB_CLAIMS,\n): { readonly name: string; readonly value: string } => ({\n name: ACCESS_COOKIE,\n value: stubAccessToken(claims),\n});\n"],"names":["ACCESS_COOKIE","STUB_CLAIMS","userId","subject","sessionId","roles","base64url","value","Buffer","from","toString","replace","stubAccessToken","claims","header","JSON","stringify","alg","kid","typ","payload","exp","Math","floor","Date","now","stubSessionCookie","name"],"mappings":";AACA,SAASA,aAAa,QAAQ,gBAAgB;AAE9C;;;;;;;CAOC,GACD,OAAO,MAAMC,cAA2B;IACtCC,QAAQ;IACRC,SAAS;IACTC,WAAW;IACXC,OAAO;QAAC;KAAQ;AAClB,EAAE;AAEF,MAAMC,YAAY,CAACC,QACjBC,OAAOC,IAAI,CAACF,OACTG,QAAQ,CAAC,UACTC,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,OAAO;AAEpB;;;;;;;CAOC,GACD,OAAO,MAAMC,kBAAkB,CAACC,SAAsBZ,WAAW;IAC/D,MAAMa,SAASR,UACbS,KAAKC,SAAS,CAAC;QAAEC,KAAK;QAASC,KAAK;QAAgBC,KAAK;IAAM;IAEjE,MAAMC,UAAUd,UACdS,KAAKC,SAAS,CAAC,aAAKH;QAAQQ,KAAKC,KAAKC,KAAK,CAACC,KAAKC,GAAG,KAAK,QAAQ;;IAEnE,OAAO,GAAGX,OAAO,CAAC,EAAEM,QAAQ,6BAA6B,CAAC;AAC5D,EAAE;AAEF;;;;;;;;;CASC,GACD,OAAO,MAAMM,oBAAoB,CAC/Bb,SAAsBZ,WAAW,GACsB,CAAA;QACvD0B,MAAM3B;QACNO,OAAOK,gBAAgBC;IACzB,CAAA,EAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entifix/testing-auth",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "description": "Authentication stubs for tests: a fixed token service, an allow-all policy, and ready-made session cookies.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -52,14 +52,14 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@swc/helpers": "0.5.23",
55
- "@entifix/authz": "0.12.1",
56
- "@entifix/business": "0.12.1",
57
- "@entifix/core": "0.12.1"
55
+ "@entifix/authz": "0.14.0",
56
+ "@entifix/business": "0.14.0",
57
+ "@entifix/core": "0.14.0"
58
58
  },
59
59
  "peerDependencies": {
60
- "effect": "^4.0.6"
60
+ "effect": "^4.0.7"
61
61
  },
62
62
  "devDependencies": {
63
- "effect": "4.0.6"
63
+ "effect": "4.0.7"
64
64
  }
65
65
  }