nitrostack 1.0.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/CHANGELOG.md +227 -0
- package/CONTRIBUTING.md +182 -0
- package/LICENSE +201 -0
- package/LICENSE_URLS_UPDATE_COMPLETE.md +388 -0
- package/NOTICE +153 -0
- package/README.md +571 -0
- package/dist/auth/api-key.d.ts +118 -0
- package/dist/auth/api-key.d.ts.map +1 -0
- package/dist/auth/api-key.js +168 -0
- package/dist/auth/api-key.js.map +1 -0
- package/dist/auth/client.d.ts +151 -0
- package/dist/auth/client.d.ts.map +1 -0
- package/dist/auth/client.js +330 -0
- package/dist/auth/client.js.map +1 -0
- package/dist/auth/index.d.ts +30 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +43 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/middleware.d.ts +95 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +260 -0
- package/dist/auth/middleware.js.map +1 -0
- package/dist/auth/pkce.d.ts +53 -0
- package/dist/auth/pkce.d.ts.map +1 -0
- package/dist/auth/pkce.js +105 -0
- package/dist/auth/pkce.js.map +1 -0
- package/dist/auth/quick-setup.d.ts +94 -0
- package/dist/auth/quick-setup.d.ts.map +1 -0
- package/dist/auth/quick-setup.js +210 -0
- package/dist/auth/quick-setup.js.map +1 -0
- package/dist/auth/server-integration.d.ts +97 -0
- package/dist/auth/server-integration.d.ts.map +1 -0
- package/dist/auth/server-integration.js +182 -0
- package/dist/auth/server-integration.js.map +1 -0
- package/dist/auth/server-metadata.d.ts +51 -0
- package/dist/auth/server-metadata.d.ts.map +1 -0
- package/dist/auth/server-metadata.js +106 -0
- package/dist/auth/server-metadata.js.map +1 -0
- package/dist/auth/simple-jwt.d.ts +88 -0
- package/dist/auth/simple-jwt.d.ts.map +1 -0
- package/dist/auth/simple-jwt.js +152 -0
- package/dist/auth/simple-jwt.js.map +1 -0
- package/dist/auth/token-store.d.ts +104 -0
- package/dist/auth/token-store.d.ts.map +1 -0
- package/dist/auth/token-store.js +205 -0
- package/dist/auth/token-store.js.map +1 -0
- package/dist/auth/token-validation.d.ts +47 -0
- package/dist/auth/token-validation.d.ts.map +1 -0
- package/dist/auth/token-validation.js +237 -0
- package/dist/auth/token-validation.js.map +1 -0
- package/dist/auth/types.d.ts +215 -0
- package/dist/auth/types.d.ts.map +1 -0
- package/dist/auth/types.js +6 -0
- package/dist/auth/types.js.map +1 -0
- package/dist/cli/commands/build.d.ts +6 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +104 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +7 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +312 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/generate-types.d.ts +8 -0
- package/dist/cli/commands/generate-types.d.ts.map +1 -0
- package/dist/cli/commands/generate-types.js +220 -0
- package/dist/cli/commands/generate-types.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +5 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +365 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/init.d.ts +7 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +365 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/start.d.ts +6 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +61 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +47 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/mcp-dev-wrapper.d.ts +3 -0
- package/dist/cli/mcp-dev-wrapper.d.ts.map +1 -0
- package/dist/cli/mcp-dev-wrapper.js +116 -0
- package/dist/cli/mcp-dev-wrapper.js.map +1 -0
- package/dist/core/apikey-module.d.ts +69 -0
- package/dist/core/apikey-module.d.ts.map +1 -0
- package/dist/core/apikey-module.js +114 -0
- package/dist/core/apikey-module.js.map +1 -0
- package/dist/core/app-decorator.d.ts +58 -0
- package/dist/core/app-decorator.d.ts.map +1 -0
- package/dist/core/app-decorator.js +261 -0
- package/dist/core/app-decorator.js.map +1 -0
- package/dist/core/builders.d.ts +38 -0
- package/dist/core/builders.d.ts.map +1 -0
- package/dist/core/builders.js +129 -0
- package/dist/core/builders.js.map +1 -0
- package/dist/core/component.d.ts +105 -0
- package/dist/core/component.d.ts.map +1 -0
- package/dist/core/component.js +182 -0
- package/dist/core/component.js.map +1 -0
- package/dist/core/config-module.d.ts +55 -0
- package/dist/core/config-module.d.ts.map +1 -0
- package/dist/core/config-module.js +94 -0
- package/dist/core/config-module.js.map +1 -0
- package/dist/core/decorators/cache.decorator.d.ts +61 -0
- package/dist/core/decorators/cache.decorator.d.ts.map +1 -0
- package/dist/core/decorators/cache.decorator.js +115 -0
- package/dist/core/decorators/cache.decorator.js.map +1 -0
- package/dist/core/decorators/health-check.decorator.d.ts +80 -0
- package/dist/core/decorators/health-check.decorator.d.ts.map +1 -0
- package/dist/core/decorators/health-check.decorator.js +153 -0
- package/dist/core/decorators/health-check.decorator.js.map +1 -0
- package/dist/core/decorators/rate-limit.decorator.d.ts +62 -0
- package/dist/core/decorators/rate-limit.decorator.d.ts.map +1 -0
- package/dist/core/decorators/rate-limit.decorator.js +129 -0
- package/dist/core/decorators/rate-limit.decorator.js.map +1 -0
- package/dist/core/decorators.d.ts +151 -0
- package/dist/core/decorators.d.ts.map +1 -0
- package/dist/core/decorators.js +142 -0
- package/dist/core/decorators.js.map +1 -0
- package/dist/core/di/container.d.ts +42 -0
- package/dist/core/di/container.d.ts.map +1 -0
- package/dist/core/di/container.js +76 -0
- package/dist/core/di/container.js.map +1 -0
- package/dist/core/di/injectable.decorator.d.ts +35 -0
- package/dist/core/di/injectable.decorator.d.ts.map +1 -0
- package/dist/core/di/injectable.decorator.js +57 -0
- package/dist/core/di/injectable.decorator.js.map +1 -0
- package/dist/core/errors.d.ts +54 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +87 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/events/event-emitter.d.ts +50 -0
- package/dist/core/events/event-emitter.d.ts.map +1 -0
- package/dist/core/events/event-emitter.js +94 -0
- package/dist/core/events/event-emitter.js.map +1 -0
- package/dist/core/events/event.decorator.d.ts +48 -0
- package/dist/core/events/event.decorator.d.ts.map +1 -0
- package/dist/core/events/event.decorator.js +68 -0
- package/dist/core/events/event.decorator.js.map +1 -0
- package/dist/core/filters/exception-filter.decorator.d.ts +40 -0
- package/dist/core/filters/exception-filter.decorator.d.ts.map +1 -0
- package/dist/core/filters/exception-filter.decorator.js +54 -0
- package/dist/core/filters/exception-filter.decorator.js.map +1 -0
- package/dist/core/filters/exception-filter.interface.d.ts +30 -0
- package/dist/core/filters/exception-filter.interface.d.ts.map +1 -0
- package/dist/core/filters/exception-filter.interface.js +2 -0
- package/dist/core/filters/exception-filter.interface.js.map +1 -0
- package/dist/core/guards/apikey.guard.d.ts +22 -0
- package/dist/core/guards/apikey.guard.d.ts.map +1 -0
- package/dist/core/guards/apikey.guard.js +11 -0
- package/dist/core/guards/apikey.guard.js.map +1 -0
- package/dist/core/guards/guard.interface.d.ts +18 -0
- package/dist/core/guards/guard.interface.d.ts.map +1 -0
- package/dist/core/guards/guard.interface.js +2 -0
- package/dist/core/guards/guard.interface.js.map +1 -0
- package/dist/core/guards/jwt.guard.d.ts +18 -0
- package/dist/core/guards/jwt.guard.d.ts.map +1 -0
- package/dist/core/guards/jwt.guard.js +2 -0
- package/dist/core/guards/jwt.guard.js.map +1 -0
- package/dist/core/guards/oauth.guard.d.ts +35 -0
- package/dist/core/guards/oauth.guard.d.ts.map +1 -0
- package/dist/core/guards/oauth.guard.js +2 -0
- package/dist/core/guards/oauth.guard.js.map +1 -0
- package/dist/core/guards/use-guards.decorator.d.ts +25 -0
- package/dist/core/guards/use-guards.decorator.d.ts.map +1 -0
- package/dist/core/guards/use-guards.decorator.js +32 -0
- package/dist/core/guards/use-guards.decorator.js.map +1 -0
- package/dist/core/health/health-checks.resource.d.ts +14 -0
- package/dist/core/health/health-checks.resource.d.ts.map +1 -0
- package/dist/core/health/health-checks.resource.js +29 -0
- package/dist/core/health/health-checks.resource.js.map +1 -0
- package/dist/core/index.d.ts +55 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +57 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/interceptors/interceptor.decorator.d.ts +37 -0
- package/dist/core/interceptors/interceptor.decorator.d.ts.map +1 -0
- package/dist/core/interceptors/interceptor.decorator.js +51 -0
- package/dist/core/interceptors/interceptor.decorator.js.map +1 -0
- package/dist/core/interceptors/interceptor.interface.d.ts +31 -0
- package/dist/core/interceptors/interceptor.interface.d.ts.map +1 -0
- package/dist/core/interceptors/interceptor.interface.js +2 -0
- package/dist/core/interceptors/interceptor.interface.js.map +1 -0
- package/dist/core/jwt-module.d.ts +51 -0
- package/dist/core/jwt-module.d.ts.map +1 -0
- package/dist/core/jwt-module.js +52 -0
- package/dist/core/jwt-module.js.map +1 -0
- package/dist/core/logger.d.ts +18 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +51 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/middleware/middleware.decorator.d.ts +39 -0
- package/dist/core/middleware/middleware.decorator.d.ts.map +1 -0
- package/dist/core/middleware/middleware.decorator.js +53 -0
- package/dist/core/middleware/middleware.decorator.js.map +1 -0
- package/dist/core/middleware/middleware.interface.d.ts +29 -0
- package/dist/core/middleware/middleware.interface.d.ts.map +1 -0
- package/dist/core/middleware/middleware.interface.js +2 -0
- package/dist/core/middleware/middleware.interface.js.map +1 -0
- package/dist/core/module.d.ts +74 -0
- package/dist/core/module.d.ts.map +1 -0
- package/dist/core/module.js +82 -0
- package/dist/core/module.js.map +1 -0
- package/dist/core/oauth-module.d.ts +144 -0
- package/dist/core/oauth-module.d.ts.map +1 -0
- package/dist/core/oauth-module.js +190 -0
- package/dist/core/oauth-module.js.map +1 -0
- package/dist/core/pipes/pipe.decorator.d.ts +55 -0
- package/dist/core/pipes/pipe.decorator.d.ts.map +1 -0
- package/dist/core/pipes/pipe.decorator.js +85 -0
- package/dist/core/pipes/pipe.decorator.js.map +1 -0
- package/dist/core/pipes/pipe.interface.d.ts +36 -0
- package/dist/core/pipes/pipe.interface.d.ts.map +1 -0
- package/dist/core/pipes/pipe.interface.js +2 -0
- package/dist/core/pipes/pipe.interface.js.map +1 -0
- package/dist/core/prompt.d.ts +37 -0
- package/dist/core/prompt.d.ts.map +1 -0
- package/dist/core/prompt.js +76 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/resource.d.ts +42 -0
- package/dist/core/resource.d.ts.map +1 -0
- package/dist/core/resource.js +90 -0
- package/dist/core/resource.js.map +1 -0
- package/dist/core/server.d.ts +72 -0
- package/dist/core/server.d.ts.map +1 -0
- package/dist/core/server.js +406 -0
- package/dist/core/server.js.map +1 -0
- package/dist/core/tool.d.ts +78 -0
- package/dist/core/tool.d.ts.map +1 -0
- package/dist/core/tool.js +190 -0
- package/dist/core/tool.js.map +1 -0
- package/dist/core/transports/http-server.d.ts +102 -0
- package/dist/core/transports/http-server.d.ts.map +1 -0
- package/dist/core/transports/http-server.js +265 -0
- package/dist/core/transports/http-server.js.map +1 -0
- package/dist/core/types.d.ts +123 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/widgets/widget-examples.resource.d.ts +17 -0
- package/dist/core/widgets/widget-examples.resource.d.ts.map +1 -0
- package/dist/core/widgets/widget-examples.resource.js +28 -0
- package/dist/core/widgets/widget-examples.resource.js.map +1 -0
- package/dist/core/widgets/widget-registry.d.ts +56 -0
- package/dist/core/widgets/widget-registry.d.ts.map +1 -0
- package/dist/core/widgets/widget-registry.js +75 -0
- package/dist/core/widgets/widget-registry.js.map +1 -0
- package/dist/testing/index.d.ts +82 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +164 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/ui-next/index.d.ts +31 -0
- package/dist/ui-next/index.d.ts.map +1 -0
- package/dist/ui-next/index.js +687 -0
- package/dist/ui-next/index.js.map +1 -0
- package/dist/widgets/index.d.ts +9 -0
- package/dist/widgets/index.d.ts.map +1 -0
- package/dist/widgets/index.js +9 -0
- package/dist/widgets/index.js.map +1 -0
- package/dist/widgets/metadata.d.ts +53 -0
- package/dist/widgets/metadata.d.ts.map +1 -0
- package/dist/widgets/metadata.js +29 -0
- package/dist/widgets/metadata.js.map +1 -0
- package/dist/widgets/withToolData.d.ts +19 -0
- package/dist/widgets/withToolData.d.ts.map +1 -0
- package/dist/widgets/withToolData.js +240 -0
- package/dist/widgets/withToolData.js.map +1 -0
- package/jest.config.js +21 -0
- package/package.json +108 -0
- package/templates/typescript-auth/AI_AGENT_CLI_REFERENCE.md +702 -0
- package/templates/typescript-auth/AI_AGENT_SDK_REFERENCE.md +1260 -0
- package/templates/typescript-auth/README.md +400 -0
- package/templates/typescript-auth/package.json +44 -0
- package/templates/typescript-auth-api-key/AI_AGENT_CLI_REFERENCE.md +701 -0
- package/templates/typescript-auth-api-key/AI_AGENT_SDK_REFERENCE.md +1260 -0
- package/templates/typescript-auth-api-key/README.md +483 -0
- package/templates/typescript-auth-api-key/package-lock.json +124 -0
- package/templates/typescript-auth-api-key/package.json +29 -0
- package/templates/typescript-oauth/AI_AGENT_CLI_REFERENCE.md +701 -0
- package/templates/typescript-oauth/AI_AGENT_SDK_REFERENCE.md +1260 -0
- package/templates/typescript-oauth/OAUTH_SETUP.md +406 -0
- package/templates/typescript-oauth/README.md +350 -0
- package/templates/typescript-oauth/package.json +30 -0
- package/templates/typescript-starter/AI_AGENT_CLI_REFERENCE.md +701 -0
- package/templates/typescript-starter/AI_AGENT_SDK_REFERENCE.md +1260 -0
- package/templates/typescript-starter/README.md +312 -0
- package/templates/typescript-starter/package.json +32 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NitroStack Authentication Module
|
|
3
|
+
*
|
|
4
|
+
* Multiple authentication options:
|
|
5
|
+
* 1. Simple JWT - For 70% of use cases (internal tools, APIs)
|
|
6
|
+
* 2. API Keys - For simple scenarios (service-to-service)
|
|
7
|
+
* 3. OAuth 2.1 - For enterprise/SaaS (full compliance)
|
|
8
|
+
*
|
|
9
|
+
* Standards:
|
|
10
|
+
* - OAuth 2.1 (IETF draft-ietf-oauth-v2-1-13)
|
|
11
|
+
* - RFC 9728 - Protected Resource Metadata
|
|
12
|
+
* - RFC 8414 - Authorization Server Metadata
|
|
13
|
+
* - RFC 7591 - Dynamic Client Registration
|
|
14
|
+
* - RFC 8707 - Resource Indicators (Token Audience Binding)
|
|
15
|
+
* - RFC 7636 - PKCE
|
|
16
|
+
* - RFC 7662 - Token Introspection
|
|
17
|
+
* - RFC 6750 - Bearer Token Usage
|
|
18
|
+
*/
|
|
19
|
+
export { createSimpleJWTAuth, generateJWT, verifyJWT, decodeJWT, type SimpleJWTConfig, type JWTPayload, } from './simple-jwt.js';
|
|
20
|
+
export { createAPIKeyAuth, generateAPIKey, hashAPIKey, isValidAPIKeyFormat, generateAPIKeyWithMetadata, validateAPIKeyWithMetadata, type APIKeyConfig, type APIKeyWithMetadata, } from './api-key.js';
|
|
21
|
+
export { setupJWTAuth, setupAPIKeyAuth, setupOAuthAuth, generateTestCredentials, printAuthSetupInstructions, validateAuthEnv, } from './quick-setup.js';
|
|
22
|
+
export * from './types.js';
|
|
23
|
+
export * from './pkce.js';
|
|
24
|
+
export * from './server-metadata.js';
|
|
25
|
+
export * from './token-validation.js';
|
|
26
|
+
export { createAuthMiddleware, requireScopes, optionalAuth, RequireScopes, isAuthenticated, hasScope, hasAnyScope, hasAllScopes, } from './middleware.js';
|
|
27
|
+
export { OAuth2Client } from './client.js';
|
|
28
|
+
export { TokenStore, MemoryTokenStore, FileTokenStore, createDefaultTokenStore, isTokenExpired, calculateExpiration, tokenResponseToStored, } from './token-store.js';
|
|
29
|
+
export { configureServerAuth, createScopeGuards, createMCPScopeGuards, getStandardMCPScopes, validateAuthConfig, } from './server-integration.js';
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,UAAU,GAChB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC1B,KAAK,YAAY,EACjB,KAAK,kBAAkB,GACxB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAK1B,cAAc,YAAY,CAAC;AAG3B,cAAc,WAAW,CAAC;AAG1B,cAAc,sBAAsB,CAAC;AAGrC,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NitroStack Authentication Module
|
|
3
|
+
*
|
|
4
|
+
* Multiple authentication options:
|
|
5
|
+
* 1. Simple JWT - For 70% of use cases (internal tools, APIs)
|
|
6
|
+
* 2. API Keys - For simple scenarios (service-to-service)
|
|
7
|
+
* 3. OAuth 2.1 - For enterprise/SaaS (full compliance)
|
|
8
|
+
*
|
|
9
|
+
* Standards:
|
|
10
|
+
* - OAuth 2.1 (IETF draft-ietf-oauth-v2-1-13)
|
|
11
|
+
* - RFC 9728 - Protected Resource Metadata
|
|
12
|
+
* - RFC 8414 - Authorization Server Metadata
|
|
13
|
+
* - RFC 7591 - Dynamic Client Registration
|
|
14
|
+
* - RFC 8707 - Resource Indicators (Token Audience Binding)
|
|
15
|
+
* - RFC 7636 - PKCE
|
|
16
|
+
* - RFC 7662 - Token Introspection
|
|
17
|
+
* - RFC 6750 - Bearer Token Usage
|
|
18
|
+
*/
|
|
19
|
+
// ==================== SIMPLE AUTH (Recommended for most users) ====================
|
|
20
|
+
// Simple JWT Auth (no OAuth complexity!)
|
|
21
|
+
export { createSimpleJWTAuth, generateJWT, verifyJWT, decodeJWT, } from './simple-jwt.js';
|
|
22
|
+
// API Key Auth (simplest option)
|
|
23
|
+
export { createAPIKeyAuth, generateAPIKey, hashAPIKey, isValidAPIKeyFormat, generateAPIKeyWithMetadata, validateAPIKeyWithMetadata, } from './api-key.js';
|
|
24
|
+
// Quick Setup Helpers (1-liner auth!)
|
|
25
|
+
export { setupJWTAuth, setupAPIKeyAuth, setupOAuthAuth, generateTestCredentials, printAuthSetupInstructions, validateAuthEnv, } from './quick-setup.js';
|
|
26
|
+
// ==================== OAUTH 2.1 (Advanced users) ====================
|
|
27
|
+
// Types
|
|
28
|
+
export * from './types.js';
|
|
29
|
+
// PKCE utilities
|
|
30
|
+
export * from './pkce.js';
|
|
31
|
+
// Server metadata
|
|
32
|
+
export * from './server-metadata.js';
|
|
33
|
+
// Token validation
|
|
34
|
+
export * from './token-validation.js';
|
|
35
|
+
// Middleware (for servers)
|
|
36
|
+
export { createAuthMiddleware, requireScopes, optionalAuth, RequireScopes, isAuthenticated, hasScope, hasAnyScope, hasAllScopes, } from './middleware.js';
|
|
37
|
+
// OAuth client (for clients)
|
|
38
|
+
export { OAuth2Client } from './client.js';
|
|
39
|
+
// Token storage
|
|
40
|
+
export { MemoryTokenStore, FileTokenStore, createDefaultTokenStore, isTokenExpired, calculateExpiration, tokenResponseToStored, } from './token-store.js';
|
|
41
|
+
// Server integration helpers
|
|
42
|
+
export { configureServerAuth, createScopeGuards, createMCPScopeGuards, getStandardMCPScopes, validateAuthConfig, } from './server-integration.js';
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qFAAqF;AAErF,yCAAyC;AACzC,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,SAAS,GAGV,MAAM,iBAAiB,CAAC;AAEzB,iCAAiC;AACjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,GAG3B,MAAM,cAAc,CAAC;AAEtB,sCAAsC;AACtC,OAAO,EACL,YAAY,EACZ,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,uEAAuE;AAEvE,QAAQ;AACR,cAAc,YAAY,CAAC;AAE3B,iBAAiB;AACjB,cAAc,WAAW,CAAC;AAE1B,kBAAkB;AAClB,cAAc,sBAAsB,CAAC;AAErC,mBAAmB;AACnB,cAAc,uBAAuB,CAAC;AAEtC,2BAA2B;AAC3B,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,QAAQ,EACR,WAAW,EACX,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,6BAA6B;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,gBAAgB;AAChB,OAAO,EAEL,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAE1B,6BAA6B;AAC7B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Request, RequestHandler } from 'express';
|
|
2
|
+
import { McpAuthConfig, AuthContext } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Auth Middleware for Express
|
|
5
|
+
*
|
|
6
|
+
* Protects MCP server routes with OAuth 2.1 Bearer token authentication
|
|
7
|
+
*/
|
|
8
|
+
declare global {
|
|
9
|
+
namespace Express {
|
|
10
|
+
interface Request {
|
|
11
|
+
auth?: AuthContext;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create authentication middleware
|
|
17
|
+
*
|
|
18
|
+
* @param config - Auth configuration
|
|
19
|
+
* @returns Express middleware
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const authMiddleware = createAuthMiddleware({
|
|
24
|
+
* resourceUri: 'https://mcp.example.com',
|
|
25
|
+
* authorizationServers: ['https://auth.example.com'],
|
|
26
|
+
* tokenIntrospectionEndpoint: 'https://auth.example.com/oauth/introspect',
|
|
27
|
+
* tokenIntrospectionClientId: 'mcp-server',
|
|
28
|
+
* tokenIntrospectionClientSecret: process.env.INTROSPECTION_SECRET,
|
|
29
|
+
* audience: 'https://mcp.example.com',
|
|
30
|
+
* scopesSupported: ['mcp:read', 'mcp:write', 'mcp:admin']
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* app.use('/mcp', authMiddleware);
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function createAuthMiddleware(config: McpAuthConfig): RequestHandler;
|
|
37
|
+
/**
|
|
38
|
+
* Require specific scopes
|
|
39
|
+
*
|
|
40
|
+
* @param requiredScopes - Scopes required to access this route
|
|
41
|
+
* @returns Express middleware
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* app.post('/mcp/tools/execute',
|
|
46
|
+
* authMiddleware,
|
|
47
|
+
* requireScopes('mcp:write'),
|
|
48
|
+
* (req, res) => {
|
|
49
|
+
* // Handle tool execution
|
|
50
|
+
* }
|
|
51
|
+
* );
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function requireScopes(...requiredScopes: string[]): RequestHandler;
|
|
55
|
+
/**
|
|
56
|
+
* Optional authentication
|
|
57
|
+
*
|
|
58
|
+
* Attempts to authenticate but allows request to proceed even without auth.
|
|
59
|
+
* Useful for endpoints that have different behavior for authenticated users.
|
|
60
|
+
*
|
|
61
|
+
* @param config - Auth configuration
|
|
62
|
+
* @returns Express middleware
|
|
63
|
+
*/
|
|
64
|
+
export declare function optionalAuth(config: McpAuthConfig): RequestHandler;
|
|
65
|
+
/**
|
|
66
|
+
* Scope-based access control decorator
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* class ToolController {
|
|
71
|
+
* @RequireScopes('mcp:write', 'tools:execute')
|
|
72
|
+
* async executeTool(req: Request, res: Response) {
|
|
73
|
+
* // ...
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function RequireScopes(...scopes: string[]): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
79
|
+
/**
|
|
80
|
+
* Check if request is authenticated
|
|
81
|
+
*/
|
|
82
|
+
export declare function isAuthenticated(req: Request): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Check if request has specific scope
|
|
85
|
+
*/
|
|
86
|
+
export declare function hasScope(req: Request, scope: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Check if request has any of the specified scopes
|
|
89
|
+
*/
|
|
90
|
+
export declare function hasAnyScope(req: Request, scopes: string[]): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Check if request has all of the specified scopes
|
|
93
|
+
*/
|
|
94
|
+
export declare function hasAllScopes(req: Request, scopes: string[]): boolean;
|
|
95
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/auth/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA0B,cAAc,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIxD;;;;GAIG;AAGH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,OAAO,CAAC;QAChB,UAAU,OAAO;YACf,IAAI,CAAC,EAAE,WAAW,CAAC;SACpB;KACF;CACF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CAmD1E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,GAAG,cAAc,EAAE,MAAM,EAAE,GAAG,cAAc,CAmBzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CAmClE;AAiFD;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,IAE7C,QAAQ,GAAG,EACX,aAAa,MAAM,EACnB,YAAY,kBAAkB,wBAsBjC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAEnE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAEpE"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { validateToken, extractBearerToken, validateScopes } from './token-validation.js';
|
|
2
|
+
import { generateWWWAuthenticateHeader } from './server-metadata.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create authentication middleware
|
|
5
|
+
*
|
|
6
|
+
* @param config - Auth configuration
|
|
7
|
+
* @returns Express middleware
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const authMiddleware = createAuthMiddleware({
|
|
12
|
+
* resourceUri: 'https://mcp.example.com',
|
|
13
|
+
* authorizationServers: ['https://auth.example.com'],
|
|
14
|
+
* tokenIntrospectionEndpoint: 'https://auth.example.com/oauth/introspect',
|
|
15
|
+
* tokenIntrospectionClientId: 'mcp-server',
|
|
16
|
+
* tokenIntrospectionClientSecret: process.env.INTROSPECTION_SECRET,
|
|
17
|
+
* audience: 'https://mcp.example.com',
|
|
18
|
+
* scopesSupported: ['mcp:read', 'mcp:write', 'mcp:admin']
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* app.use('/mcp', authMiddleware);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function createAuthMiddleware(config) {
|
|
25
|
+
// Enforce HTTPS in production
|
|
26
|
+
if (config.requireHttps !== false && process.env.NODE_ENV === 'production') {
|
|
27
|
+
validateHttpsConfig();
|
|
28
|
+
}
|
|
29
|
+
return async (req, res, next) => {
|
|
30
|
+
try {
|
|
31
|
+
// 1. Extract Bearer token from Authorization header
|
|
32
|
+
const authHeader = req.headers.authorization;
|
|
33
|
+
const token = extractBearerToken(authHeader);
|
|
34
|
+
if (!token) {
|
|
35
|
+
// No token provided - return 401 with WWW-Authenticate challenge
|
|
36
|
+
return sendUnauthorized(res, config, 'No Bearer token provided');
|
|
37
|
+
}
|
|
38
|
+
// 2. Validate token
|
|
39
|
+
const validationResult = await validateToken(token, config);
|
|
40
|
+
if (!validationResult.valid || !validationResult.introspection) {
|
|
41
|
+
// Invalid token - return 401
|
|
42
|
+
return sendUnauthorized(res, config, validationResult.error || 'Invalid token', 'invalid_token');
|
|
43
|
+
}
|
|
44
|
+
const introspection = validationResult.introspection;
|
|
45
|
+
// 3. Attach auth context to request
|
|
46
|
+
req.auth = {
|
|
47
|
+
authenticated: true,
|
|
48
|
+
tokenInfo: introspection,
|
|
49
|
+
scopes: introspection.scope ? introspection.scope.split(' ') : [],
|
|
50
|
+
clientId: introspection.client_id,
|
|
51
|
+
subject: introspection.sub,
|
|
52
|
+
};
|
|
53
|
+
// 4. Continue to next middleware
|
|
54
|
+
next();
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
// Server error during validation
|
|
58
|
+
res.status(500).json({
|
|
59
|
+
error: 'server_error',
|
|
60
|
+
error_description: 'Token validation failed',
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Require specific scopes
|
|
67
|
+
*
|
|
68
|
+
* @param requiredScopes - Scopes required to access this route
|
|
69
|
+
* @returns Express middleware
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* app.post('/mcp/tools/execute',
|
|
74
|
+
* authMiddleware,
|
|
75
|
+
* requireScopes('mcp:write'),
|
|
76
|
+
* (req, res) => {
|
|
77
|
+
* // Handle tool execution
|
|
78
|
+
* }
|
|
79
|
+
* );
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export function requireScopes(...requiredScopes) {
|
|
83
|
+
return (req, res, next) => {
|
|
84
|
+
if (!req.auth || !req.auth.authenticated) {
|
|
85
|
+
return res.status(401).json({
|
|
86
|
+
error: 'unauthorized',
|
|
87
|
+
error_description: 'Authentication required',
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// Check if token has all required scopes
|
|
91
|
+
const hasScopes = validateScopes(req.auth.tokenInfo, requiredScopes);
|
|
92
|
+
if (!hasScopes) {
|
|
93
|
+
// Insufficient scope - return 403 with step-up challenge
|
|
94
|
+
return sendInsufficientScope(res, requiredScopes, req.auth.scopes);
|
|
95
|
+
}
|
|
96
|
+
next();
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Optional authentication
|
|
101
|
+
*
|
|
102
|
+
* Attempts to authenticate but allows request to proceed even without auth.
|
|
103
|
+
* Useful for endpoints that have different behavior for authenticated users.
|
|
104
|
+
*
|
|
105
|
+
* @param config - Auth configuration
|
|
106
|
+
* @returns Express middleware
|
|
107
|
+
*/
|
|
108
|
+
export function optionalAuth(config) {
|
|
109
|
+
return async (req, res, next) => {
|
|
110
|
+
try {
|
|
111
|
+
const authHeader = req.headers.authorization;
|
|
112
|
+
const token = extractBearerToken(authHeader);
|
|
113
|
+
if (!token) {
|
|
114
|
+
// No token - proceed without auth
|
|
115
|
+
req.auth = { authenticated: false, scopes: [] };
|
|
116
|
+
return next();
|
|
117
|
+
}
|
|
118
|
+
const validationResult = await validateToken(token, config);
|
|
119
|
+
if (validationResult.valid && validationResult.introspection) {
|
|
120
|
+
req.auth = {
|
|
121
|
+
authenticated: true,
|
|
122
|
+
tokenInfo: validationResult.introspection,
|
|
123
|
+
scopes: validationResult.introspection.scope
|
|
124
|
+
? validationResult.introspection.scope.split(' ')
|
|
125
|
+
: [],
|
|
126
|
+
clientId: validationResult.introspection.client_id,
|
|
127
|
+
subject: validationResult.introspection.sub,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
req.auth = { authenticated: false, scopes: [] };
|
|
132
|
+
}
|
|
133
|
+
next();
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
// On error, proceed without auth
|
|
137
|
+
req.auth = { authenticated: false, scopes: [] };
|
|
138
|
+
next();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Send 401 Unauthorized response with WWW-Authenticate header
|
|
144
|
+
*/
|
|
145
|
+
function sendUnauthorized(res, config, description, error) {
|
|
146
|
+
// Generate WWW-Authenticate header
|
|
147
|
+
const wwwAuthenticate = generateWWWAuthenticateHeader({
|
|
148
|
+
resourceMetadataUrl: getWellKnownMetadataUrl(config.resourceUri),
|
|
149
|
+
scope: config.scopesSupported?.join(' '),
|
|
150
|
+
error,
|
|
151
|
+
errorDescription: description,
|
|
152
|
+
});
|
|
153
|
+
res.status(401)
|
|
154
|
+
.header('WWW-Authenticate', wwwAuthenticate)
|
|
155
|
+
.json({
|
|
156
|
+
error: error || 'unauthorized',
|
|
157
|
+
error_description: description,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Send 403 Forbidden response with insufficient_scope error
|
|
162
|
+
* This triggers step-up authorization flow in clients
|
|
163
|
+
*/
|
|
164
|
+
function sendInsufficientScope(res, requiredScopes, currentScopes) {
|
|
165
|
+
// Include both current and required scopes for step-up
|
|
166
|
+
const allScopes = [...new Set([...currentScopes, ...requiredScopes])];
|
|
167
|
+
const wwwAuthenticate = generateWWWAuthenticateHeader({
|
|
168
|
+
error: 'insufficient_scope',
|
|
169
|
+
scope: allScopes.join(' '),
|
|
170
|
+
errorDescription: `Required scopes: ${requiredScopes.join(', ')}`,
|
|
171
|
+
});
|
|
172
|
+
res.status(403)
|
|
173
|
+
.header('WWW-Authenticate', wwwAuthenticate)
|
|
174
|
+
.json({
|
|
175
|
+
error: 'insufficient_scope',
|
|
176
|
+
error_description: `Required scopes: ${requiredScopes.join(', ')}`,
|
|
177
|
+
required_scopes: requiredScopes,
|
|
178
|
+
current_scopes: currentScopes,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get well-known metadata URL for this resource
|
|
183
|
+
*/
|
|
184
|
+
function getWellKnownMetadataUrl(resourceUri) {
|
|
185
|
+
try {
|
|
186
|
+
const url = new URL(resourceUri);
|
|
187
|
+
return `${url.origin}/.well-known/oauth-protected-resource`;
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return '';
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Validate HTTPS configuration
|
|
195
|
+
*/
|
|
196
|
+
function validateHttpsConfig() {
|
|
197
|
+
// In production, should be running behind HTTPS
|
|
198
|
+
// This is a warning, not a hard failure
|
|
199
|
+
if (process.env.NODE_ENV === 'production') {
|
|
200
|
+
console.warn('⚠️ WARNING: OAuth 2.1 requires HTTPS in production. ' +
|
|
201
|
+
'Ensure your server is behind a reverse proxy with TLS termination.');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Scope-based access control decorator
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* class ToolController {
|
|
210
|
+
* @RequireScopes('mcp:write', 'tools:execute')
|
|
211
|
+
* async executeTool(req: Request, res: Response) {
|
|
212
|
+
* // ...
|
|
213
|
+
* }
|
|
214
|
+
* }
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
export function RequireScopes(...scopes) {
|
|
218
|
+
return function (target, propertyKey, descriptor) {
|
|
219
|
+
const originalMethod = descriptor.value;
|
|
220
|
+
descriptor.value = async function (req, res, next) {
|
|
221
|
+
if (!req.auth || !req.auth.authenticated) {
|
|
222
|
+
return res.status(401).json({
|
|
223
|
+
error: 'unauthorized',
|
|
224
|
+
error_description: 'Authentication required',
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
const hasScopes = validateScopes(req.auth.tokenInfo, scopes);
|
|
228
|
+
if (!hasScopes) {
|
|
229
|
+
return sendInsufficientScope(res, scopes, req.auth.scopes);
|
|
230
|
+
}
|
|
231
|
+
return originalMethod.apply(this, arguments);
|
|
232
|
+
};
|
|
233
|
+
return descriptor;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Check if request is authenticated
|
|
238
|
+
*/
|
|
239
|
+
export function isAuthenticated(req) {
|
|
240
|
+
return req.auth?.authenticated === true;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Check if request has specific scope
|
|
244
|
+
*/
|
|
245
|
+
export function hasScope(req, scope) {
|
|
246
|
+
return req.auth?.scopes.includes(scope) === true;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Check if request has any of the specified scopes
|
|
250
|
+
*/
|
|
251
|
+
export function hasAnyScope(req, scopes) {
|
|
252
|
+
return scopes.some((scope) => hasScope(req, scope));
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Check if request has all of the specified scopes
|
|
256
|
+
*/
|
|
257
|
+
export function hasAllScopes(req, scopes) {
|
|
258
|
+
return scopes.every((scope) => hasScope(req, scope));
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/auth/middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AAiBrE;;;;;;;;;;;;;;;;;;;;GA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GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAY,EAAE,KAAa;IAClD,OAAO,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY,EAAE,MAAgB;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,GAAY,EAAE,MAAgB;IACzD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { PKCEParams } from './types.js';
|
|
2
|
+
export type { PKCEParams } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* PKCE (Proof Key for Code Exchange) Utilities
|
|
5
|
+
* Implements RFC 7636
|
|
6
|
+
*
|
|
7
|
+
* PKCE is REQUIRED by OAuth 2.1 to prevent authorization code interception attacks
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Generate a cryptographically secure random code verifier
|
|
11
|
+
*
|
|
12
|
+
* Per RFC 7636:
|
|
13
|
+
* - code_verifier = high-entropy cryptographic random STRING
|
|
14
|
+
* - using unreserved characters [A-Z] / [a-z] / [0-9] / "-" / "." / "_" / "~"
|
|
15
|
+
* - minimum length of 43 characters and maximum length of 128 characters
|
|
16
|
+
*/
|
|
17
|
+
export declare function generateCodeVerifier(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Generate code challenge from code verifier
|
|
20
|
+
*
|
|
21
|
+
* @param codeVerifier - The code verifier string
|
|
22
|
+
* @param method - Challenge method: 'S256' (SHA-256) or 'plain'
|
|
23
|
+
*/
|
|
24
|
+
export declare function generateCodeChallenge(codeVerifier: string, method?: 'S256' | 'plain'): string;
|
|
25
|
+
/**
|
|
26
|
+
* Generate complete PKCE parameters
|
|
27
|
+
*
|
|
28
|
+
* @param method - Challenge method (defaults to S256 as required by OAuth 2.1)
|
|
29
|
+
* @returns PKCEParams with verifier and challenge
|
|
30
|
+
*/
|
|
31
|
+
export declare function generatePKCEParams(method?: 'S256' | 'plain'): PKCEParams;
|
|
32
|
+
/**
|
|
33
|
+
* Verify PKCE challenge
|
|
34
|
+
* Used by authorization servers to verify the code_verifier matches the code_challenge
|
|
35
|
+
*
|
|
36
|
+
* @param codeVerifier - The code verifier from token request
|
|
37
|
+
* @param codeChallenge - The code challenge from authorization request
|
|
38
|
+
* @param method - The challenge method used
|
|
39
|
+
* @returns true if verification succeeds
|
|
40
|
+
*/
|
|
41
|
+
export declare function verifyPKCE(codeVerifier: string, codeChallenge: string, method: 'S256' | 'plain'): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Validate code verifier format
|
|
44
|
+
* Per RFC 7636: [A-Z] / [a-z] / [0-9] / "-" / "." / "_" / "~"
|
|
45
|
+
* Length: 43-128 characters
|
|
46
|
+
*/
|
|
47
|
+
export declare function isValidCodeVerifier(verifier: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Validate PKCE method support
|
|
50
|
+
* OAuth 2.1 REQUIRES S256 when technically capable
|
|
51
|
+
*/
|
|
52
|
+
export declare function validatePKCESupport(supportedMethods: string[] | undefined): boolean;
|
|
53
|
+
//# sourceMappingURL=pkce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../../src/auth/pkce.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAM7C;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,MAAM,GAAE,MAAM,GAAG,OAAgB,GAChC,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,GAAE,MAAM,GAAG,OAAgB,GAAG,UAAU,CAShF;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACxB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,MAAM,GAAG,OAAO,GACvB,OAAO,CAGT;AAcD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAO7D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,GACrC,OAAO,CAQT"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
/**
|
|
3
|
+
* PKCE (Proof Key for Code Exchange) Utilities
|
|
4
|
+
* Implements RFC 7636
|
|
5
|
+
*
|
|
6
|
+
* PKCE is REQUIRED by OAuth 2.1 to prevent authorization code interception attacks
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Generate a cryptographically secure random code verifier
|
|
10
|
+
*
|
|
11
|
+
* Per RFC 7636:
|
|
12
|
+
* - code_verifier = high-entropy cryptographic random STRING
|
|
13
|
+
* - using unreserved characters [A-Z] / [a-z] / [0-9] / "-" / "." / "_" / "~"
|
|
14
|
+
* - minimum length of 43 characters and maximum length of 128 characters
|
|
15
|
+
*/
|
|
16
|
+
export function generateCodeVerifier() {
|
|
17
|
+
// Generate 32 random bytes (256 bits of entropy)
|
|
18
|
+
const randomBytes = crypto.randomBytes(32);
|
|
19
|
+
// Convert to base64url encoding (URL-safe base64 without padding)
|
|
20
|
+
return base64URLEncode(randomBytes);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Generate code challenge from code verifier
|
|
24
|
+
*
|
|
25
|
+
* @param codeVerifier - The code verifier string
|
|
26
|
+
* @param method - Challenge method: 'S256' (SHA-256) or 'plain'
|
|
27
|
+
*/
|
|
28
|
+
export function generateCodeChallenge(codeVerifier, method = 'S256') {
|
|
29
|
+
if (method === 'plain') {
|
|
30
|
+
// Plain method: code_challenge = code_verifier
|
|
31
|
+
// NOT RECOMMENDED - only for constrained environments
|
|
32
|
+
return codeVerifier;
|
|
33
|
+
}
|
|
34
|
+
// S256 method (REQUIRED by OAuth 2.1 when technically capable):
|
|
35
|
+
// code_challenge = BASE64URL(SHA256(ASCII(code_verifier)))
|
|
36
|
+
const hash = crypto
|
|
37
|
+
.createHash('sha256')
|
|
38
|
+
.update(codeVerifier, 'ascii')
|
|
39
|
+
.digest();
|
|
40
|
+
return base64URLEncode(hash);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Generate complete PKCE parameters
|
|
44
|
+
*
|
|
45
|
+
* @param method - Challenge method (defaults to S256 as required by OAuth 2.1)
|
|
46
|
+
* @returns PKCEParams with verifier and challenge
|
|
47
|
+
*/
|
|
48
|
+
export function generatePKCEParams(method = 'S256') {
|
|
49
|
+
const code_verifier = generateCodeVerifier();
|
|
50
|
+
const code_challenge = generateCodeChallenge(code_verifier, method);
|
|
51
|
+
return {
|
|
52
|
+
code_verifier,
|
|
53
|
+
code_challenge,
|
|
54
|
+
code_challenge_method: method,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Verify PKCE challenge
|
|
59
|
+
* Used by authorization servers to verify the code_verifier matches the code_challenge
|
|
60
|
+
*
|
|
61
|
+
* @param codeVerifier - The code verifier from token request
|
|
62
|
+
* @param codeChallenge - The code challenge from authorization request
|
|
63
|
+
* @param method - The challenge method used
|
|
64
|
+
* @returns true if verification succeeds
|
|
65
|
+
*/
|
|
66
|
+
export function verifyPKCE(codeVerifier, codeChallenge, method) {
|
|
67
|
+
const computedChallenge = generateCodeChallenge(codeVerifier, method);
|
|
68
|
+
return computedChallenge === codeChallenge;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Convert buffer to base64url encoding
|
|
72
|
+
* Base64url is URL-safe base64 without padding
|
|
73
|
+
*/
|
|
74
|
+
function base64URLEncode(buffer) {
|
|
75
|
+
return buffer
|
|
76
|
+
.toString('base64')
|
|
77
|
+
.replace(/\+/g, '-')
|
|
78
|
+
.replace(/\//g, '_')
|
|
79
|
+
.replace(/=/g, '');
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Validate code verifier format
|
|
83
|
+
* Per RFC 7636: [A-Z] / [a-z] / [0-9] / "-" / "." / "_" / "~"
|
|
84
|
+
* Length: 43-128 characters
|
|
85
|
+
*/
|
|
86
|
+
export function isValidCodeVerifier(verifier) {
|
|
87
|
+
if (verifier.length < 43 || verifier.length > 128) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
const validPattern = /^[A-Za-z0-9\-._~]+$/;
|
|
91
|
+
return validPattern.test(verifier);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Validate PKCE method support
|
|
95
|
+
* OAuth 2.1 REQUIRES S256 when technically capable
|
|
96
|
+
*/
|
|
97
|
+
export function validatePKCESupport(supportedMethods) {
|
|
98
|
+
if (!supportedMethods || supportedMethods.length === 0) {
|
|
99
|
+
// No PKCE support indicated - MUST refuse to proceed
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
// MUST support S256
|
|
103
|
+
return supportedMethods.includes('S256');
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=pkce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.js","sourceRoot":"","sources":["../../src/auth/pkce.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAM5B;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB;IACl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