api-machine 1.2.1 → 1.4.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 +1 -1
- package/LICENSE.md +20 -20
- package/README.md +275 -275
- package/authentication/auth-flow.d.ts +13 -0
- package/authentication/auth-flow.js +3 -0
- package/authentication/auth-flow.js.map +1 -0
- package/authentication/auth-step.d.ts +0 -0
- package/authentication/auth-step.js +2 -0
- package/authentication/auth-step.js.map +1 -0
- package/authentication/authentication-scheme.d.ts +57 -5
- package/authentication/authentication-scheme.js +77 -1
- package/authentication/authentication-scheme.js.map +1 -1
- package/authentication/index.d.ts +2 -2
- package/authentication/index.js +4 -2
- package/authentication/index.js.map +1 -1
- package/authentication/middleware/bearer-authentication.d.ts +6 -3
- package/authentication/middleware/bearer-authentication.js +8 -38
- package/authentication/middleware/bearer-authentication.js.map +1 -1
- package/authentication/schemes/bearer-authentication-scheme.d.ts +24 -10
- package/authentication/schemes/bearer-authentication-scheme.js +51 -11
- package/authentication/schemes/bearer-authentication-scheme.js.map +1 -1
- package/authentication/schemes/client-credentials-oauth2-scheme.d.ts +64 -0
- package/authentication/schemes/client-credentials-oauth2-scheme.js +99 -0
- package/authentication/schemes/client-credentials-oauth2-scheme.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +2 -1
- package/router/base.d.ts +8 -4
- package/router/base.js +15 -10
- package/router/base.js.map +1 -1
- package/router/endpoint.d.ts +1 -3
- package/router/endpoint.js +1 -0
- package/router/endpoint.js.map +1 -1
- package/router/router.js +3 -1
- package/router/router.js.map +1 -1
- package/router/validation-middleware.d.ts +1 -1
- package/server/server.d.ts +6 -0
- package/server/server.js +10 -0
- package/server/server.js.map +1 -1
- package/session/drivers/in-memory-session-driver.d.ts +22 -0
- package/session/drivers/in-memory-session-driver.js +46 -0
- package/session/drivers/in-memory-session-driver.js.map +1 -0
- package/session/drivers/index.d.ts +1 -0
- package/session/drivers/index.js +6 -0
- package/session/drivers/index.js.map +1 -0
- package/session/index.d.ts +3 -0
- package/session/index.js +8 -0
- package/session/index.js.map +1 -0
- package/session/session-driver.d.ts +10 -0
- package/session/session-driver.js +7 -0
- package/session/session-driver.js.map +1 -0
- package/session/session.d.ts +3 -0
- package/session/session.js +3 -0
- package/session/session.js.map +1 -0
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { RequestHandler } from 'express';
|
|
2
2
|
import { SecuritySchemeObject, SecurityRequirementObject } from 'auto-oas/oas/v3.1';
|
|
3
|
+
import { ApiRequest, BaseApiRouter } from '../router';
|
|
4
|
+
import { SessionDriver } from '../session/session-driver';
|
|
5
|
+
import { AuthFlow } from './auth-flow';
|
|
6
|
+
import { ApiRoute } from '../router/base';
|
|
7
|
+
export interface AuthenticationSchemeOptions {
|
|
8
|
+
}
|
|
3
9
|
/**
|
|
4
10
|
* Abstract base class for authentication schemes
|
|
5
11
|
* Extend this class to create custom authentication schemes that integrate
|
|
6
12
|
* with both Express middleware and OpenAPI specification generation
|
|
7
13
|
*/
|
|
8
14
|
export declare abstract class AuthenticationScheme {
|
|
15
|
+
constructor(options?: AuthenticationSchemeOptions);
|
|
9
16
|
/**
|
|
10
17
|
* Unique name for this authentication scheme
|
|
11
18
|
* This will be used as the key in OpenAPI securitySchemes
|
|
12
19
|
*/
|
|
13
20
|
abstract readonly schemeName: string;
|
|
14
|
-
/**
|
|
15
|
-
* The type of security scheme as defined by OpenAPI
|
|
16
|
-
*/
|
|
17
|
-
abstract readonly type: 'http' | 'apiKey' | 'oauth2' | 'openIdConnect';
|
|
18
21
|
/**
|
|
19
22
|
* Generate the OpenAPI security scheme object
|
|
20
23
|
* This will be added to components.securitySchemes in the OpenAPI spec
|
|
@@ -28,11 +31,60 @@ export declare abstract class AuthenticationScheme {
|
|
|
28
31
|
* @returns SecurityRequirementObject compliant with OpenAPI 3.1
|
|
29
32
|
*/
|
|
30
33
|
getSecurityRequirement(): SecurityRequirementObject;
|
|
34
|
+
/**
|
|
35
|
+
* Get the Express middleware for this authentication scheme
|
|
36
|
+
* For InlineAuthenticationScheme: runs endpoint
|
|
37
|
+
* For SessionAuthenticationScheme: verifies session
|
|
38
|
+
*
|
|
39
|
+
* @returns Express RequestHandler middleware
|
|
40
|
+
*/
|
|
41
|
+
abstract getMiddleware(): RequestHandler;
|
|
42
|
+
}
|
|
43
|
+
export interface AuthenticationProtectionResult {
|
|
44
|
+
allowed: boolean;
|
|
45
|
+
retryAfterSeconds?: number;
|
|
46
|
+
}
|
|
47
|
+
export declare function throwIfAuthenticationBlocked(result: AuthenticationProtectionResult): void;
|
|
48
|
+
export declare abstract class InlineAuthenticationScheme extends AuthenticationScheme {
|
|
49
|
+
abstract getCredentials(request: ApiRequest): unknown;
|
|
50
|
+
abstract authenticate(options: {
|
|
51
|
+
credentials: unknown;
|
|
52
|
+
request: ApiRequest;
|
|
53
|
+
}): Promise<void>;
|
|
31
54
|
/**
|
|
32
55
|
* Generate the Express middleware that enforces this authentication
|
|
33
56
|
* The middleware should validate the authentication and throw appropriate
|
|
34
57
|
* HTTPError instances if authentication fails
|
|
35
58
|
* @returns Express RequestHandler middleware
|
|
36
59
|
*/
|
|
37
|
-
|
|
60
|
+
getMiddleware(): RequestHandler;
|
|
61
|
+
}
|
|
62
|
+
export declare abstract class SessionAuthenticationScheme extends AuthenticationScheme {
|
|
63
|
+
protected sessionDriver: SessionDriver;
|
|
64
|
+
constructor(options: {
|
|
65
|
+
sessionDriver: SessionDriver;
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* Get the authentication flow for this scheme
|
|
69
|
+
* An AuthFlow is a named collection of steps
|
|
70
|
+
* (e.g., { challenge, authorization, tokenExchange })
|
|
71
|
+
*
|
|
72
|
+
* @returns AuthFlow defining all steps in the authentication process
|
|
73
|
+
*/
|
|
74
|
+
abstract getAuthFlow(): AuthFlow;
|
|
75
|
+
/**
|
|
76
|
+
* Get all endpoints defined in the AuthFlow
|
|
77
|
+
*
|
|
78
|
+
* @returns ApiRoute array of all auth step endpoints
|
|
79
|
+
*/
|
|
80
|
+
getEndpoints(): Array<ApiRoute>;
|
|
81
|
+
/**
|
|
82
|
+
* Generate a router that exposes all auth steps as API endpoints
|
|
83
|
+
* Each step in the AuthFlow becomes a route in the router
|
|
84
|
+
*
|
|
85
|
+
* @param basePath - Optional base path for the router (default: empty)
|
|
86
|
+
* @returns Router with all auth steps as endpoints
|
|
87
|
+
*/
|
|
88
|
+
getAuthRouter(basePath?: string): BaseApiRouter;
|
|
89
|
+
getMiddleware(): RequestHandler;
|
|
38
90
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthenticationScheme = void 0;
|
|
3
|
+
exports.SessionAuthenticationScheme = exports.InlineAuthenticationScheme = exports.throwIfAuthenticationBlocked = exports.AuthenticationScheme = void 0;
|
|
4
|
+
const router_1 = require("../router");
|
|
5
|
+
const error_1 = require("../error");
|
|
4
6
|
/**
|
|
5
7
|
* Abstract base class for authentication schemes
|
|
6
8
|
* Extend this class to create custom authentication schemes that integrate
|
|
7
9
|
* with both Express middleware and OpenAPI specification generation
|
|
8
10
|
*/
|
|
9
11
|
class AuthenticationScheme {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
+
constructor(options = {}) { }
|
|
10
14
|
/**
|
|
11
15
|
* Generate the OpenAPI security requirement
|
|
12
16
|
* This defines which security scheme is required for an operation
|
|
@@ -18,4 +22,76 @@ class AuthenticationScheme {
|
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
exports.AuthenticationScheme = AuthenticationScheme;
|
|
25
|
+
function throwIfAuthenticationBlocked(result) {
|
|
26
|
+
if (result.allowed) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
throw new error_1.TooManyRequestsError('Authentication temporarily unavailable', {
|
|
30
|
+
retryAfter: typeof result.retryAfterSeconds === 'number' &&
|
|
31
|
+
result.retryAfterSeconds > 0
|
|
32
|
+
? result.retryAfterSeconds
|
|
33
|
+
: undefined,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
exports.throwIfAuthenticationBlocked = throwIfAuthenticationBlocked;
|
|
37
|
+
class InlineAuthenticationScheme extends AuthenticationScheme {
|
|
38
|
+
/**
|
|
39
|
+
* Generate the Express middleware that enforces this authentication
|
|
40
|
+
* The middleware should validate the authentication and throw appropriate
|
|
41
|
+
* HTTPError instances if authentication fails
|
|
42
|
+
* @returns Express RequestHandler middleware
|
|
43
|
+
*/
|
|
44
|
+
getMiddleware() {
|
|
45
|
+
return async (request, response, next) => {
|
|
46
|
+
const credentials = this.getCredentials(request);
|
|
47
|
+
await this.authenticate({ credentials, request });
|
|
48
|
+
request.authenticated = true;
|
|
49
|
+
return next();
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.InlineAuthenticationScheme = InlineAuthenticationScheme;
|
|
54
|
+
class SessionAuthenticationScheme extends AuthenticationScheme {
|
|
55
|
+
sessionDriver;
|
|
56
|
+
constructor(options) {
|
|
57
|
+
super();
|
|
58
|
+
this.sessionDriver = options.sessionDriver;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get all endpoints defined in the AuthFlow
|
|
62
|
+
*
|
|
63
|
+
* @returns ApiRoute array of all auth step endpoints
|
|
64
|
+
*/
|
|
65
|
+
getEndpoints() {
|
|
66
|
+
const flow = this.getAuthFlow();
|
|
67
|
+
return Object.values(flow);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Generate a router that exposes all auth steps as API endpoints
|
|
71
|
+
* Each step in the AuthFlow becomes a route in the router
|
|
72
|
+
*
|
|
73
|
+
* @param basePath - Optional base path for the router (default: empty)
|
|
74
|
+
* @returns Router with all auth steps as endpoints
|
|
75
|
+
*/
|
|
76
|
+
getAuthRouter(basePath = '') {
|
|
77
|
+
const endpoints = this.getEndpoints();
|
|
78
|
+
return new (class extends router_1.BaseApiRouter {
|
|
79
|
+
path = basePath;
|
|
80
|
+
async routes() {
|
|
81
|
+
return endpoints;
|
|
82
|
+
}
|
|
83
|
+
})();
|
|
84
|
+
}
|
|
85
|
+
getMiddleware() {
|
|
86
|
+
return async (request, response, next) => {
|
|
87
|
+
await this.sessionDriver.checkSession({
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
|
+
sessionId: request.sessionId,
|
|
90
|
+
});
|
|
91
|
+
request.authenticated = true;
|
|
92
|
+
return next();
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.SessionAuthenticationScheme = SessionAuthenticationScheme;
|
|
21
97
|
//# sourceMappingURL=authentication-scheme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-scheme.js","sourceRoot":"","sources":["../../../src/authentication/authentication-scheme.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"authentication-scheme.js","sourceRoot":"","sources":["../../../src/authentication/authentication-scheme.ts"],"names":[],"mappings":";;;AAKA,sCAKmB;AAEnB,oCAAgD;AAQhD;;;;GAIG;AACH,MAAsB,oBAAoB;IACzC,6DAA6D;IAC7D,YAAmB,UAAuC,EAAE,IAAG,CAAC;IAehE;;;;;OAKG;IACI,sBAAsB;QAC5B,OAAO,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE,CAAC;IAClC,CAAC;CAUD;AAnCD,oDAmCC;AAOD,SAAgB,4BAA4B,CAC3C,MAAsC;IAEtC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO;IACR,CAAC;IAED,MAAM,IAAI,4BAAoB,CAAC,wCAAwC,EAAE;QACxE,UAAU,EACT,OAAO,MAAM,CAAC,iBAAiB,KAAK,QAAQ;YAC5C,MAAM,CAAC,iBAAiB,GAAG,CAAC;YAC3B,CAAC,CAAC,MA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D,SAAS,EAAG,OAAe,CAAC,SAAS;aACrC,CAAC,CAAC;YAEH,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;YAC7B,OAAO,IAAI,EAAE,CAAC;QACf,CAAC,CAAC;IACH,CAAC;CACD;AA7DD,kEA6DC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { AuthenticatedRequest } from './authenticated-request';
|
|
2
|
-
export { AuthenticationScheme } from './authentication-scheme';
|
|
3
|
-
export
|
|
2
|
+
export { AuthenticationScheme, InlineAuthenticationScheme, SessionAuthenticationScheme, throwIfAuthenticationBlocked, AuthenticationProtectionResult, } from './authentication-scheme';
|
|
3
|
+
export { AuthFlow } from './auth-flow';
|
|
4
4
|
export * from './schemes';
|
package/authentication/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthenticationScheme = void 0;
|
|
3
|
+
exports.throwIfAuthenticationBlocked = exports.SessionAuthenticationScheme = exports.InlineAuthenticationScheme = exports.AuthenticationScheme = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var authentication_scheme_1 = require("./authentication-scheme");
|
|
6
6
|
Object.defineProperty(exports, "AuthenticationScheme", { enumerable: true, get: function () { return authentication_scheme_1.AuthenticationScheme; } });
|
|
7
|
-
|
|
7
|
+
Object.defineProperty(exports, "InlineAuthenticationScheme", { enumerable: true, get: function () { return authentication_scheme_1.InlineAuthenticationScheme; } });
|
|
8
|
+
Object.defineProperty(exports, "SessionAuthenticationScheme", { enumerable: true, get: function () { return authentication_scheme_1.SessionAuthenticationScheme; } });
|
|
9
|
+
Object.defineProperty(exports, "throwIfAuthenticationBlocked", { enumerable: true, get: function () { return authentication_scheme_1.throwIfAuthenticationBlocked; } });
|
|
8
10
|
tslib_1.__exportStar(require("./schemes"), exports);
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authentication/index.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authentication/index.ts"],"names":[],"mappings":";;;;AACA,iEAMiC;AALhC,6HAAA,oBAAoB,OAAA;AACpB,mIAAA,0BAA0B,OAAA;AAC1B,oIAAA,2BAA2B,OAAA;AAC3B,qIAAA,4BAA4B,OAAA;AAI7B,oDAA0B"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { Response, NextFunction } from 'express';
|
|
2
|
-
import { AuthenticatedRequest } from '../authenticated-request';
|
|
3
1
|
import { LogInterface } from '../../log';
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use BearerAuthenticationScheme instead
|
|
4
|
+
*/
|
|
4
5
|
export interface BearerAuthenticationMiddlewareOptions {
|
|
5
6
|
checkToken: (token: string) => Promise<boolean>;
|
|
6
7
|
log?: LogInterface;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
10
|
+
* @deprecated Use BearerAuthenticationScheme instead
|
|
11
|
+
*
|
|
9
12
|
* Bearer token authentication middleware
|
|
10
13
|
* Validates the Authorization header against the configured bearer token
|
|
11
14
|
*/
|
|
12
|
-
export declare function bearerAuthenticationMiddleware(options: BearerAuthenticationMiddlewareOptions): (
|
|
15
|
+
export declare function bearerAuthenticationMiddleware(options: BearerAuthenticationMiddlewareOptions): import("express").RequestHandler<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>;
|
|
@@ -1,49 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bearerAuthenticationMiddleware = void 0;
|
|
4
|
-
const
|
|
5
|
-
const valsan_1 = require("valsan");
|
|
4
|
+
const __1 = require("../..");
|
|
6
5
|
/**
|
|
6
|
+
* @deprecated Use BearerAuthenticationScheme instead
|
|
7
|
+
*
|
|
7
8
|
* Bearer token authentication middleware
|
|
8
9
|
* Validates the Authorization header against the configured bearer token
|
|
9
10
|
*/
|
|
10
11
|
function bearerAuthenticationMiddleware(options) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
' - No token provided');
|
|
17
|
-
throw new error_1.UnauthorizedError('Authorization header is missing', {
|
|
18
|
-
scheme: 'Bearer',
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
const validationResult = await new valsan_1.BearerTokenValSan().run(authHeader);
|
|
22
|
-
let token;
|
|
23
|
-
if (validationResult.success) {
|
|
24
|
-
token = validationResult.data;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
options.log?.warn('Unauthorized access attempt from ' +
|
|
28
|
-
req.ip +
|
|
29
|
-
' - Invalid token format', JSON.stringify(validationResult.errors, null, 2));
|
|
30
|
-
throw new error_1.UnauthorizedError('Bearer token is empty or invalid', {
|
|
31
|
-
scheme: 'Bearer',
|
|
32
|
-
details: validationResult.errors,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
if (!(await options.checkToken(token))) {
|
|
36
|
-
options.log?.warn('Unauthorized access attempt from ' +
|
|
37
|
-
req.ip +
|
|
38
|
-
' - Check token failed');
|
|
39
|
-
throw new error_1.UnauthorizedError('Bearer token check failed', {
|
|
40
|
-
scheme: 'Bearer',
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
req.authenticated = true;
|
|
44
|
-
next();
|
|
45
|
-
return;
|
|
46
|
-
};
|
|
12
|
+
const scheme = new __1.BearerAuthenticationScheme({
|
|
13
|
+
checkToken: options.checkToken,
|
|
14
|
+
log: options.log,
|
|
15
|
+
});
|
|
16
|
+
return scheme.getMiddleware();
|
|
47
17
|
}
|
|
48
18
|
exports.bearerAuthenticationMiddleware = bearerAuthenticationMiddleware;
|
|
49
19
|
//# sourceMappingURL=bearer-authentication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bearer-authentication.js","sourceRoot":"","sources":["../../../../src/authentication/middleware/bearer-authentication.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"bearer-authentication.js","sourceRoot":"","sources":["../../../../src/authentication/middleware/bearer-authentication.ts"],"names":[],"mappings":";;;AACA,6BAAmD;AAUnD;;;;;GAKG;AACH,SAAgB,8BAA8B,CAC7C,OAA8C;IAE9C,MAAM,MAAM,GAAG,IAAI,8BAA0B,CAAC;QAC7C,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,GAAG,EAAE,OAAO,CAAC,GAAG;KAChB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,aAAa,EAAE,CAAC;AAC/B,CAAC;AATD,wEASC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AuthenticationScheme } from '../authentication-scheme';
|
|
1
|
+
import { AuthenticationSchemeOptions, InlineAuthenticationScheme } from '../authentication-scheme';
|
|
3
2
|
import { SecuritySchemeObject } from 'auto-oas/oas/v3.1';
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { LogInterface } from '../../log';
|
|
4
|
+
import { ApiRequest } from '../../router';
|
|
5
|
+
export type CheckTokenFunction = (token: string) => Promise<boolean>;
|
|
6
|
+
export interface BearerAuthenticationSchemeOptions extends AuthenticationSchemeOptions {
|
|
6
7
|
/**
|
|
7
8
|
* The name of the security scheme in OpenAPI
|
|
8
9
|
* @default 'BearerAuth'
|
|
@@ -19,19 +20,32 @@ export interface BearerAuthenticationSchemeOptions extends BearerAuthenticationM
|
|
|
19
20
|
* Appears in the OpenAPI documentation
|
|
20
21
|
*/
|
|
21
22
|
description?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Function to validate the bearer token
|
|
25
|
+
* Should return true if the token is valid, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
checkToken: CheckTokenFunction;
|
|
28
|
+
/**
|
|
29
|
+
* Optional logger for security events
|
|
30
|
+
*/
|
|
31
|
+
log?: LogInterface;
|
|
22
32
|
}
|
|
23
33
|
/**
|
|
24
34
|
* Bearer token authentication scheme
|
|
25
35
|
* Validates the Authorization header with Bearer token
|
|
26
36
|
* Automatically generates OpenAPI security scheme documentation
|
|
27
37
|
*/
|
|
28
|
-
export declare class BearerAuthenticationScheme extends
|
|
29
|
-
readonly type: "http";
|
|
38
|
+
export declare class BearerAuthenticationScheme extends InlineAuthenticationScheme {
|
|
30
39
|
readonly schemeName: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
protected readonly bearerFormat: string;
|
|
41
|
+
protected readonly description?: string;
|
|
42
|
+
protected readonly checkToken: CheckTokenFunction;
|
|
43
|
+
protected readonly log?: LogInterface;
|
|
34
44
|
constructor(options: BearerAuthenticationSchemeOptions);
|
|
35
45
|
getSecurityScheme(): SecuritySchemeObject;
|
|
36
|
-
|
|
46
|
+
getCredentials(request: ApiRequest): unknown;
|
|
47
|
+
authenticate(options: {
|
|
48
|
+
credentials: string;
|
|
49
|
+
request: ApiRequest;
|
|
50
|
+
}): Promise<void>;
|
|
37
51
|
}
|
|
@@ -2,27 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BearerAuthenticationScheme = void 0;
|
|
4
4
|
const authentication_scheme_1 = require("../authentication-scheme");
|
|
5
|
-
const
|
|
5
|
+
const error_1 = require("../../error");
|
|
6
|
+
const primitives_1 = require("valsan/primitives");
|
|
6
7
|
/**
|
|
7
8
|
* Bearer token authentication scheme
|
|
8
9
|
* Validates the Authorization header with Bearer token
|
|
9
10
|
* Automatically generates OpenAPI security scheme documentation
|
|
10
11
|
*/
|
|
11
|
-
class BearerAuthenticationScheme extends authentication_scheme_1.
|
|
12
|
-
type = 'http';
|
|
12
|
+
class BearerAuthenticationScheme extends authentication_scheme_1.InlineAuthenticationScheme {
|
|
13
13
|
schemeName;
|
|
14
14
|
bearerFormat;
|
|
15
15
|
description;
|
|
16
|
-
|
|
16
|
+
checkToken;
|
|
17
|
+
log;
|
|
17
18
|
constructor(options) {
|
|
18
|
-
super();
|
|
19
|
+
super(options);
|
|
19
20
|
this.schemeName = options.schemeName || 'BearerAuth';
|
|
20
21
|
this.bearerFormat = options.bearerFormat || 'JWT';
|
|
21
22
|
this.description = options.description;
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
log: options.log,
|
|
25
|
-
};
|
|
23
|
+
this.checkToken = options.checkToken;
|
|
24
|
+
this.log = options.log;
|
|
26
25
|
}
|
|
27
26
|
getSecurityScheme() {
|
|
28
27
|
const scheme = {
|
|
@@ -35,8 +34,49 @@ class BearerAuthenticationScheme extends authentication_scheme_1.AuthenticationS
|
|
|
35
34
|
}
|
|
36
35
|
return scheme;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
getCredentials(request) {
|
|
38
|
+
const authHeader = request.headers['authorization'] ||
|
|
39
|
+
request.headers['Authorization'];
|
|
40
|
+
if (!authHeader) {
|
|
41
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
42
|
+
request.ip +
|
|
43
|
+
' - No token provided';
|
|
44
|
+
this.log?.warn(msg);
|
|
45
|
+
throw new error_1.UnauthorizedError('Authorization header is missing', {
|
|
46
|
+
scheme: 'Bearer',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return authHeader;
|
|
50
|
+
}
|
|
51
|
+
async authenticate(options) {
|
|
52
|
+
const { credentials, request } = options;
|
|
53
|
+
if (!credentials) {
|
|
54
|
+
throw new error_1.UnauthorizedError('Authorization header is missing', {
|
|
55
|
+
scheme: 'Bearer',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
const validationResult = await new primitives_1.BearerTokenValSan().run(credentials);
|
|
59
|
+
if (!validationResult.success || !validationResult.data) {
|
|
60
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
61
|
+
request.ip +
|
|
62
|
+
' - Invalid token format';
|
|
63
|
+
const details = JSON.stringify(validationResult.errors, null, 2);
|
|
64
|
+
this.log?.warn(msg, details);
|
|
65
|
+
throw new error_1.UnauthorizedError('Bearer token is empty or invalid', {
|
|
66
|
+
scheme: 'Bearer',
|
|
67
|
+
details: validationResult.errors,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (!(await this.checkToken(validationResult.data))) {
|
|
71
|
+
// eslint-disable-next-line max-len
|
|
72
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
73
|
+
request.ip +
|
|
74
|
+
' - Check token failed';
|
|
75
|
+
this.log?.warn(msg);
|
|
76
|
+
throw new error_1.UnauthorizedError('Bearer token check failed', {
|
|
77
|
+
scheme: 'Bearer',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
40
80
|
}
|
|
41
81
|
}
|
|
42
82
|
exports.BearerAuthenticationScheme = BearerAuthenticationScheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bearer-authentication-scheme.js","sourceRoot":"","sources":["../../../../src/authentication/schemes/bearer-authentication-scheme.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bearer-authentication-scheme.js","sourceRoot":"","sources":["../../../../src/authentication/schemes/bearer-authentication-scheme.ts"],"names":[],"mappings":";;;AAAA,oEAGkC;AAElC,uCAAgD;AAChD,kDAAsD;AAuCtD;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,kDAA0B;IACzD,UAAU,CAAS;IAEhB,YAAY,CAAS;IACrB,WAAW,CAAU;IACrB,UAAU,CAAqB;IAC/B,GAAG,CAAgB;IAEtC,YAAY,OAA0C;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,YAAY,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,KAAK,CAAC;QAClD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,OAA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M,GAAG,GACR,mCAAmC;gBACnC,OAAO,CAAC,EAAE;gBACV,yBAAyB,CAAC;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YACjE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAE7B,MAAM,IAAI,yBAAiB,CAAC,kCAAkC,EAAE;gBAC/D,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE,gBAAgB,CAAC,MAAM;aAChC,CAAC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACrD,mCAAmC;YACnC,MAAM,GAAG,GACR,mCAAmC;gBACnC,OAAO,CAAC,EAAE;gBACV,uBAAuB,CAAC;YACzB,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAEpB,MAAM,IAAI,yBAAiB,CAAC,2BAA2B,EAAE;gBACxD,MAAM,EAAE,QAAQ;aAChB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;CACD;AA5FD,gEA4FC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AuthenticationSchemeOptions, InlineAuthenticationScheme } from '../authentication-scheme';
|
|
2
|
+
import { SecuritySchemeObject } from 'auto-oas/oas/v3.1';
|
|
3
|
+
import { LogInterface } from '../../log';
|
|
4
|
+
import { ApiRequest } from '../../router';
|
|
5
|
+
export type CheckTokenFunction = (token: string) => Promise<boolean>;
|
|
6
|
+
export interface ClientCredentialsOAuth2SchemeOptions extends AuthenticationSchemeOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the security scheme in OpenAPI
|
|
9
|
+
* @default 'OAuth2ClientCredentials'
|
|
10
|
+
*/
|
|
11
|
+
schemeName?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Description of the authentication scheme
|
|
14
|
+
* Appears in the OpenAPI documentation
|
|
15
|
+
*/
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* URL of the OAuth2 authorization server's token endpoint
|
|
19
|
+
* Used for OpenAPI documentation
|
|
20
|
+
* @default 'http://localhost:3000/oauth/token'
|
|
21
|
+
*/
|
|
22
|
+
tokenUrl?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Function to validate the access token
|
|
25
|
+
* Should return true if the token is valid, false otherwise
|
|
26
|
+
*/
|
|
27
|
+
checkToken: CheckTokenFunction;
|
|
28
|
+
/**
|
|
29
|
+
* Optional logger for security events
|
|
30
|
+
*/
|
|
31
|
+
log?: LogInterface;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* OAuth2 Client Credentials authentication scheme
|
|
35
|
+
* Validates access tokens from the Authorization header using Bearer scheme
|
|
36
|
+
* Implements the OAuth2 Client Credentials flow for server-to-server authentication
|
|
37
|
+
* Automatically generates OpenAPI security scheme documentation
|
|
38
|
+
*
|
|
39
|
+
* Usage example:
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const oauth2 = new ClientCredentialsOAuth2Scheme({
|
|
42
|
+
* checkToken: async (token: string) => {
|
|
43
|
+
* // Validate against your token store or OAuth2 provider
|
|
44
|
+
* return validTokens.includes(token);
|
|
45
|
+
* },
|
|
46
|
+
* tokenUrl: 'https://auth-server.example.com/oauth/token',
|
|
47
|
+
* schemeName: 'OAuth2',
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare class ClientCredentialsOAuth2Scheme extends InlineAuthenticationScheme {
|
|
52
|
+
readonly schemeName: string;
|
|
53
|
+
protected readonly description?: string;
|
|
54
|
+
protected readonly tokenUrl: string;
|
|
55
|
+
protected readonly checkToken: CheckTokenFunction;
|
|
56
|
+
protected readonly log?: LogInterface;
|
|
57
|
+
constructor(options: ClientCredentialsOAuth2SchemeOptions);
|
|
58
|
+
getSecurityScheme(): SecuritySchemeObject;
|
|
59
|
+
getCredentials(request: ApiRequest): unknown;
|
|
60
|
+
authenticate(options: {
|
|
61
|
+
credentials: string;
|
|
62
|
+
request: ApiRequest;
|
|
63
|
+
}): Promise<void>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientCredentialsOAuth2Scheme = void 0;
|
|
4
|
+
const authentication_scheme_1 = require("../authentication-scheme");
|
|
5
|
+
const error_1 = require("../../error");
|
|
6
|
+
const primitives_1 = require("valsan/primitives");
|
|
7
|
+
/**
|
|
8
|
+
* OAuth2 Client Credentials authentication scheme
|
|
9
|
+
* Validates access tokens from the Authorization header using Bearer scheme
|
|
10
|
+
* Implements the OAuth2 Client Credentials flow for server-to-server authentication
|
|
11
|
+
* Automatically generates OpenAPI security scheme documentation
|
|
12
|
+
*
|
|
13
|
+
* Usage example:
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const oauth2 = new ClientCredentialsOAuth2Scheme({
|
|
16
|
+
* checkToken: async (token: string) => {
|
|
17
|
+
* // Validate against your token store or OAuth2 provider
|
|
18
|
+
* return validTokens.includes(token);
|
|
19
|
+
* },
|
|
20
|
+
* tokenUrl: 'https://auth-server.example.com/oauth/token',
|
|
21
|
+
* schemeName: 'OAuth2',
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
class ClientCredentialsOAuth2Scheme extends authentication_scheme_1.InlineAuthenticationScheme {
|
|
26
|
+
schemeName;
|
|
27
|
+
description;
|
|
28
|
+
tokenUrl;
|
|
29
|
+
checkToken;
|
|
30
|
+
log;
|
|
31
|
+
constructor(options) {
|
|
32
|
+
super(options);
|
|
33
|
+
this.schemeName = options.schemeName || 'OAuth2ClientCredentials';
|
|
34
|
+
this.description = options.description;
|
|
35
|
+
this.tokenUrl = options.tokenUrl || 'http://localhost:3000/oauth/token';
|
|
36
|
+
this.checkToken = options.checkToken;
|
|
37
|
+
this.log = options.log;
|
|
38
|
+
}
|
|
39
|
+
getSecurityScheme() {
|
|
40
|
+
const scheme = {
|
|
41
|
+
type: 'oauth2',
|
|
42
|
+
flows: {
|
|
43
|
+
clientCredentials: {
|
|
44
|
+
tokenUrl: this.tokenUrl,
|
|
45
|
+
scopes: {},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
if (this.description) {
|
|
50
|
+
scheme.description = this.description;
|
|
51
|
+
}
|
|
52
|
+
return scheme;
|
|
53
|
+
}
|
|
54
|
+
getCredentials(request) {
|
|
55
|
+
const authHeader = request.headers['authorization'] ||
|
|
56
|
+
request.headers['Authorization'];
|
|
57
|
+
if (!authHeader) {
|
|
58
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
59
|
+
request.ip +
|
|
60
|
+
' - No access token provided';
|
|
61
|
+
this.log?.warn(msg);
|
|
62
|
+
throw new error_1.UnauthorizedError('Authorization header is missing', {
|
|
63
|
+
scheme: 'Bearer',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return authHeader;
|
|
67
|
+
}
|
|
68
|
+
async authenticate(options) {
|
|
69
|
+
const { credentials, request } = options;
|
|
70
|
+
if (!credentials) {
|
|
71
|
+
throw new error_1.UnauthorizedError('Authorization header is missing', {
|
|
72
|
+
scheme: 'Bearer',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const validationResult = await new primitives_1.BearerTokenValSan().run(credentials);
|
|
76
|
+
if (!validationResult.success || !validationResult.data) {
|
|
77
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
78
|
+
request.ip +
|
|
79
|
+
' - Invalid access token format';
|
|
80
|
+
const details = JSON.stringify(validationResult.errors, null, 2);
|
|
81
|
+
this.log?.warn(msg, details);
|
|
82
|
+
throw new error_1.UnauthorizedError('Access token is empty or invalid', {
|
|
83
|
+
scheme: 'Bearer',
|
|
84
|
+
details: validationResult.errors,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (!(await this.checkToken(validationResult.data))) {
|
|
88
|
+
const msg = 'Unauthorized access attempt from ' +
|
|
89
|
+
request.ip +
|
|
90
|
+
' - Access token validation failed';
|
|
91
|
+
this.log?.warn(msg);
|
|
92
|
+
throw new error_1.UnauthorizedError('Access token validation failed', {
|
|
93
|
+
scheme: 'Bearer',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.ClientCredentialsOAuth2Scheme = ClientCredentialsOAuth2Scheme;
|
|
99
|
+
//# sourceMappingURL=client-credentials-oauth2-scheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-credentials-oauth2-scheme.js","sourceRoot":"","sources":["../../../../src/authentication/schemes/client-credentials-oauth2-scheme.ts"],"names":[],"mappings":";;;AAAA,oEAGkC;AAElC,uCAAgD;AAChD,kDAAsD;AAwCtD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,6BAA8B,SAAQ,kDAA0B;IAC5D,UAAU,CAAS;IAEhB,WAAW,CAAU;IACrB,QAAQ,CAAS;IACjB,UAAU,CAAqB;IAC/B,GAAG,CAAgB;IAEtC,YAAY,OAA6C;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,yBAAyB,CAAC;QAClE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,mCAAmC,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IACxB,CAAC;IAEM,iBAAiB;QACvB,MAAM,MAAM,GAAyB;YACpC,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE;gBACN,iBAAiB,EAAE;oB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E,IAAI,EAAE,CAAC,CAAC,CAAC;YACjE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAE7B,MAAM,IAAI,yBAAiB,CAAC,kCAAkC,EAAE;gBAC/D,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE,gBAAgB,CAAC,MAAM;aAChC,CAAC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;YACrD,MAAM,GAAG,GACR,mCAAmC;gBACnC,OAAO,CAAC,EAAE;gBACV,mCAAmC,CAAC;YACrC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAEpB,MAAM,IAAI,yBAAiB,CAAC,gCAAgC,EAAE;gBAC7D,MAAM,EAAE,QAAQ;aAChB,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;CACD;AA/FD,sEA+FC"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -5,4 +5,5 @@ tslib_1.__exportStar(require("./router"), exports);
|
|
|
5
5
|
tslib_1.__exportStar(require("./server"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./error"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./authentication"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./session"), exports);
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,mDAAyB;AACzB,kDAAwB;AACxB,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,mDAAyB;AACzB,kDAAwB;AACxB,2DAAiC;AACjC,oDAA0B"}
|