@entifix/testing-auth 0.5.0 → 0.6.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/stub-layers.d.ts +2 -2
- package/dist/stub-layers.js +2 -2
- package/dist/stub-layers.js.map +1 -1
- package/package.json +4 -4
package/dist/stub-layers.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { Layer } from 'effect';
|
|
|
10
10
|
* not check a signature, so wiring this into anything reachable from a network
|
|
11
11
|
* is an open door. It exists so an example can serve `$metadata` without an
|
|
12
12
|
* identity provider — and it does that by replacing the *port*, not by adding
|
|
13
|
-
* an unauthenticated branch to `entity-metadata-route.ts`.
|
|
14
|
-
*
|
|
13
|
+
* an unauthenticated branch to `entity-metadata-route.ts`. The point of serving
|
|
14
|
+
* the descriptor is that it is filtered by the verified principal; a hole punched in
|
|
15
15
|
* the route for a demo would become the adoption pattern.
|
|
16
16
|
*/
|
|
17
17
|
export declare const makeFixedTokenService: (claims?: TokenClaims) => TokenService;
|
package/dist/stub-layers.js
CHANGED
|
@@ -9,8 +9,8 @@ import { STUB_CLAIMS, stubAccessToken } from './stub-principal.js';
|
|
|
9
9
|
* not check a signature, so wiring this into anything reachable from a network
|
|
10
10
|
* is an open door. It exists so an example can serve `$metadata` without an
|
|
11
11
|
* identity provider — and it does that by replacing the *port*, not by adding
|
|
12
|
-
* an unauthenticated branch to `entity-metadata-route.ts`.
|
|
13
|
-
*
|
|
12
|
+
* an unauthenticated branch to `entity-metadata-route.ts`. The point of serving
|
|
13
|
+
* the descriptor is that it is filtered by the verified principal; a hole punched in
|
|
14
14
|
* the route for a demo would become the adoption pattern.
|
|
15
15
|
*/ export const makeFixedTokenService = (claims = STUB_CLAIMS)=>({
|
|
16
16
|
// A stub token carries its own `exp`, so the requested lifetime is not read;
|
package/dist/stub-layers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/stub-layers.ts"],"sourcesContent":["import type { PolicyDecision } from '@entifix/authz';\nimport { PolicyDecisionTag } from '@entifix/authz';\nimport type { TokenClaims, TokenService } from '@entifix/business';\nimport { TokenServiceTag } from '@entifix/business';\nimport { Effect, Layer } from 'effect';\n\nimport { STUB_CLAIMS, stubAccessToken } from './stub-principal.js';\n\n/**\n * A `TokenService` that trusts every token and answers with fixed claims.\n *\n * ⚠️ **This is the whole reason the package is `type:testing`.** `verify` does\n * not check a signature, so wiring this into anything reachable from a network\n * is an open door. It exists so an example can serve `$metadata` without an\n * identity provider — and it does that by replacing the *port*, not by adding\n * an unauthenticated branch to `entity-metadata-route.ts`.
|
|
1
|
+
{"version":3,"sources":["../src/stub-layers.ts"],"sourcesContent":["import type { PolicyDecision } from '@entifix/authz';\nimport { PolicyDecisionTag } from '@entifix/authz';\nimport type { TokenClaims, TokenService } from '@entifix/business';\nimport { TokenServiceTag } from '@entifix/business';\nimport { Effect, Layer } from 'effect';\n\nimport { STUB_CLAIMS, stubAccessToken } from './stub-principal.js';\n\n/**\n * A `TokenService` that trusts every token and answers with fixed claims.\n *\n * ⚠️ **This is the whole reason the package is `type:testing`.** `verify` does\n * not check a signature, so wiring this into anything reachable from a network\n * is an open door. It exists so an example can serve `$metadata` without an\n * identity provider — and it does that by replacing the *port*, not by adding\n * an unauthenticated branch to `entity-metadata-route.ts`. The point of serving\n * the descriptor is that it is filtered by the verified principal; a hole punched in\n * the route for a demo would become the adoption pattern.\n */\nexport const makeFixedTokenService = (\n claims: TokenClaims = STUB_CLAIMS,\n): TokenService => ({\n // A stub token carries its own `exp`, so the requested lifetime is not read;\n // and `verify` ignores the token by design — see the note above.\n sign: signed => Effect.succeed(stubAccessToken(signed)),\n verify: () => Effect.succeed(claims),\n});\n\nexport const FixedTokenServiceLayer = (\n claims: TokenClaims = STUB_CLAIMS,\n): Layer.Layer<TokenServiceTag> =>\n Layer.succeed(TokenServiceTag, makeFixedTokenService(claims));\n\n/** A `PolicyDecision` that grants every request. */\nexport const AllowAllPolicy: PolicyDecision = { decide: () => true };\n\nexport const AllowAllPolicyLayer: Layer.Layer<PolicyDecisionTag> =\n Layer.succeed(PolicyDecisionTag, AllowAllPolicy);\n"],"names":["PolicyDecisionTag","TokenServiceTag","Effect","Layer","STUB_CLAIMS","stubAccessToken","makeFixedTokenService","claims","sign","signed","succeed","verify","FixedTokenServiceLayer","AllowAllPolicy","decide","AllowAllPolicyLayer"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,iBAAiB;AAEnD,SAASC,eAAe,QAAQ,oBAAoB;AACpD,SAASC,MAAM,EAAEC,KAAK,QAAQ,SAAS;AAEvC,SAASC,WAAW,EAAEC,eAAe,QAAQ,sBAAsB;AAEnE;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,wBAAwB,CACnCC,SAAsBH,WAAW,GACf,CAAA;QAClB,6EAA6E;QAC7E,iEAAiE;QACjEI,MAAMC,CAAAA,SAAUP,OAAOQ,OAAO,CAACL,gBAAgBI;QAC/CE,QAAQ,IAAMT,OAAOQ,OAAO,CAACH;IAC/B,CAAA,EAAG;AAEH,OAAO,MAAMK,yBAAyB,CACpCL,SAAsBH,WAAW,GAEjCD,MAAMO,OAAO,CAACT,iBAAiBK,sBAAsBC,SAAS;AAEhE,kDAAkD,GAClD,OAAO,MAAMM,iBAAiC;IAAEC,QAAQ,IAAM;AAAK,EAAE;AAErE,OAAO,MAAMC,sBACXZ,MAAMO,OAAO,CAACV,mBAAmBa,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entifix/testing-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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,9 +52,9 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@swc/helpers": "0.5.23",
|
|
55
|
-
"@entifix/
|
|
56
|
-
"@entifix/
|
|
57
|
-
"@entifix/core": "0.
|
|
55
|
+
"@entifix/authz": "0.6.0",
|
|
56
|
+
"@entifix/business": "0.6.0",
|
|
57
|
+
"@entifix/core": "0.6.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"effect": "^4.0.5"
|