@marxbiotech/signet-integration 0.1.2 → 0.2.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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateSignetIntegrationOptions = exports.SignetJwtStrategy = exports.SIGNET_JWT_STRATEGY = exports.bearerToken = exports.createScopeVocabulary = exports.Public = exports.IS_PUBLIC_ROUTE = exports.createProtectedResourceController = exports.SIGNET_PRINCIPAL_RESOLVER = exports.PrincipalStoreUnavailableError = exports.createSignetPrincipalDecorator = exports.SIGNET_INTEGRATION_OPTIONS = exports.DEVELOPMENT_ENVIRONMENT = exports.SignetIntegrationModule = exports.REMOTE_JWKS_OPTIONS = exports.JwtVerifier = exports.JwtRejectionEnum = exports.SignetBearerGuard = exports.SignetDeploymentProfileService = exports.resolveDeploymentProfile = exports.readSignetAuthConfig = exports.readChannelFlags = exports.BearerChallengeFilter = exports.protectedResourceMetadataUrl = exports.protectedResourceMetadataPath = exports.isResourceRequest = exports.InsufficientScopeException = exports.insufficientScopeChallenge = exports.challengeFor = exports.carriesScopeChallenge = exports.bearerChallenge = void 0;
3
+ exports.validateSignetIntegrationOptions = exports.SignetJwtStrategy = exports.SignetBearerVerification = exports.SIGNET_JWT_STRATEGY = exports.bearerToken = exports.createScopeVocabulary = exports.Public = exports.IS_PUBLIC_ROUTE = exports.createProtectedResourceController = exports.SignetPrincipalStrategy = exports.SIGNET_PRINCIPAL_RESOLVER = exports.PrincipalStoreUnavailableError = exports.createSignetPrincipalDecorator = exports.SignetPassportGuard = exports.SIGNET_INTEGRATION_OPTIONS = exports.DEVELOPMENT_ENVIRONMENT = exports.SignetIntegrationModule = exports.REMOTE_JWKS_OPTIONS = exports.JwtVerifier = exports.JwtRejectionEnum = exports.SignetBearerGuard = exports.SignetDeploymentProfileService = exports.resolveDeploymentProfile = exports.SignetDecision = exports.readSignetAuthConfig = exports.readChannelFlags = exports.BearerChallengeFilter = exports.protectedResourceMetadataUrl = exports.protectedResourceMetadataPath = exports.isResourceRequest = exports.InsufficientScopeException = exports.insufficientScopeChallenge = exports.challengeFor = exports.carriesScopeChallenge = exports.bearerChallenge = void 0;
4
4
  var bearer_challenge_1 = require("./bearer-challenge");
5
5
  Object.defineProperty(exports, "bearerChallenge", { enumerable: true, get: function () { return bearer_challenge_1.bearerChallenge; } });
6
6
  Object.defineProperty(exports, "carriesScopeChallenge", { enumerable: true, get: function () { return bearer_challenge_1.carriesScopeChallenge; } });
