@haneinfo/oidc-delegation 0.4.4

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.
Files changed (73) hide show
  1. package/LICENSE +14 -0
  2. package/dist/config.d.ts +7 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +13 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/errors.d.ts +7 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +16 -0
  9. package/dist/errors.js.map +1 -0
  10. package/dist/index.d.ts +7 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +19 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/module-options-validation.d.ts +4 -0
  15. package/dist/module-options-validation.d.ts.map +1 -0
  16. package/dist/module-options-validation.js +65 -0
  17. package/dist/module-options-validation.js.map +1 -0
  18. package/dist/observability/logger.d.ts +14 -0
  19. package/dist/observability/logger.d.ts.map +1 -0
  20. package/dist/observability/logger.js +10 -0
  21. package/dist/observability/logger.js.map +1 -0
  22. package/dist/observability/outbound-throttle.d.ts +20 -0
  23. package/dist/observability/outbound-throttle.d.ts.map +1 -0
  24. package/dist/observability/outbound-throttle.js +57 -0
  25. package/dist/observability/outbound-throttle.js.map +1 -0
  26. package/dist/observability/rate-limiter.d.ts +11 -0
  27. package/dist/observability/rate-limiter.d.ts.map +1 -0
  28. package/dist/observability/rate-limiter.js +43 -0
  29. package/dist/observability/rate-limiter.js.map +1 -0
  30. package/dist/observability/security-event-log.d.ts +12 -0
  31. package/dist/observability/security-event-log.d.ts.map +1 -0
  32. package/dist/observability/security-event-log.js +46 -0
  33. package/dist/observability/security-event-log.js.map +1 -0
  34. package/dist/oidc-delegation.module.d.ts +7 -0
  35. package/dist/oidc-delegation.module.d.ts.map +1 -0
  36. package/dist/oidc-delegation.module.js +39 -0
  37. package/dist/oidc-delegation.module.js.map +1 -0
  38. package/dist/oidc-delegation.service.d.ts +22 -0
  39. package/dist/oidc-delegation.service.d.ts.map +1 -0
  40. package/dist/oidc-delegation.service.js +123 -0
  41. package/dist/oidc-delegation.service.js.map +1 -0
  42. package/dist/plugin.d.ts +53 -0
  43. package/dist/plugin.d.ts.map +1 -0
  44. package/dist/plugin.js +122 -0
  45. package/dist/plugin.js.map +1 -0
  46. package/dist/policy-registry.d.ts +16 -0
  47. package/dist/policy-registry.d.ts.map +1 -0
  48. package/dist/policy-registry.js +85 -0
  49. package/dist/policy-registry.js.map +1 -0
  50. package/dist/providers/keycloak-token-exchange.provider.d.ts +14 -0
  51. package/dist/providers/keycloak-token-exchange.provider.d.ts.map +1 -0
  52. package/dist/providers/keycloak-token-exchange.provider.js +145 -0
  53. package/dist/providers/keycloak-token-exchange.provider.js.map +1 -0
  54. package/dist/subject-token-sanity-check.d.ts +5 -0
  55. package/dist/subject-token-sanity-check.d.ts.map +1 -0
  56. package/dist/subject-token-sanity-check.js +50 -0
  57. package/dist/subject-token-sanity-check.js.map +1 -0
  58. package/dist/testing/fake-provider.d.ts +18 -0
  59. package/dist/testing/fake-provider.d.ts.map +1 -0
  60. package/dist/testing/fake-provider.js +46 -0
  61. package/dist/testing/fake-provider.js.map +1 -0
  62. package/dist/testing/index.d.ts +2 -0
  63. package/dist/testing/index.d.ts.map +1 -0
  64. package/dist/testing/index.js +10 -0
  65. package/dist/testing/index.js.map +1 -0
  66. package/dist/types.d.ts +67 -0
  67. package/dist/types.d.ts.map +1 -0
  68. package/dist/types.js +3 -0
  69. package/dist/types.js.map +1 -0
  70. package/haneinfo.plugin.json +56 -0
  71. package/package.json +56 -0
  72. package/plugin.d.ts +3 -0
  73. package/plugin.js +4 -0
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubjectTokenSanityCheckError = void 0;
4
+ exports.assertSubjectTokenBelongsToSourceClient = assertSubjectTokenBelongsToSourceClient;
5
+ // Non-authoritative sanity check on the subject token before sending it to the provider.
6
+ // See 042-oidc-delegation-package-plan.md §2 decision 13 / §8: T-16610 proved empirically
7
+ // that Keycloak's own "requester must be within the subject token's audience" check does
8
+ // NOT protect against a source app being handed a token issued by a *different* app once
9
+ // that app's audience has been widened (e.g. by `fullScopeAllowed`) to include this app —
10
+ // Keycloak will happily exchange it. This check is the only control that catches that
11
+ // case reliably; it is mandatory, not optional defense-in-depth.
12
+ //
13
+ // This does not verify the token's signature and must never be used for authorization —
14
+ // it only rejects tokens that are obviously not this app's own, to stop this package from
15
+ // being usable as a token-laundering oracle for a caller-supplied bearer.
16
+ function assertSubjectTokenBelongsToSourceClient(subjectToken, expectedIssuerClientId) {
17
+ const payload = decodeJwtPayload(subjectToken);
18
+ const claimant = typeof payload.azp === 'string' ? payload.azp : payload.client_id;
19
+ if (typeof claimant !== 'string' || claimant.length === 0) {
20
+ throw new SubjectTokenSanityCheckError('subject token has no azp or client_id claim identifying its issuing client');
21
+ }
22
+ if (claimant !== expectedIssuerClientId) {
23
+ throw new SubjectTokenSanityCheckError('subject token was not issued by the expected client');
24
+ }
25
+ }
26
+ class SubjectTokenSanityCheckError extends Error {
27
+ constructor(message) {
28
+ super(message);
29
+ this.name = 'SubjectTokenSanityCheckError';
30
+ }
31
+ }
32
+ exports.SubjectTokenSanityCheckError = SubjectTokenSanityCheckError;
33
+ function decodeJwtPayload(token) {
34
+ const parts = token.split('.');
35
+ if (parts.length !== 3) {
36
+ throw new SubjectTokenSanityCheckError('subject token is not a JWT');
37
+ }
38
+ try {
39
+ const json = Buffer.from(parts[1], 'base64url').toString('utf8');
40
+ const parsed = JSON.parse(json);
41
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
42
+ throw new Error('payload is not an object');
43
+ }
44
+ return parsed;
45
+ }
46
+ catch {
47
+ throw new SubjectTokenSanityCheckError('subject token payload could not be decoded');
48
+ }
49
+ }
50
+ //# sourceMappingURL=subject-token-sanity-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subject-token-sanity-check.js","sourceRoot":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C,QAAQ,CAAC,MAAM,CAAC,CAAC;QACjE,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3E,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,MAAiC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,4BAA4B,CAAC,4CAA4C,CAAC,CAAC;IACvF,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { OidcDelegationError } from '../errors';
2
+ import type { TokenExchangeProvider, TokenExchangeProviderParams, TokenExchangeProviderResult } from '../types';
3
+ /**
4
+ * Deterministic in-memory `TokenExchangeProvider` for consumer unit tests — no network,
5
+ * no real IdP, no timing flakiness. Construct it with one of the `create*Fixture` helpers
6
+ * below, or provide a custom `handle` function for bespoke scenarios.
7
+ */
8
+ export declare class FakeOidcDelegationProvider implements TokenExchangeProvider {
9
+ private readonly handle;
10
+ readonly calls: TokenExchangeProviderParams[];
11
+ constructor(handle: (params: TokenExchangeProviderParams) => Promise<TokenExchangeProviderResult>);
12
+ exchange(params: TokenExchangeProviderParams): Promise<TokenExchangeProviderResult>;
13
+ }
14
+ export declare function createSuccessFixture(overrides?: Partial<TokenExchangeProviderResult>): FakeOidcDelegationProvider;
15
+ export declare function createDenyFixture(category?: OidcDelegationError['category'], message?: string): FakeOidcDelegationProvider;
16
+ export declare function createTimeoutFixture(): FakeOidcDelegationProvider;
17
+ export declare function createMalformedFixture(): FakeOidcDelegationProvider;
18
+ //# sourceMappingURL=fake-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake-provider.d.ts","sourceRoot":"","sources":["../../src/testing/fake-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EACV,qBAAqB,EACrB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,qBAAa,0BAA2B,YAAW,qBAAqB;IAIpE,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHzB,QAAQ,CAAC,KAAK,EAAE,2BAA2B,EAAE,CAAM;gBAGhC,MAAM,EAAE,CACvB,MAAM,EAAE,2BAA2B,KAChC,OAAO,CAAC,2BAA2B,CAAC;IAG3C,QAAQ,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAIpF;AAED,wBAAgB,oBAAoB,CAClC,SAAS,GAAE,OAAO,CAAC,2BAA2B,CAAM,GACnD,0BAA0B,CAK5B;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,GAAE,mBAAmB,CAAC,UAAU,CAAqB,EAC7D,OAAO,SAAoC,GAC1C,0BAA0B,CAI5B;AAED,wBAAgB,oBAAoB,IAAI,0BAA0B,CAOjE;AAED,wBAAgB,sBAAsB,IAAI,0BAA0B,CAOnE"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FakeOidcDelegationProvider = void 0;
4
+ exports.createSuccessFixture = createSuccessFixture;
5
+ exports.createDenyFixture = createDenyFixture;
6
+ exports.createTimeoutFixture = createTimeoutFixture;
7
+ exports.createMalformedFixture = createMalformedFixture;
8
+ const errors_1 = require("../errors");
9
+ /**
10
+ * Deterministic in-memory `TokenExchangeProvider` for consumer unit tests — no network,
11
+ * no real IdP, no timing flakiness. Construct it with one of the `create*Fixture` helpers
12
+ * below, or provide a custom `handle` function for bespoke scenarios.
13
+ */
14
+ class FakeOidcDelegationProvider {
15
+ constructor(handle) {
16
+ this.handle = handle;
17
+ this.calls = [];
18
+ }
19
+ exchange(params) {
20
+ this.calls.push(params);
21
+ return this.handle(params);
22
+ }
23
+ }
24
+ exports.FakeOidcDelegationProvider = FakeOidcDelegationProvider;
25
+ function createSuccessFixture(overrides = {}) {
26
+ return new FakeOidcDelegationProvider(async () => ({
27
+ accessToken: overrides.accessToken ?? 'fake-delegated-access-token',
28
+ expiresInSeconds: overrides.expiresInSeconds ?? 120,
29
+ }));
30
+ }
31
+ function createDenyFixture(category = 'exchange_denied', message = 'exchange denied (fake provider)') {
32
+ return new FakeOidcDelegationProvider(async () => {
33
+ throw new errors_1.OidcDelegationError(category, message);
34
+ });
35
+ }
36
+ function createTimeoutFixture() {
37
+ return new FakeOidcDelegationProvider(async () => {
38
+ throw new errors_1.OidcDelegationError('provider_unavailable', 'token exchange request timed out (fake provider)');
39
+ });
40
+ }
41
+ function createMalformedFixture() {
42
+ return new FakeOidcDelegationProvider(async () => {
43
+ throw new errors_1.OidcDelegationError('malformed_provider_response', 'response body was not an object (fake provider)');
44
+ });
45
+ }
46
+ //# sourceMappingURL=fake-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake-provider.js","sourceRoot":"","sources":["../../src/testing/fake-provider.ts"],"names":[],"mappings":";;;AA2BA,oDAOC;AAED,8CAOC;AAED,oDAOC;AAED,wDAOC;AA7DD,sCAAgD;AAOhD;;;;GAIG;AACH,MAAa,0BAA0B;IAGrC,YACmB,MAEwB;QAFxB,WAAM,GAAN,MAAM,CAEkB;QALlC,UAAK,GAAkC,EAAE,CAAC;IAMhD,CAAC;IAEJ,QAAQ,CAAC,MAAmC;QAC1C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF;AAbD,gEAaC;AAED,SAAgB,oBAAoB,CAClC,YAAkD,EAAE;IAEpD,OAAO,IAAI,0BAA0B,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QACjD,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,6BAA6B;QACnE,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,IAAI,GAAG;KACpD,CAAC,CAAC,CAAC;AACN,CAAC;AAED,SAAgB,iBAAiB,CAC/B,WAA4C,iBAAiB,EAC7D,OAAO,GAAG,iCAAiC;IAE3C,OAAO,IAAI,0BAA0B,CAAC,KAAK,IAAI,EAAE;QAC/C,MAAM,IAAI,4BAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,oBAAoB;IAClC,OAAO,IAAI,0BAA0B,CAAC,KAAK,IAAI,EAAE;QAC/C,MAAM,IAAI,4BAAmB,CAC3B,sBAAsB,EACtB,kDAAkD,CACnD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,sBAAsB;IACpC,OAAO,IAAI,0BAA0B,CAAC,KAAK,IAAI,EAAE;QAC/C,MAAM,IAAI,4BAAmB,CAC3B,6BAA6B,EAC7B,iDAAiD,CAClD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { createDenyFixture, createMalformedFixture, createSuccessFixture, createTimeoutFixture, FakeOidcDelegationProvider, } from './fake-provider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FakeOidcDelegationProvider = exports.createTimeoutFixture = exports.createSuccessFixture = exports.createMalformedFixture = exports.createDenyFixture = void 0;
4
+ var fake_provider_1 = require("./fake-provider");
5
+ Object.defineProperty(exports, "createDenyFixture", { enumerable: true, get: function () { return fake_provider_1.createDenyFixture; } });
6
+ Object.defineProperty(exports, "createMalformedFixture", { enumerable: true, get: function () { return fake_provider_1.createMalformedFixture; } });
7
+ Object.defineProperty(exports, "createSuccessFixture", { enumerable: true, get: function () { return fake_provider_1.createSuccessFixture; } });
8
+ Object.defineProperty(exports, "createTimeoutFixture", { enumerable: true, get: function () { return fake_provider_1.createTimeoutFixture; } });
9
+ Object.defineProperty(exports, "FakeOidcDelegationProvider", { enumerable: true, get: function () { return fake_provider_1.FakeOidcDelegationProvider; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";;;AAAA,iDAMyB;AALvB,kHAAA,iBAAiB,OAAA;AACjB,uHAAA,sBAAsB,OAAA;AACtB,qHAAA,oBAAoB,OAAA;AACpB,qHAAA,oBAAoB,OAAA;AACpB,2HAAA,0BAA0B,OAAA"}
@@ -0,0 +1,67 @@
1
+ export type ExchangeDelegatedTokenInput = {
2
+ subjectToken: string;
3
+ policy: string;
4
+ };
5
+ export type DelegatedAccessToken = {
6
+ accessToken: string;
7
+ tokenType: 'Bearer';
8
+ expiresInSeconds: number;
9
+ };
10
+ export interface OidcDelegationClient {
11
+ exchange(input: ExchangeDelegatedTokenInput): Promise<DelegatedAccessToken>;
12
+ }
13
+ export type DelegationPolicyConfig = {
14
+ targetAudience: string;
15
+ requestedScopes: readonly string[];
16
+ maxExpiresInSeconds: number;
17
+ };
18
+ export type OidcDelegationModuleOptions = {
19
+ provider: 'keycloak';
20
+ tokenEndpoint: string;
21
+ /** The confidential client that performs the Token Exchange call itself (e.g.
22
+ * `delegation-client`) — authenticates to the provider with `sourceClientSecret`. Per plan
23
+ * §2 decision 4, this is deliberately a dedicated exchange-only client, distinct from
24
+ * whichever client actually issues subject tokens to this app's users (see
25
+ * `subjectTokenIssuerClientId`). */
26
+ sourceClientId: string;
27
+ sourceClientSecret: string;
28
+ /**
29
+ * The client id this app's users actually log into and receive subject tokens from
30
+ * (e.g. `subject-client`) — almost always *different* from `sourceClientId` when using a dedicated
31
+ * delegation client. The mandatory outbound sanity check (see plan §2 decision 13/§8)
32
+ * verifies the subject token's `azp`/`client_id` equals *this* value, not
33
+ * `sourceClientId` — getting this wrong makes every real exchange fail closed, since a
34
+ * dedicated exchange-only client never itself issues subject tokens to anyone.
35
+ */
36
+ subjectTokenIssuerClientId: string;
37
+ /** Allow an HTTP token endpoint for explicitly isolated development environments. */
38
+ allowInsecureTokenEndpoint?: boolean;
39
+ /** Outbound HTTP request timeout in milliseconds. Default 5000. */
40
+ requestTimeoutMs?: number;
41
+ /**
42
+ * Outbound rate limit: max exchange attempts per policy per rolling minute before
43
+ * this package fails closed with a `provider_unavailable` error instead of calling
44
+ * the provider. Default 60. See 042-oidc-delegation-package-plan.md §8.
45
+ */
46
+ maxExchangesPerMinutePerPolicy?: number;
47
+ policies: Record<string, DelegationPolicyConfig>;
48
+ };
49
+ /**
50
+ * Provider-neutral outbound exchange interface. The Keycloak Standard Token Exchange
51
+ * V2 adapter is the only implementation shipped in the first version (see
52
+ * 042-oidc-delegation-package-plan.md §3.2 — no second IdP adapter to avoid speculative
53
+ * abstraction).
54
+ */
55
+ export interface TokenExchangeProvider {
56
+ exchange(params: TokenExchangeProviderParams): Promise<TokenExchangeProviderResult>;
57
+ }
58
+ export type TokenExchangeProviderParams = {
59
+ subjectToken: string;
60
+ targetAudience: string;
61
+ requestedScopes: readonly string[];
62
+ };
63
+ export type TokenExchangeProviderResult = {
64
+ accessToken: string;
65
+ expiresInSeconds: number;
66
+ };
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,2BAA2B,GAAG;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAA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use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ {
2
+ "schemaVersion": "haneinfo.plugin/v1",
3
+ "id": "oidc-delegation",
4
+ "displayName": "OIDC Token Delegation",
5
+ "cardinality": "singleton",
6
+ "distribution": "official",
7
+ "engine": {
8
+ "haneinfoPluginApi": "^1.0.0",
9
+ "node": ">=22.0.0",
10
+ "frameworks": {
11
+ "@nestjs/common": "^11.0.5",
12
+ "@nestjs/core": "^11.0.5"
13
+ }
14
+ },
15
+ "provides": ["haneinfo.identity-delegation"],
16
+ "requires": [],
17
+ "configSchema": { "configRef": "oidcDelegation" },
18
+ "environment": [
19
+ {
20
+ "key": "OIDC_DELEGATION_ENDPOINT",
21
+ "required": false,
22
+ "secret": false,
23
+ "description": "Token endpoint URL for RFC 8693 token exchange."
24
+ },
25
+ {
26
+ "key": "OIDC_DELEGATION_SOURCE_CLIENT_ID",
27
+ "required": false,
28
+ "secret": false,
29
+ "description": "Confidential client ID used to perform token exchange."
30
+ },
31
+ {
32
+ "key": "OIDC_DELEGATION_SOURCE_CLIENT_SECRET",
33
+ "required": false,
34
+ "secret": true,
35
+ "description": "Client secret for the delegation client."
36
+ },
37
+ {
38
+ "key": "OIDC_DELEGATION_ISSUER_CLIENT_ID",
39
+ "required": false,
40
+ "secret": false,
41
+ "description": "Client ID that issued the subject token."
42
+ }
43
+ ],
44
+ "facets": {
45
+ "backend": {
46
+ "modulePath": "./dist/oidc-delegation.module.js",
47
+ "exportName": "OidcDelegationModule",
48
+ "providerTokens": ["haneinfo.identity-delegation"]
49
+ },
50
+ "operations": {
51
+ "healthIndicatorId": "oidc-delegation",
52
+ "metricsPrefix": "oidc_delegation",
53
+ "shutdownTimeoutMs": 5000
54
+ }
55
+ }
56
+ }
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@haneinfo/oidc-delegation",
3
+ "version": "0.4.4",
4
+ "private": false,
5
+ "type": "commonjs",
6
+ "files": [
7
+ "dist",
8
+ "haneinfo.plugin.json",
9
+ "plugin.js",
10
+ "plugin.d.ts"
11
+ ],
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./testing": {
20
+ "types": "./dist/testing/index.d.ts",
21
+ "default": "./dist/testing/index.js"
22
+ },
23
+ "./plugin": {
24
+ "types": "./dist/plugin.d.ts",
25
+ "default": "./dist/plugin.js"
26
+ },
27
+ "./haneinfo.plugin.json": "./haneinfo.plugin.json",
28
+ "./package.json": "./package.json"
29
+ },
30
+ "dependencies": {
31
+ "@haneinfo/plugin-api": "1.4.0"
32
+ },
33
+ "peerDependencies": {
34
+ "@nestjs/common": "^11.0.0",
35
+ "@nestjs/core": "^11.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@nestjs/common": "^11.0.0",
39
+ "@nestjs/core": "^11.0.0",
40
+ "@types/node": "^24.13.0",
41
+ "typescript": "^5.9.3",
42
+ "vitest": "^4.1.11",
43
+ "@haneinfo/plugin-testkit": "2.2.0"
44
+ },
45
+ "license": "UNLICENSED",
46
+ "publishConfig": {
47
+ "registry": "https://registry.npmjs.org/",
48
+ "access": "public"
49
+ },
50
+ "scripts": {
51
+ "build": "tsc -p tsconfig.build.json",
52
+ "dev": "tsc -p tsconfig.build.json --watch",
53
+ "test": "vitest run",
54
+ "typecheck": "tsc --noEmit"
55
+ }
56
+ }
package/plugin.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ // See plugin.js for why this file exists (classic/node10 moduleResolution compatibility shim).
2
+ export * from './dist/plugin';
3
+ export { default } from './dist/plugin';
package/plugin.js ADDED
@@ -0,0 +1,4 @@
1
+ // Compatibility shim for consumers whose TypeScript config uses "classic"/"node10"
2
+ // moduleResolution, which resolves `@haneinfo/oidc-delegation/plugin` by looking for a real file at
3
+ // the package root — it does not consult package.json's "exports" map at all.
4
+ module.exports = require('./dist/plugin');