@@ -15,6 +15,8 @@ Object.defineProperty(exports, "BearerChallengeFilter", { enumerable: true, get:
15
15
  var config_1 = require("./config");
16
16
  Object.defineProperty(exports, "readChannelFlags", { enumerable: true, get: function () { return config_1.readChannelFlags; } });
17
17
  Object.defineProperty(exports, "readSignetAuthConfig", { enumerable: true, get: function () { return config_1.readSignetAuthConfig; } });
18
+ var decision_1 = require("./decision");
19
+ Object.defineProperty(exports, "SignetDecision", { enumerable: true, get: function () { return decision_1.SignetDecision; } });
18
20
  var deployment_profile_1 = require("./deployment-profile");
19
21
  Object.defineProperty(exports, "resolveDeploymentProfile", { enumerable: true, get: function () { return deployment_profile_1.resolveDeploymentProfile; } });
20
22
  Object.defineProperty(exports, "SignetDeploymentProfileService", { enumerable: true, get: function () { return deployment_profile_1.SignetDeploymentProfileService; } });
@@ -29,11 +31,15 @@ Object.defineProperty(exports, "SignetIntegrationModule", { enumerable: true, ge
29
31
  var options_1 = require("./options");
30
32
  Object.defineProperty(exports, "DEVELOPMENT_ENVIRONMENT", { enumerable: true, get: function () { return options_1.DEVELOPMENT_ENVIRONMENT; } });
31
33
  Object.defineProperty(exports, "SIGNET_INTEGRATION_OPTIONS", { enumerable: true, get: function () { return options_1.SIGNET_INTEGRATION_OPTIONS; } });
34
+ var passport_guard_1 = require("./passport-guard");
35
+ Object.defineProperty(exports, "SignetPassportGuard", { enumerable: true, get: function () { return passport_guard_1.SignetPassportGuard; } });
32
36
  var principal_decorator_1 = require("./principal.decorator");
33
37
  Object.defineProperty(exports, "createSignetPrincipalDecorator", { enumerable: true, get: function () { return principal_decorator_1.createSignetPrincipalDecorator; } });
34
38
  var principal_resolver_1 = require("./principal-resolver");
35
39
  Object.defineProperty(exports, "PrincipalStoreUnavailableError", { enumerable: true, get: function () { return principal_resolver_1.PrincipalStoreUnavailableError; } });
36
40
  Object.defineProperty(exports, "SIGNET_PRINCIPAL_RESOLVER", { enumerable: true, get: function () { return principal_resolver_1.SIGNET_PRINCIPAL_RESOLVER; } });
41
+ var principal_strategy_1 = require("./principal-strategy");
42
+ Object.defineProperty(exports, "SignetPrincipalStrategy", { enumerable: true, get: function () { return principal_strategy_1.SignetPrincipalStrategy; } });
37
43
  var protected_resource_controller_1 = require("./protected-resource.controller");
38
44
  Object.defineProperty(exports, "createProtectedResourceController", { enumerable: true, get: function () { return protected_resource_controller_1.createProtectedResourceController; } });
39
45
  var public_decorator_1 = require("./public.decorator");
@@ -44,6 +50,7 @@ Object.defineProperty(exports, "createScopeVocabulary", { enumerable: true, get:
44
50
  var strategy_1 = require("./strategy");
45
51
  Object.defineProperty(exports, "bearerToken", { enumerable: true, get: function () { return strategy_1.bearerToken; } });
46
52
  Object.defineProperty(exports, "SIGNET_JWT_STRATEGY", { enumerable: true, get: function () { return strategy_1.SIGNET_JWT_STRATEGY; } });
53
+ Object.defineProperty(exports, "SignetBearerVerification", { enumerable: true, get: function () { return strategy_1.SignetBearerVerification; } });
47
54
  Object.defineProperty(exports, "SignetJwtStrategy", { enumerable: true, get: function () { return strategy_1.SignetJwtStrategy; } });
48
55
  var validate_options_1 = require("./validate-options");
49
56
  Object.defineProperty(exports, "validateSignetIntegrationOptions", { enumerable: true, get: function () { return validate_options_1.validateSignetIntegrationOptions; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAW4B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type T
2
2
  import { type SignetIntegrationOptions } from './options';
3
3
  import { type SignetPrincipalResolver } from './principal-resolver';
4
4
  export type ResolverProvider = Omit<ExistingProvider<SignetPrincipalResolver>, 'provide'> | Omit<FactoryProvider<SignetPrincipalResolver>, 'provide'> | Omit<ValueProvider<SignetPrincipalResolver>, 'provide'> | Type<SignetPrincipalResolver>;
5
- export interface SignetIntegrationModuleOptions {
5
+ export interface SignetPassportModuleOptions {
6
6
  readonly imports?: DynamicModule['imports'];
7
7
  readonly options: SignetIntegrationOptions;
8
+ }
9
+ export interface SignetIntegrationModuleOptions extends SignetPassportModuleOptions {
8
10
  readonly resolver: ResolverProvider;
9
11
  }
10
12
  export declare class SignetIntegrationModule {
13
+ static forPassport(input: SignetPassportModuleOptions): DynamicModule;
11
14
  static forRoot(input: SignetIntegrationModuleOptions): DynamicModule;
12
15
  }
package/dist/module.js CHANGED
@@ -9,35 +9,39 @@ var SignetIntegrationModule_1;
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.SignetIntegrationModule = void 0;
11
11
  const common_1 = require("@nestjs/common");
12
+ const decision_1 = require("./decision");
12
13
  const deployment_profile_1 = require("./deployment-profile");
13
14
  const guard_1 = require("./guard");
14
15
  const options_1 = require("./options");
16
+ const passport_guard_1 = require("./passport-guard");
15
17
  const principal_resolver_1 = require("./principal-resolver");
16
18
  const strategy_1 = require("./strategy");
17
19
  const validate_options_1 = require("./validate-options");
18
- // Wires the Bearer channel: options behind their token, the consumer's
19
- // resolver behind its token, the deployment profile, the Passport strategy
20
- // (which registers itself by name in its constructor, so it must be a
21
- // provider) and the guard. Exports everything a consumer's own auth module
22
- // re-exports or a dispatcher injects.
20
+ // Two ways in, one set of providers underneath.
23
21
  //
24
- // NOT here: the metadata controller (createProtectedResourceController --
22
+ // forPassport: the consumer brings its own strategy (a SignetPrincipalStrategy
23
+ // subclass, registered as a provider in the consumer's module) and guards
24
+ // with SignetPassportGuard or any AuthGuard(SIGNET_JWT_STRATEGY). This
25
+ // module then provides what that strategy injects: the options behind their
26
+ // token, the deployment profile, and SignetDecision.
27
+ //
28
+ // forRoot: the module-wired shape. Adds the consumer's resolver behind its
29
+ // token, SignetJwtStrategy (which registers itself by name in its
30
+ // constructor, so it must be a provider) and SignetBearerGuard.
31
+ //
32
+ // NOT here either way: the metadata controller (createProtectedResourceController --
25
33
  // the consumer declares it in the module of the process that serves the
26
34
  // resource), the exception filter (BearerChallengeFilter as APP_FILTER, or
27
35
  // the consumer's own filter calling challengeFor), and the guard's mounting
28
36
  // (APP_GUARD, or inside a consumer's credential dispatcher).
29
37
  let SignetIntegrationModule = SignetIntegrationModule_1 = class SignetIntegrationModule {
30
- static forRoot(input) {
31
- const resolver = typeof input.resolver === 'function'
32
- ? { provide: principal_resolver_1.SIGNET_PRINCIPAL_RESOLVER, useClass: input.resolver }
33
- : { ...input.resolver, provide: principal_resolver_1.SIGNET_PRINCIPAL_RESOLVER };
38
+ static forPassport(input) {
34
39
  return {
35
40
  exports: [
36
41
  options_1.SIGNET_INTEGRATION_OPTIONS,
37
- principal_resolver_1.SIGNET_PRINCIPAL_RESOLVER,
38
- guard_1.SignetBearerGuard,
42
+ decision_1.SignetDecision,
39
43
  deployment_profile_1.SignetDeploymentProfileService,
40
- strategy_1.SignetJwtStrategy,
44
+ passport_guard_1.SignetPassportGuard,
41
45
  ],
42
46
  imports: input.imports ?? [],
43
47
  module: SignetIntegrationModule_1,
@@ -46,9 +50,29 @@ let SignetIntegrationModule = SignetIntegrationModule_1 = class SignetIntegratio
46
50
  provide: options_1.SIGNET_INTEGRATION_OPTIONS,
47
51
  useValue: (0, validate_options_1.validateSignetIntegrationOptions)(input.options),
48
52
  },
53
+ decision_1.SignetDecision,
54
+ deployment_profile_1.SignetDeploymentProfileService,
55
+ passport_guard_1.SignetPassportGuard,
56
+ ],
57
+ };
58
+ }
59
+ static forRoot(input) {
60
+ const resolver = typeof input.resolver === 'function'
61
+ ? { provide: principal_resolver_1.SIGNET_PRINCIPAL_RESOLVER, useClass: input.resolver }
62
+ : { ...input.resolver, provide: principal_resolver_1.SIGNET_PRINCIPAL_RESOLVER };
63
+ const base = SignetIntegrationModule_1.forPassport(input);
64
+ return {
65
+ ...base,
66
+ exports: [
67
+ ...(base.exports ?? []),
68
+ principal_resolver_1.SIGNET_PRINCIPAL_RESOLVER,
69
+ guard_1.SignetBearerGuard,
70
+ strategy_1.SignetJwtStrategy,
71
+ ],
72
+ providers: [
73
+ ...(base.providers ?? []),
49
74
  resolver,
50
75
  guard_1.SignetBearerGuard,
51
- deployment_profile_1.SignetDeploymentProfileService,
52
76
  strategy_1.SignetJwtStrategy,
53
77
  ],
54
78
  };
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAQwB;AAExB,6DAAsE;AACtE,mCAA4C;AAC5C,uCAGmB;AACnB,6DAG8B;AAC9B,yCAA+C;AAC/C,yDAAsE;AAoBtE,uEAAuE;AACvE,2EAA2E;AAC3E,sEAAsE;AACtE,2EAA2E;AAC3E,sCAAsC;AACtC,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,2EAA2E;AAC3E,4EAA4E;AAC5E,6DAA6D;AAEtD,IAAM,uBAAuB,+BAA7B,MAAM,uBAAuB;IAClC,MAAM,CAAC,OAAO,CAAC,KAAqC;QAClD,MAAM,QAAQ,GACZ,OAAO,KAAK,CAAC,QAAQ,KAAK,UAAU;YAClC,CAAC,CAAC,EAAE,OAAO,EAAE,8CAAyB,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;YAClE,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,8CAAyB,EAAE,CAAC;QAChE,OAAO;YACL,OAAO,EAAE;gBACP,oCAA0B;gBAC1B,8CAAyB;gBACzB,yBAAiB;gBACjB,mDAA8B;gBAC9B,4BAAiB;aAClB;YACD,OAAO,EAAE,KAAK,CAAC,OAAO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aACpB;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,KAAqC;QAClD,MAAM,QAAQ,GACZ,OAAO,KAAK,CAAC,QAAQ,KAAK,UAAU;YAClC,CAAC,CAAC,EAAE,OAAO,EAAE,8CAAyB,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;YAClE,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,8CAAyB,EAAE,CAAC;QAChE,MAAM,IAAI,GAAG,yBAAuB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACxD,OAAO;YACL,GAAG,IAAI;YACP,OAAO,EAAE;gBACP,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;gBACvB,8CAAyB;gBACzB,yBAAiB;gBACjB,4BAAiB;aAClB;YACD,SAAS,EAAE;gBACT,GAAG,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;gBACzB,QAAQ;gBACR,yBAAiB;gBACjB,4BAAiB;aAClB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA7CY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,uBAAuB,CA6CnC"}
@@ -0,0 +1,17 @@
1
+ export { bearerChallenge, carriesScopeChallenge, type ChallengeDecision, challengeFor, insufficientScopeChallenge, InsufficientScopeException, isResourceRequest, protectedResourceMetadataPath, protectedResourceMetadataUrl, type ScopeChallengeCarrier, } from '../bearer-challenge';
2
+ export { BearerChallengeFilter } from '../bearer-challenge.filter';
3
+ export { type ChannelFlags, type JwtSettings, readChannelFlags, readSignetAuthConfig, type SignetAuthConfig, type SignetEnvOptions, } from '../config';
4
+ export { type DecisionContext, SignetDecision } from '../decision';
5
+ export { type DeploymentProfile, type DeploymentProfileInput, type DeploymentProfileResolution, resolveDeploymentProfile, SignetDeploymentProfileService, } from '../deployment-profile';
6
+ export { SignetBearerGuard } from '../guard';
7
+ export { type JwtRejection, JwtRejectionEnum, JwtVerifier, REMOTE_JWKS_OPTIONS, type VerifiedSignetIdentity, type VerifyResult, } from '../jwt-verifier';
8
+ export { type ResolverProvider, SignetIntegrationModule, type SignetIntegrationModuleOptions, type SignetPassportModuleOptions, } from '../module';
9
+ export { DEVELOPMENT_ENVIRONMENT, SIGNET_INTEGRATION_OPTIONS, type SignetDeployedProfile, type SignetDevelopmentProfile, type SignetEnvNames, type SignetIntegrationOptions, } from '../options';
10
+ export { type AuthenticatedRequest, SignetPassportGuard, } from '../passport-guard';
11
+ export { createSignetPrincipalDecorator } from '../principal.decorator';
12
+ export { type PrincipalResolution, PrincipalStoreUnavailableError, SIGNET_PRINCIPAL_RESOLVER, type SignetPrincipalResolver, } from '../principal-resolver';
13
+ export { SignetPrincipalStrategy } from '../principal-strategy';
14
+ export { IS_PUBLIC_ROUTE, Public } from '../public.decorator';
15
+ export { createScopeVocabulary, type ScopeVocabulary, type ScopeVocabularyInput, type TokenScopeRead, } from '../scope-vocabulary';
16
+ export { bearerToken, SIGNET_JWT_STRATEGY, SignetBearerVerification, SignetJwtStrategy, } from '../strategy';
17
+ export { validateSignetIntegrationOptions } from '../validate-options';
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateSignetIntegrationOptions = exports.SignetJwtStrategy = exports.SignetBearerVerification = exports.SIGNET_JWT_STRATEGY = exports.bearerToken = exports.createScopeVocabulary = exports.Public = exports.IS_PUBLIC_ROUTE = exports.SignetPrincipalStrategy = exports.SIGNET_PRINCIPAL_RESOLVER = exports.PrincipalStoreUnavailableError = exports.createSignetPrincipalDecorator = exports.SignetPassportGuard = exports.SIGNET_INTEGRATION_OPTIONS = exports.DEVELOPMENT_ENVIRONMENT = exports.SignetIntegrationModule = exports.REMOTE_JWKS_OPTIONS = exports.JwtVerifier = exports.JwtRejectionEnum = exports.SignetBearerGuard = exports.SignetDeploymentProfileService = exports.resolveDeploymentProfile = exports.SignetDecision = exports.readSignetAuthConfig = exports.readChannelFlags = exports.BearerChallengeFilter = exports.protectedResourceMetadataUrl = exports.protectedResourceMetadataPath = exports.isResourceRequest = exports.InsufficientScopeException = exports.insufficientScopeChallenge = exports.challengeFor = exports.carriesScopeChallenge = exports.bearerChallenge = void 0;
4
+ // The Passport-level API: everything in the main entry except the RFC 9728
5
+ // metadata controller, whose file needs @nestjs/swagger and @nestjs/throttler.
6
+ // A consumer that serves the metadata elsewhere (or not at all) imports from
7
+ // here and installs neither.
8
+ var bearer_challenge_1 = require("../bearer-challenge");
9
+ Object.defineProperty(exports, "bearerChallenge", { enumerable: true, get: function () { return bearer_challenge_1.bearerChallenge; } });
10
+ Object.defineProperty(exports, "carriesScopeChallenge", { enumerable: true, get: function () { return bearer_challenge_1.carriesScopeChallenge; } });
11
+ Object.defineProperty(exports, "challengeFor", { enumerable: true, get: function () { return bearer_challenge_1.challengeFor; } });
12
+ Object.defineProperty(exports, "insufficientScopeChallenge", { enumerable: true, get: function () { return bearer_challenge_1.insufficientScopeChallenge; } });
13
+ Object.defineProperty(exports, "InsufficientScopeException", { enumerable: true, get: function () { return bearer_challenge_1.InsufficientScopeException; } });
14
+ Object.defineProperty(exports, "isResourceRequest", { enumerable: true, get: function () { return bearer_challenge_1.isResourceRequest; } });
15
+ Object.defineProperty(exports, "protectedResourceMetadataPath", { enumerable: true, get: function () { return bearer_challenge_1.protectedResourceMetadataPath; } });
16
+ Object.defineProperty(exports, "protectedResourceMetadataUrl", { enumerable: true, get: function () { return bearer_challenge_1.protectedResourceMetadataUrl; } });
17
+ var bearer_challenge_filter_1 = require("../bearer-challenge.filter");
18
+ Object.defineProperty(exports, "BearerChallengeFilter", { enumerable: true, get: function () { return bearer_challenge_filter_1.BearerChallengeFilter; } });
19
+ var config_1 = require("../config");
20
+ Object.defineProperty(exports, "readChannelFlags", { enumerable: true, get: function () { return config_1.readChannelFlags; } });
21
+ Object.defineProperty(exports, "readSignetAuthConfig", { enumerable: true, get: function () { return config_1.readSignetAuthConfig; } });
22
+ var decision_1 = require("../decision");
23
+ Object.defineProperty(exports, "SignetDecision", { enumerable: true, get: function () { return decision_1.SignetDecision; } });
24
+ var deployment_profile_1 = require("../deployment-profile");
25
+ Object.defineProperty(exports, "resolveDeploymentProfile", { enumerable: true, get: function () { return deployment_profile_1.resolveDeploymentProfile; } });
26
+ Object.defineProperty(exports, "SignetDeploymentProfileService", { enumerable: true, get: function () { return deployment_profile_1.SignetDeploymentProfileService; } });
27
+ var guard_1 = require("../guard");
28
+ Object.defineProperty(exports, "SignetBearerGuard", { enumerable: true, get: function () { return guard_1.SignetBearerGuard; } });
29
+ var jwt_verifier_1 = require("../jwt-verifier");
30
+ Object.defineProperty(exports, "JwtRejectionEnum", { enumerable: true, get: function () { return jwt_verifier_1.JwtRejectionEnum; } });
31
+ Object.defineProperty(exports, "JwtVerifier", { enumerable: true, get: function () { return jwt_verifier_1.JwtVerifier; } });
32
+ Object.defineProperty(exports, "REMOTE_JWKS_OPTIONS", { enumerable: true, get: function () { return jwt_verifier_1.REMOTE_JWKS_OPTIONS; } });
33
+ var module_1 = require("../module");
34
+ Object.defineProperty(exports, "SignetIntegrationModule", { enumerable: true, get: function () { return module_1.SignetIntegrationModule; } });
35
+ var options_1 = require("../options");
36
+ Object.defineProperty(exports, "DEVELOPMENT_ENVIRONMENT", { enumerable: true, get: function () { return options_1.DEVELOPMENT_ENVIRONMENT; } });
37
+ Object.defineProperty(exports, "SIGNET_INTEGRATION_OPTIONS", { enumerable: true, get: function () { return options_1.SIGNET_INTEGRATION_OPTIONS; } });
38
+ var passport_guard_1 = require("../passport-guard");
39
+ Object.defineProperty(exports, "SignetPassportGuard", { enumerable: true, get: function () { return passport_guard_1.SignetPassportGuard; } });
40
+ var principal_decorator_1 = require("../principal.decorator");
41
+ Object.defineProperty(exports, "createSignetPrincipalDecorator", { enumerable: true, get: function () { return principal_decorator_1.createSignetPrincipalDecorator; } });
42
+ var principal_resolver_1 = require("../principal-resolver");
43
+ Object.defineProperty(exports, "PrincipalStoreUnavailableError", { enumerable: true, get: function () { return principal_resolver_1.PrincipalStoreUnavailableError; } });
44
+ Object.defineProperty(exports, "SIGNET_PRINCIPAL_RESOLVER", { enumerable: true, get: function () { return principal_resolver_1.SIGNET_PRINCIPAL_RESOLVER; } });
45
+ var principal_strategy_1 = require("../principal-strategy");
46
+ Object.defineProperty(exports, "SignetPrincipalStrategy", { enumerable: true, get: function () { return principal_strategy_1.SignetPrincipalStrategy; } });
47
+ var public_decorator_1 = require("../public.decorator");
48
+ Object.defineProperty(exports, "IS_PUBLIC_ROUTE", { enumerable: true, get: function () { return public_decorator_1.IS_PUBLIC_ROUTE; } });
49
+ Object.defineProperty(exports, "Public", { enumerable: true, get: function () { return public_decorator_1.Public; } });
50
+ var scope_vocabulary_1 = require("../scope-vocabulary");
51
+ Object.defineProperty(exports, "createScopeVocabulary", { enumerable: true, get: function () { return scope_vocabulary_1.createScopeVocabulary; } });
52
+ var strategy_1 = require("../strategy");
53
+ Object.defineProperty(exports, "bearerToken", { enumerable: true, get: function () { return strategy_1.bearerToken; } });
54
+ Object.defineProperty(exports, "SIGNET_JWT_STRATEGY", { enumerable: true, get: function () { return strategy_1.SIGNET_JWT_STRATEGY; } });
55
+ Object.defineProperty(exports, "SignetBearerVerification", { enumerable: true, get: function () { return strategy_1.SignetBearerVerification; } });
56
+ Object.defineProperty(exports, "SignetJwtStrategy", { enumerable: true, get: function () { return strategy_1.SignetJwtStrategy; } });
57
+ var validate_options_1 = require("../validate-options");
58
+ Object.defineProperty(exports, "validateSignetIntegrationOptions", { enumerable: true, get: function () { return validate_options_1.validateSignetIntegrationOptions; } });
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/passport/index.ts"],"names":[],"mappings":";;;AAAA,2EAA2E;AAC3E,+EAA+E;AAC/E,6EAA6E;AAC7E,6BAA6B;AAC7B,wDAW6B;AAV3B,mHAAA,eAAe,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@nestjs/core';
3
+ import { type Request } from 'express';
4
+ export declare function ownConstructorParametersRequired(): ClassDecorator;
5
+ export type AuthenticatedRequest<U = unknown> = Omit<Request, 'user'> & {
6
+ user: U;
7
+ [key: string]: unknown;
8
+ };
9
+ declare const SignetPassportGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
10
+ export declare class SignetPassportGuard extends SignetPassportGuard_base {
11
+ private readonly reflector;
12
+ private readonly passportLogger;
13
+ constructor(reflector: Reflector);
14
+ canActivate(context: ExecutionContext): Promise<boolean>;
15
+ protected authenticate<U = unknown>(context: ExecutionContext): Promise<AuthenticatedRequest<U> | 'public'>;
16
+ }
17
+ export {};
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SignetPassportGuard = void 0;
13
+ exports.ownConstructorParametersRequired = ownConstructorParametersRequired;
14
+ const common_1 = require("@nestjs/common");
15
+ const core_1 = require("@nestjs/core");
16
+ const passport_1 = require("@nestjs/passport");
17
+ const decision_1 = require("./decision");
18
+ const public_decorator_1 = require("./public.decorator");
19
+ const strategy_1 = require("./strategy");
20
+ // Nest's OPTIONAL_DEPS_METADATA. `@nestjs/common` does not re-export it.
21
+ const OPTIONAL_PARAMTYPES = 'optional:paramtypes';
22
+ // AuthGuard's mixin marks its constructor parameter 0 `@Optional()`.
23
+ // `Reflect.getMetadata` walks the constructor prototype chain, so a subclass
24
+ // that never writes its own list treats ITS parameter 0 as optional.
25
+ // `@Optional()` on a later parameter copies that inherited list onto this
26
+ // constructor before appending its own index. Parameter decorators run
27
+ // before this one, so the copy is already own metadata by the time this
28
+ // drops index 0 (and writes a list when absent).
29
+ function ownConstructorParametersRequired() {
30
+ return (target) => {
31
+ const own = Reflect.getOwnMetadata(OPTIONAL_PARAMTYPES, target);
32
+ const optionalIndexes = Array.isArray(own)
33
+ ? own.filter((index) => index !== 0)
34
+ : [];
35
+ Reflect.defineMetadata(OPTIONAL_PARAMTYPES, optionalIndexes, target);
36
+ };
37
+ }
38
+ // Passport's AuthGuard for the Signet strategy plus the two things every
39
+ // consumer of it needs: a route marked `@Public()` (on the handler or its
40
+ // class) is let through without running the strategy, so this can be an
41
+ // APP_GUARD on its own; and a strategy refusal is ONE indistinguishable 401,
42
+ // whatever Passport's own exception said.
43
+ //
44
+ // This is the whole guard for a consumer whose strategy already resolves the
45
+ // principal (SignetPrincipalStrategy): Passport has put it on request.user.
46
+ // SignetBearerGuard extends it for the module-wired resolver.
47
+ let SignetPassportGuard = class SignetPassportGuard extends (0, passport_1.AuthGuard)(strategy_1.SIGNET_JWT_STRATEGY) {
48
+ reflector;
49
+ passportLogger = new common_1.Logger(this.constructor.name);
50
+ constructor(reflector) {
51
+ super();
52
+ this.reflector = reflector;
53
+ }
54
+ async canActivate(context) {
55
+ await this.authenticate(context);
56
+ return true;
57
+ }
58
+ // 'public' when the route opted out; otherwise the request with Passport's
59
+ // user attached. A consumer with a credential dispatcher of its own decides
60
+ // `@Public()` there and never hands a public route to this guard.
61
+ async authenticate(context) {
62
+ if (this.reflector.getAllAndOverride(public_decorator_1.IS_PUBLIC_ROUTE, [
63
+ context.getHandler(),
64
+ context.getClass(),
65
+ ]) === true) {
66
+ return 'public';
67
+ }
68
+ // Typed unknown: the base declares boolean | Promise<boolean> |
69
+ // Observable<boolean>, and anything other than a literal true is treated
70
+ // as "did not pass".
71
+ let passed;
72
+ try {
73
+ passed = await super.canActivate(context);
74
+ }
75
+ catch (error) {
76
+ // Passport's own UnauthorizedException carries a message; the contract
77
+ // is one indistinguishable 401. Anything else is a programming error
78
+ // and must not be dressed up as an authentication failure.
79
+ if (error instanceof common_1.UnauthorizedException) {
80
+ throw new common_1.UnauthorizedException();
81
+ }
82
+ throw error;
83
+ }
84
+ const request = context
85
+ .switchToHttp()
86
+ .getRequest();
87
+ if (passed !== true || request.user === undefined) {
88
+ (0, decision_1.logFailure)(this.passportLogger, 'signet strategy did not pass cleanly', 'signet_identity_missing', 'none');
89
+ throw new common_1.InternalServerErrorException('signet strategy did not pass cleanly');
90
+ }
91
+ return request;
92
+ }
93
+ };
94
+ exports.SignetPassportGuard = SignetPassportGuard;
95
+ exports.SignetPassportGuard = SignetPassportGuard = __decorate([
96
+ (0, common_1.Injectable)(),
97
+ ownConstructorParametersRequired(),
98
+ __metadata("design:paramtypes", [core_1.Reflector])
99
+ ], SignetPassportGuard);
100
+ //# sourceMappingURL=passport-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passport-guard.js","sourceRoot":"","sources":["../src/passport-guard.ts"],"names":[],"mappings":";;;;;;;;;;;;AAyBA,4EAQC;AAjCD,2CAMwB;AACxB,uCAAyC;AACzC,+CAA6C;AAG7C,yCAAwC;AACxC,yDAAqD;AACrD,yCAAiD;AAEjD,yEAAyE;AACzE,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAElD,qEAAqE;AACrE,6EAA6E;AAC7E,qEAAqE;AACrE,0EAA0E;AAC1E,uEAAuE;AACvE,wEAAwE;AACxE,iDAAiD;AACjD,SAAgB,gCAAgC;IAC9C,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,MAAM,GAAG,GAAY,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;QACzE,MAAM,eAAe,GAAG,KAAK,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O,KAAK,EAAE,CAAC;YACf,uEAAuE;YACvE,qEAAqE;YACrE,2DAA2D;YAC3D,IAAI,KAAK,YAAY,8BAAqB,EAAE,CAAC;gBAC3C,MAAM,IAAI,8BAAqB,EAAE,CAAC;YACpC,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,OAAO,GAAG,OAAO;aACpB,YAAY,EAAE;aACd,UAAU,EAAuC,CAAC;QACrD,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAClD,IAAA,qBAAU,EACR,IAAI,CAAC,cAAc,EACnB,sCAAsC,EACtC,yBAAyB,EACzB,MAAM,CACP,CAAC;YACF,MAAM,IAAI,qCAA4B,CACpC,sCAAsC,CACvC,CAAC;QACJ,CAAC;QACD,OAAO,OAAkC,CAAC;IAC5C,CAAC;CACF,CAAA;AAzDY,kDAAmB;8BAAnB,mBAAmB;IAF/B,IAAA,mBAAU,GAAE;IACZ,gCAAgC,EAAE;qCAIO,gBAAS;GAHtC,mBAAmB,CAyD/B"}
@@ -0,0 +1,17 @@
1
+ import { Logger, type OnModuleInit } from '@nestjs/common';
2
+ import { type Request } from 'express';
3
+ import { type VerifiedSignetIdentity } from './jwt-verifier';
4
+ import { type PrincipalResolution, type SignetPrincipalResolver } from './principal-resolver';
5
+ declare const SignetPrincipalStrategy_base: new (...args: any[]) => import("passport-custom");
6
+ export declare abstract class SignetPrincipalStrategy<P> extends SignetPrincipalStrategy_base implements SignetPrincipalResolver<P>, OnModuleInit {
7
+ protected readonly logger: Logger;
8
+ private readonly configService;
9
+ private readonly profiles;
10
+ private readonly options;
11
+ private readonly decision;
12
+ private verification;
13
+ abstract resolve(identity: VerifiedSignetIdentity): Promise<PrincipalResolution<P>>;
14
+ onModuleInit(): void;
15
+ validate(request: Request): Promise<P | false>;
16
+ }
17
+ export {};
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SignetPrincipalStrategy = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const config_1 = require("@nestjs/config");
15
+ const passport_1 = require("@nestjs/passport");
16
+ const passport_custom_1 = require("passport-custom");
17
+ const decision_1 = require("./decision");
18
+ const deployment_profile_1 = require("./deployment-profile");
19
+ const options_1 = require("./options");
20
+ const strategy_1 = require("./strategy");
21
+ // The Passport-native shape: a strategy whose validate() ends with the
22
+ // consumer's principal, which Passport then leaves on request.user. Subclass
23
+ // it and implement `resolve` -- Passport's verify callback, with the
24
+ // identity already proven -- and register the subclass as a provider; the
25
+ // package's dependencies are property-injected, so the subclass's
26
+ // constructor is its own.
27
+ //
28
+ // @Injectable()
29
+ // class MyStrategy extends SignetPrincipalStrategy<User> {
30
+ // constructor(private readonly users: UsersService) { super(); }
31
+ // async resolve(identity) { ... } // see SignetPrincipalResolver
32
+ // }
33
+ //
34
+ // Verification and the outcome's classification are the same code
35
+ // SignetBearerGuard runs (SignetBearerVerification, SignetDecision), so a
36
+ // consumer on this path gets the same 401/403/503/500 contract and the same
37
+ // decision log line, written under the subclass's name. Guard it with
38
+ // SignetPassportGuard, or any AuthGuard(SIGNET_JWT_STRATEGY).
39
+ let SignetPrincipalStrategy = class SignetPrincipalStrategy extends (0, passport_1.PassportStrategy)(passport_custom_1.Strategy, strategy_1.SIGNET_JWT_STRATEGY) {
40
+ logger = new common_1.Logger(this.constructor.name);
41
+ configService;
42
+ profiles;
43
+ options;
44
+ decision;
45
+ verification;
46
+ // Property injection lands after construction, so the verifier (and its
47
+ // startup line) is built here rather than in the constructor.
48
+ onModuleInit() {
49
+ this.verification = new strategy_1.SignetBearerVerification(this.configService, this.profiles, this.options, this.logger);
50
+ }
51
+ async validate(request) {
52
+ if (this.verification === undefined) {
53
+ throw new Error(`${this.constructor.name}: onModuleInit has not run; register the strategy as a provider`);
54
+ }
55
+ const identity = await this.verification.verify(request);
56
+ if (identity === false)
57
+ return false;
58
+ return this.decision.decide(identity, this, {
59
+ logger: this.logger,
60
+ source: request.ip,
61
+ });
62
+ }
63
+ };
64
+ exports.SignetPrincipalStrategy = SignetPrincipalStrategy;
65
+ __decorate([
66
+ (0, common_1.Inject)(config_1.ConfigService),
67
+ __metadata("design:type", config_1.ConfigService)
68
+ ], SignetPrincipalStrategy.prototype, "configService", void 0);
69
+ __decorate([
70
+ (0, common_1.Inject)(deployment_profile_1.SignetDeploymentProfileService),
71
+ __metadata("design:type", deployment_profile_1.SignetDeploymentProfileService)
72
+ ], SignetPrincipalStrategy.prototype, "profiles", void 0);
73
+ __decorate([
74
+ (0, common_1.Inject)(options_1.SIGNET_INTEGRATION_OPTIONS),
75
+ __metadata("design:type", Object)
76
+ ], SignetPrincipalStrategy.prototype, "options", void 0);
77
+ __decorate([
78
+ (0, common_1.Inject)(decision_1.SignetDecision),
79
+ __metadata("design:type", decision_1.SignetDecision)
80
+ ], SignetPrincipalStrategy.prototype, "decision", void 0);
81
+ exports.SignetPrincipalStrategy = SignetPrincipalStrategy = __decorate([
82
+ (0, common_1.Injectable)()
83
+ ], SignetPrincipalStrategy);
84
+ //# sourceMappingURL=principal-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"principal-strategy.js","sourceRoot":"","sources":["../src/principal-strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA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C,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE;YAC1C,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,OAAO,CAAC,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA5CqB,0DAAuB;AAO1B;IADhB,IAAA,eAAM,EAAC,sBAAa,CAAC;8BACW,sBAAa;8DAAC;AAE9B;IADhB,IAAA,eAAM,EAAC,mDAA8B,CAAC;8BACX,mDAA8B;yDAAC;AAE1C;IADhB,IAAA,eAAM,EAAC,oCAA0B,CAAC;;wDACiB;AAEnC;IADhB,IAAA,eAAM,EAAC,yBAAc,CAAC;8BACK,yBAAc;yDAAC;kCAbvB,uBAAuB;IAD5C,IAAA,mBAAU,GAAE;GACS,uBAAuB,CA4C5C"}
@@ -1,16 +1,22 @@
1
+ import { Logger } from '@nestjs/common';
1
2
  import { ConfigService } from '@nestjs/config';
2
3
  import { type Request } from 'express';
3
4
  import { SignetDeploymentProfileService } from './deployment-profile';
4
5
  import { type VerifiedSignetIdentity } from './jwt-verifier';
5
6
  import { type SignetIntegrationOptions } from './options';
6
7
  export declare const SIGNET_JWT_STRATEGY = "signet-jwt";
7
- declare const SignetJwtStrategy_base: new (...args: any[]) => import("passport-custom");
8
- export declare class SignetJwtStrategy extends SignetJwtStrategy_base {
8
+ export declare class SignetBearerVerification {
9
9
  private readonly logger;
10
10
  private readonly verifier;
11
+ constructor(configService: ConfigService, profiles: SignetDeploymentProfileService, options: SignetIntegrationOptions, logger: Logger);
12
+ verify(request: Request): Promise<VerifiedSignetIdentity | false>;
13
+ private reject;
14
+ }
15
+ declare const SignetJwtStrategy_base: new (...args: any[]) => import("passport-custom");
16
+ export declare class SignetJwtStrategy extends SignetJwtStrategy_base {
17
+ private readonly verification;
11
18
  constructor(configService: ConfigService, profiles: SignetDeploymentProfileService, options: SignetIntegrationOptions);
12
19
  validate(request: Request): Promise<VerifiedSignetIdentity | false>;
13
- private reject;
14
20
  }
15
21
  export declare function bearerToken(request: Request): string | undefined;
16
22
  export {};
package/dist/strategy.js CHANGED
@@ -13,7 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  var SignetJwtStrategy_1;
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.SignetJwtStrategy = exports.SIGNET_JWT_STRATEGY = void 0;
16
+ exports.SignetJwtStrategy = exports.SignetBearerVerification = exports.SIGNET_JWT_STRATEGY = void 0;
17
17
  exports.bearerToken = bearerToken;
18
18
  const common_1 = require("@nestjs/common");
19
19
  const config_1 = require("@nestjs/config");
@@ -25,11 +25,10 @@ const jwt_verifier_1 = require("./jwt-verifier");
25
25
  const log_sanitise_1 = require("./log-sanitise");
26
26
  const options_1 = require("./options");
27
27
  exports.SIGNET_JWT_STRATEGY = 'signet-jwt';
28
- // Extracts `Authorization: Bearer <jwt>` and hands it to JwtVerifier.
29
- // passport-custom rather than passport-jwt: passport-jwt is a second JWT
30
- // implementation (jsonwebtoken) with its own JWKS story, and two verifiers
31
- // means two places to get the algorithm allowlist right. Only Passport's
32
- // registration and dispatch are borrowed; the cryptography stays in one place.
28
+ // What a Signet strategy does before anything consumer-specific: read the
29
+ // channel's settings once, build the verifier once (the remote JWKS cache
30
+ // lives on it), and turn a request into a verified identity or a logged
31
+ // `false`. SignetJwtStrategy and SignetPrincipalStrategy both hold one.
33
32
  //
34
33
  // Failure is `false`, never a throw. Passport moves to the next strategy only
35
34
  // on fail(); error() short-circuits the chain, and Nest turns a thrown
@@ -38,14 +37,13 @@ exports.SIGNET_JWT_STRATEGY = 'signet-jwt';
38
37
  //
39
38
  // The log line carries the reason and the source address and NOTHING derived
40
39
  // from the token: no fingerprint, no sub.
41
- let SignetJwtStrategy = SignetJwtStrategy_1 = class SignetJwtStrategy extends (0, passport_1.PassportStrategy)(passport_custom_1.Strategy, exports.SIGNET_JWT_STRATEGY) {
42
- logger = new common_1.Logger(SignetJwtStrategy_1.name);
40
+ class SignetBearerVerification {
41
+ logger;
43
42
  verifier;
44
- constructor(configService, profiles, options) {
45
- super();
43
+ constructor(configService, profiles, options, logger) {
44
+ this.logger = logger;
46
45
  const config = (0, config_2.readSignetAuthConfig)(options, configService, profiles.profile);
47
46
  if (config.signetEnabled) {
48
- // Constructed once per process: the remote JWKS cache lives on it.
49
47
  this.verifier = new jwt_verifier_1.JwtVerifier(config.jwt);
50
48
  this.logger.log(`signet jwt verification loaded: iss=${config.jwt.issuer} aud=${config.jwt.audience}`);
51
49
  }
@@ -53,7 +51,7 @@ let SignetJwtStrategy = SignetJwtStrategy_1 = class SignetJwtStrategy extends (0
53
51
  this.verifier = null;
54
52
  }
55
53
  }
56
- async validate(request) {
54
+ async verify(request) {
57
55
  if (this.verifier === null)
58
56
  return this.reject(request, 'signet_disabled');
59
57
  const token = bearerToken(request);
@@ -71,6 +69,25 @@ let SignetJwtStrategy = SignetJwtStrategy_1 = class SignetJwtStrategy extends (0
71
69
  this.logger.warn(`signet auth rejected: metric=signet_auth_rejected reason=${(0, log_sanitise_1.sanitiseLogToken)(reason)} source=${(0, log_sanitise_1.sanitiseLogToken)(request.ip ?? 'none')} method=${(0, log_sanitise_1.sanitiseLogToken)(request.method)} route=${(0, log_sanitise_1.sanitiseLogToken)((0, log_sanitise_1.truncate)(request.originalUrl, log_sanitise_1.REFUSAL_ROUTE_MAX))}`);
72
70
  return false;
73
71
  }
72
+ }
73
+ exports.SignetBearerVerification = SignetBearerVerification;
74
+ // The strategy behind SignetBearerGuard: validate() is verification alone,
75
+ // and the verified identity is what Passport leaves on request.user. The
76
+ // guard then runs the module-wired resolver.
77
+ //
78
+ // passport-custom rather than passport-jwt: passport-jwt is a second JWT
79
+ // implementation (jsonwebtoken) with its own JWKS story, and two verifiers
80
+ // means two places to get the algorithm allowlist right. Only Passport's
81
+ // registration and dispatch are borrowed; the cryptography stays in one place.
82
+ let SignetJwtStrategy = SignetJwtStrategy_1 = class SignetJwtStrategy extends (0, passport_1.PassportStrategy)(passport_custom_1.Strategy, exports.SIGNET_JWT_STRATEGY) {
83
+ verification;
84
+ constructor(configService, profiles, options) {
85
+ super();
86
+ this.verification = new SignetBearerVerification(configService, profiles, options, new common_1.Logger(SignetJwtStrategy_1.name));
87
+ }
88
+ validate(request) {
89
+ return this.verification.verify(request);
90
+ }
74
91
  };
75
92
  exports.SignetJwtStrategy = SignetJwtStrategy;
76
93
  exports.SignetJwtStrategy = SignetJwtStrategy = SignetJwtStrategy_1 = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"strategy.js","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAwFA,kCAIC;AA5FD,2CAA4D;AAC5D,2CAA+C;AAC/C,+CAAoD;AAEpD,qDAA2C;AAE3C,qCAAgD;AAChD,6DAAsE;AACtE,iDAA0E;AAC1E,iDAA+E;AAC/E,uCAGmB;AAEN,QAAA,mBAAmB,GAAG,YAAY,CAAC;AAEhD,sEAAsE;AACtE,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,+EAA+E;AAC/E,EAAE;AACF,8EAA8E;AAC9E,uEAAuE;AACvE,8EAA8E;AAC9E,oCAAoC;AACpC,EAAE;AACF,6EAA6E;AAC7E,0CAA0C;AAEnC,IAAM,iBAAiB,yBAAvB,MAAM,iBAAkB,SAAQ,IAAA,2BAAgB,EACrD,0BAAQ,EACR,2BAAmB,CACpB;IACkB,MAAM,GAAG,IAAI,eAAM,CAAC,mBAAiB,CAAC,IAAI,CAAC,CAAC;IAC5C,QAAQ,CAAqB;IAE9C,YACE,aAA4B,EAC5B,QAAwC,EACJ,OAAiC;QAErE,KAAK,EAAE,CAAC;QACR,MAAM,MAAM,GAAG,IAAA,6BAAoB,EACjC,OAAO,EACP,aAAa,EACb,QAAQ,CAAC,OAAO,CACjB,CAAC;QACF,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACzB,mEAAmE;YACnE,IAAI,CAAC,QAAQ,GAAG,IAAI,0BAAW,CAAC,MAAM,CAAC,GA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