@decaf-ts/integrations 0.2.0 → 0.2.1
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/integrations.cjs +1 -1
- package/lib/cjs/index.cjs +3 -3
- package/lib/cjs/nest/index.cjs +2 -0
- package/lib/cjs/nest/index.cjs.map +1 -1
- package/lib/cjs/nest/keycloakAuthHandler.cjs +39 -20
- package/lib/cjs/nest/keycloakAuthHandler.cjs.map +1 -1
- package/lib/cjs/nest/logging.cjs +41 -0
- package/lib/cjs/nest/logging.cjs.map +1 -0
- package/lib/esm/index.js +3 -3
- package/lib/esm/nest/index.js +2 -0
- package/lib/esm/nest/index.js.map +1 -1
- package/lib/esm/nest/keycloakAuthHandler.js +40 -21
- package/lib/esm/nest/keycloakAuthHandler.js.map +1 -1
- package/lib/esm/nest/logging.js +38 -0
- package/lib/esm/nest/logging.js.map +1 -0
- package/lib/types/index.d.cts +2 -2
- package/lib/types/index.d.mts +2 -2
- package/lib/types/nest/index.d.cts +2 -0
- package/lib/types/nest/index.d.mts +2 -0
- package/lib/types/nest/keycloakAuthHandler.d.cts +40 -3
- package/lib/types/nest/keycloakAuthHandler.d.mts +40 -3
- package/lib/types/nest/logging.d.cts +1 -0
- package/lib/types/nest/logging.d.mts +1 -0
- package/lib/types/nest/types.d.cts +23 -18
- package/lib/types/nest/types.d.mts +23 -18
- package/package.json +24 -3
package/dist/integrations.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e,o;e=this,o=(e,o,r,i)=>{"use strict";e.COMMIT="
|
|
1
|
+
var e,o;e=this,o=(e,o,r,i)=>{"use strict";e.COMMIT="00bac68",e.FULL_VERSION="0.2.0-00bac68",e.PACKAGE_NAME="@decaf-ts/integrations",e.VERSION="0.2.0",e.execWithLogging=async(e,n,t,s=r.LogLevel.info)=>(t.debug("Executing: "+e),new Promise((r,d)=>{const c=o.exec(e,n),a=[],l=[];c.stdout?.on("data",e=>{a.push(e),t[s](e.trim())}),c.stderr?.on("data",e=>{l.push(e),t.error(e.trim())}),c.on("close",e=>{0===e?(t.silly("Command completed successfully"),r({stdout:a.join("\n"),stderr:l.join("\n")})):(t.critical(`Command failed with code ${e}:\n ${l.join("\n")}`),d(new i.InternalError(`Command failed with code ${e}: ${l.join("\n")}`)))}),c.on("error",e=>{t.critical("Command execution error",e),d(e)})}))},"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("child_process"),require("@decaf-ts/logging"),require("@decaf-ts/db-decorators")):"function"==typeof define&&define.amd?define(["exports","child_process","@decaf-ts/logging","@decaf-ts/db-decorators"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).integrations={},e.childProcess,e.decafTsLogging,e.decafTsDbDecorators);
|
|
2
2
|
//# sourceMappingURL=integrations.cjs.map
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -21,9 +21,9 @@ exports.PACKAGE_NAME = exports.FULL_VERSION = exports.COMMIT = exports.VERSION =
|
|
|
21
21
|
* @description Exposes the package utilities and build-time version metadata for `@decaf-ts/integrations`.
|
|
22
22
|
*/
|
|
23
23
|
__exportStar(require("./utils.cjs"), exports);
|
|
24
|
-
exports.VERSION = "0.
|
|
25
|
-
exports.COMMIT = "
|
|
26
|
-
exports.FULL_VERSION = "0.
|
|
24
|
+
exports.VERSION = "0.2.0";
|
|
25
|
+
exports.COMMIT = "00bac68";
|
|
26
|
+
exports.FULL_VERSION = "0.2.0-00bac68";
|
|
27
27
|
exports.PACKAGE_NAME = "@decaf-ts/integrations";
|
|
28
28
|
//# sourceMappingURL=index.js.map
|
|
29
29
|
//# sourceMappingURL=index.cjs.map
|
package/lib/cjs/nest/index.cjs
CHANGED
|
@@ -19,9 +19,11 @@ __exportStar(require("./utils.cjs"), exports);
|
|
|
19
19
|
__exportStar(require("./authService.cjs"), exports);
|
|
20
20
|
__exportStar(require("./keycloakAuthHandler.cjs"), exports);
|
|
21
21
|
__exportStar(require("./keycloakModule.cjs"), exports);
|
|
22
|
+
require("./logging.cjs");
|
|
22
23
|
/**
|
|
23
24
|
* @summary Nest-style auth integrations.
|
|
24
25
|
* @description Framework-agnostic auth helpers compatible with Decaf request context handling.
|
|
26
|
+
* Imports the `user`/`organization` log parameter registrations as a side effect.
|
|
25
27
|
* @namespace nest
|
|
26
28
|
* @memberOf module:integrations
|
|
27
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nest/index.cjs","sourceRoot":"","sources":["nest/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,mDAAiC;AACjC,2DAAyC;AACzC,sDAAoC;AACpC
|
|
1
|
+
{"version":3,"file":"nest/index.cjs","sourceRoot":"","sources":["nest/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,mDAAiC;AACjC,2DAAyC;AACzC,sDAAoC;AACpC,wBAAsB;AACtB;;;;;;GAMG;AACH,iCAAiC"}
|
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.KeycloakAuthHandler = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module integrations/nest/keycloakAuthHandler
|
|
6
|
-
* @summary Keycloak request auth handler.
|
|
7
|
-
* @description Translates Keycloak JWT payloads into Decaf-friendly auth context values.
|
|
8
|
-
*/
|
|
9
4
|
const core_1 = require("@decaf-ts/core");
|
|
5
|
+
const server_1 = require("@decaf-ts/for-http/server");
|
|
10
6
|
const authService_js_1 = require("./authService.cjs");
|
|
11
7
|
const utils_js_1 = require("./utils.cjs");
|
|
12
|
-
class KeycloakAuthHandler {
|
|
8
|
+
class KeycloakAuthHandler extends server_1.AuthHandler {
|
|
13
9
|
constructor(authService = new authService_js_1.AuthService()) {
|
|
10
|
+
super();
|
|
14
11
|
this.authService = authService;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
const request =
|
|
18
|
-
if (request
|
|
19
|
-
return;
|
|
20
|
-
|
|
21
|
-
return;
|
|
13
|
+
extractFromAuth(ctx) {
|
|
14
|
+
const request = ctx.switchToHttp().getRequest();
|
|
15
|
+
if (isPublicRoute(request)) {
|
|
16
|
+
return { roles: [], token: "", isPublic: true };
|
|
17
|
+
}
|
|
22
18
|
const token = getToken(request);
|
|
23
19
|
if (!token)
|
|
24
20
|
throw new core_1.AuthorizationError("Token not found");
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
// Decode only — validation happens in `validate`
|
|
22
|
+
const payload = (0, utils_js_1.getTokenPayload)(token);
|
|
23
|
+
const roles = (0, utils_js_1.extractKeycloakRoles)(payload);
|
|
24
|
+
const organization = resolveOrganization(payload, token);
|
|
25
|
+
const user = payload?.email ?? payload?.preferred_username;
|
|
26
|
+
return { user, organization, roles, token, isPublic: false };
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Validates the JWT against the Keycloak instance (signature, expiry, etc.)
|
|
30
|
+
* via {@link AuthService.assertValidToken}, then delegates to the base class
|
|
31
|
+
* for route-level and model-level role checks. Skips entirely for public routes.
|
|
32
|
+
*/
|
|
33
|
+
async validate(data, routeRoles, model, ...args) {
|
|
34
|
+
if (data.isPublic)
|
|
35
|
+
return;
|
|
36
|
+
this.authService.assertValidToken(data.token);
|
|
37
|
+
await super.validate(data, routeRoles, model, ...args);
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
40
|
exports.KeycloakAuthHandler = KeycloakAuthHandler;
|
|
41
|
+
function isPublicRoute(req) {
|
|
42
|
+
if (req.path?.startsWith("/public"))
|
|
43
|
+
return true;
|
|
44
|
+
if (req.path === "/account" && req.method === "POST")
|
|
45
|
+
return true;
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
36
48
|
function getToken(req) {
|
|
37
49
|
const token = (req.headers?.["x-auth-request-access-token"] ??
|
|
38
50
|
req.headers?.["authorization"]);
|
|
@@ -40,5 +52,12 @@ function getToken(req) {
|
|
|
40
52
|
return undefined;
|
|
41
53
|
return token.startsWith("Bearer ") ? token.slice("Bearer ".length) : token;
|
|
42
54
|
}
|
|
55
|
+
function resolveOrganization(payload, token) {
|
|
56
|
+
if (payload?.aud)
|
|
57
|
+
return payload.aud;
|
|
58
|
+
if (payload?.azp)
|
|
59
|
+
return payload.azp;
|
|
60
|
+
return (0, utils_js_1.getRealmFromIssuer)(token);
|
|
61
|
+
}
|
|
43
62
|
//# sourceMappingURL=keycloakAuthHandler.js.map
|
|
44
63
|
//# sourceMappingURL=keycloakAuthHandler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nest/keycloakAuthHandler.cjs","sourceRoot":"","sources":["nest/keycloakAuthHandler.js"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"nest/keycloakAuthHandler.cjs","sourceRoot":"","sources":["nest/keycloakAuthHandler.js"],"names":[],"mappings":";;;AAAA,yCAAoD;AACpD,sDAAwD;AACxD,qDAA+C;AAC/C,yCAAwF;AACxF,MAAa,mBAAoB,SAAQ,oBAAW;IAChD,YAAY,WAAW,GAAG,IAAI,4BAAW,EAAE;QACvC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IACD,eAAe,CAAC,GAAG;QACf,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAChD,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;YACzB,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACpD,CAAC;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK;YACN,MAAM,IAAI,yBAAkB,CAAC,iBAAiB,CAAC,CAAC;QACpD,iDAAiD;QACjD,MAAM,OAAO,GAAG,IAAA,0BAAe,EAAC,KAAK,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,IAAA,+BAAoB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,IAAI,GAAG,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,kBAAkB,CAAC;QAC3D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACjE,CAAC;IACD;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,IAAI;QAC3C,IAAI,IAAI,CAAC,QAAQ;YACb,OAAO;QACX,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3D,CAAC;CACJ;AA/BD,kDA+BC;AACD,SAAS,aAAa,CAAC,GAAG;IACtB,IAAI,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;QAC/B,OAAO,IAAI,CAAC;IAChB,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM;QAChD,OAAO,IAAI,CAAC;IAChB,OAAO,KAAK,CAAC;AACjB,CAAC;AACD,SAAS,QAAQ,CAAC,GAAG;IACjB,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,6BAA6B,CAAC;QACvD,GAAG,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IACpC,IAAI,CAAC,KAAK;QACN,OAAO,SAAS,CAAC;IACrB,OAAO,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/E,CAAC;AACD,SAAS,mBAAmB,CAAC,OAAO,EAAE,KAAK;IACvC,IAAI,OAAO,EAAE,GAAG;QACZ,OAAO,OAAO,CAAC,GAAG,CAAC;IACvB,IAAI,OAAO,EAAE,GAAG;QACZ,OAAO,OAAO,CAAC,GAAG,CAAC;IACvB,OAAO,IAAA,6BAAkB,EAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AACD,+CAA+C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* @module integrations/nest/logging
|
|
5
|
+
* @summary Keycloak auth log parameters.
|
|
6
|
+
* @description Registers `user` and `organization` as log parameters sourced from the
|
|
7
|
+
* logging config (populated by the auth interceptor's child logger via `Logging.for({ user, organization })`).
|
|
8
|
+
*
|
|
9
|
+
* These parameters are registered here — in `integrations/nest` — because this is the
|
|
10
|
+
* layer that extracts user/organization identity from Keycloak JWTs. The `ip` parameter,
|
|
11
|
+
* by contrast, is registered in `@decaf-ts/for-http/server` where the HTTP request IP is
|
|
12
|
+
* available.
|
|
13
|
+
*/
|
|
14
|
+
const logging_1 = require("@decaf-ts/logging");
|
|
15
|
+
logging_1.logParameterRegistry
|
|
16
|
+
.register({
|
|
17
|
+
key: "user",
|
|
18
|
+
shouldInclude(payload) {
|
|
19
|
+
return Boolean(payload.config.user);
|
|
20
|
+
},
|
|
21
|
+
render(payload) {
|
|
22
|
+
return String(payload.config.user);
|
|
23
|
+
},
|
|
24
|
+
style(rendered, payload) {
|
|
25
|
+
return payload.applyTheme(rendered, "app");
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
.register({
|
|
29
|
+
key: "organization",
|
|
30
|
+
shouldInclude(payload) {
|
|
31
|
+
return Boolean(payload.config.organization);
|
|
32
|
+
},
|
|
33
|
+
render(payload) {
|
|
34
|
+
return String(payload.config.organization);
|
|
35
|
+
},
|
|
36
|
+
style(rendered, payload) {
|
|
37
|
+
return payload.applyTheme(rendered, "app");
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=logging.js.map
|
|
41
|
+
//# sourceMappingURL=logging.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest/logging.cjs","sourceRoot":"","sources":["nest/logging.js"],"names":[],"mappings":";;AAAA;;;;;;;;;;GAUG;AACH,+CAAyD;AACzD,8BAAoB;KACf,QAAQ,CAAC;IACV,GAAG,EAAE,MAAM;IACX,aAAa,CAAC,OAAO;QACjB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IACD,MAAM,CAAC,OAAO;QACV,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IACD,KAAK,CAAC,QAAQ,EAAE,OAAO;QACnB,OAAO,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;KACG,QAAQ,CAAC;IACV,GAAG,EAAE,cAAc;IACnB,aAAa,CAAC,OAAO;QACjB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,CAAC,OAAO;QACV,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;IACD,KAAK,CAAC,QAAQ,EAAE,OAAO;QACnB,OAAO,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC,CAAC;AACH,mCAAmC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @description Exposes the package utilities and build-time version metadata for `@decaf-ts/integrations`.
|
|
5
5
|
*/
|
|
6
6
|
export * from "./utils.js";
|
|
7
|
-
export const VERSION = "0.
|
|
8
|
-
export const COMMIT = "
|
|
9
|
-
export const FULL_VERSION = "0.
|
|
7
|
+
export const VERSION = "0.2.0";
|
|
8
|
+
export const COMMIT = "00bac68";
|
|
9
|
+
export const FULL_VERSION = "0.2.0-00bac68";
|
|
10
10
|
export const PACKAGE_NAME = "@decaf-ts/integrations";
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/nest/index.js
CHANGED
|
@@ -3,9 +3,11 @@ export * from "./utils.js";
|
|
|
3
3
|
export * from "./authService.js";
|
|
4
4
|
export * from "./keycloakAuthHandler.js";
|
|
5
5
|
export * from "./keycloakModule.js";
|
|
6
|
+
import "./logging.js";
|
|
6
7
|
/**
|
|
7
8
|
* @summary Nest-style auth integrations.
|
|
8
9
|
* @description Framework-agnostic auth helpers compatible with Decaf request context handling.
|
|
10
|
+
* Imports the `user`/`organization` log parameter registrations as a side effect.
|
|
9
11
|
* @namespace nest
|
|
10
12
|
* @memberOf module:integrations
|
|
11
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nest/index.ts"],"names":[],"mappings":"AAAA,2BAAwB;AACxB,2BAAwB;AACxB,iCAA8B;AAC9B,yCAAsC;AACtC,oCAAiC;AAEjC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nest/index.ts"],"names":[],"mappings":"AAAA,2BAAwB;AACxB,2BAAwB;AACxB,iCAA8B;AAC9B,yCAAsC;AACtC,oCAAiC;AAEjC,sBAAmB;AAEnB;;;;;;GAMG"}
|
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module integrations/nest/keycloakAuthHandler
|
|
3
|
-
* @summary Keycloak request auth handler.
|
|
4
|
-
* @description Translates Keycloak JWT payloads into Decaf-friendly auth context values.
|
|
5
|
-
*/
|
|
6
1
|
import { AuthorizationError } from "@decaf-ts/core";
|
|
2
|
+
import { AuthHandler } from "@decaf-ts/for-http/server";
|
|
7
3
|
import { AuthService } from "./authService.js";
|
|
8
|
-
import {
|
|
9
|
-
export class KeycloakAuthHandler {
|
|
4
|
+
import { getRealmFromIssuer, getTokenPayload, extractKeycloakRoles, } from "./utils.js";
|
|
5
|
+
export class KeycloakAuthHandler extends AuthHandler {
|
|
10
6
|
constructor(authService = new AuthService()) {
|
|
7
|
+
super();
|
|
11
8
|
this.authService = authService;
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
const request =
|
|
15
|
-
if (request
|
|
16
|
-
return;
|
|
17
|
-
|
|
18
|
-
return;
|
|
10
|
+
extractFromAuth(ctx) {
|
|
11
|
+
const request = ctx.switchToHttp().getRequest();
|
|
12
|
+
if (isPublicRoute(request)) {
|
|
13
|
+
return { roles: [], token: "", isPublic: true };
|
|
14
|
+
}
|
|
19
15
|
const token = getToken(request);
|
|
20
16
|
if (!token)
|
|
21
17
|
throw new AuthorizationError("Token not found");
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
// Decode only — validation happens in `validate`
|
|
19
|
+
const payload = getTokenPayload(token);
|
|
20
|
+
const roles = extractKeycloakRoles(payload);
|
|
21
|
+
const organization = resolveOrganization(payload, token);
|
|
22
|
+
const user = payload?.email ?? payload?.preferred_username;
|
|
23
|
+
return { user, organization, roles, token, isPublic: false };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validates the JWT against the Keycloak instance (signature, expiry, etc.)
|
|
27
|
+
* via {@link AuthService.assertValidToken}, then delegates to the base class
|
|
28
|
+
* for route-level and model-level role checks. Skips entirely for public routes.
|
|
29
|
+
*/
|
|
30
|
+
async validate(data, routeRoles, model, ...args) {
|
|
31
|
+
if (data.isPublic)
|
|
32
|
+
return;
|
|
33
|
+
this.authService.assertValidToken(data.token);
|
|
34
|
+
await super.validate(data, routeRoles, model, ...args);
|
|
30
35
|
}
|
|
31
36
|
}
|
|
37
|
+
function isPublicRoute(req) {
|
|
38
|
+
if (req.path?.startsWith("/public"))
|
|
39
|
+
return true;
|
|
40
|
+
if (req.path === "/account" && req.method === "POST")
|
|
41
|
+
return true;
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
32
44
|
function getToken(req) {
|
|
33
45
|
const token = (req.headers?.["x-auth-request-access-token"] ??
|
|
34
46
|
req.headers?.["authorization"]);
|
|
@@ -36,4 +48,11 @@ function getToken(req) {
|
|
|
36
48
|
return undefined;
|
|
37
49
|
return token.startsWith("Bearer ") ? token.slice("Bearer ".length) : token;
|
|
38
50
|
}
|
|
51
|
+
function resolveOrganization(payload, token) {
|
|
52
|
+
if (payload?.aud)
|
|
53
|
+
return payload.aud;
|
|
54
|
+
if (payload?.azp)
|
|
55
|
+
return payload.azp;
|
|
56
|
+
return getRealmFromIssuer(token);
|
|
57
|
+
}
|
|
39
58
|
//# sourceMappingURL=keycloakAuthHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keycloakAuthHandler.js","sourceRoot":"","sources":["../../../src/nest/keycloakAuthHandler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keycloakAuthHandler.js","sourceRoot":"","sources":["../../../src/nest/keycloakAuthHandler.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,kBAAkB,EAA2B,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAY,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,yBAAsB;AAE5C,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GACrB,mBAAgB;AAejB,MAAM,OAAO,mBAAoB,SAAQ,WAIxC;IACC,YAA6B,cAAc,IAAI,WAAW,EAAE;QAC1D,KAAK,EAAE,CAAC;QADmB,gBAAW,GAAX,WAAW,CAAoB;IAE5D,CAAC;IAES,eAAe,CAAC,GAA6B;QACrD,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAmB,CAAC;QAEjE,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAClD,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;QAE5D,iDAAiD;QACjD,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACzD,MAAM,IAAI,GAAG,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,kBAAkB,CAAC;QAE3D,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACgB,KAAK,CAAC,QAAQ,CAC/B,IAAsB,EACtB,UAAgC,EAChC,KAA2B,EAC3B,GAAG,IAA6B;QAEhC,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;IACzD,CAAC;CACF;AAED,SAAS,aAAa,CAAC,GAAoB;IACzC,IAAI,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IACjD,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAClE,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,GAAoB;IACpC,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,6BAA6B,CAAC;QACzD,GAAG,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,CAAuB,CAAC;IACxD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,OAAO,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7E,CAAC;AAED,SAAS,mBAAmB,CAC1B,OAA8C,EAC9C,KAAa;IAEb,IAAI,OAAO,EAAE,GAAG;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IACrC,IAAI,OAAO,EAAE,GAAG;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IACrC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/nest/logging
|
|
3
|
+
* @summary Keycloak auth log parameters.
|
|
4
|
+
* @description Registers `user` and `organization` as log parameters sourced from the
|
|
5
|
+
* logging config (populated by the auth interceptor's child logger via `Logging.for({ user, organization })`).
|
|
6
|
+
*
|
|
7
|
+
* These parameters are registered here — in `integrations/nest` — because this is the
|
|
8
|
+
* layer that extracts user/organization identity from Keycloak JWTs. The `ip` parameter,
|
|
9
|
+
* by contrast, is registered in `@decaf-ts/for-http/server` where the HTTP request IP is
|
|
10
|
+
* available.
|
|
11
|
+
*/
|
|
12
|
+
import { logParameterRegistry } from "@decaf-ts/logging";
|
|
13
|
+
logParameterRegistry
|
|
14
|
+
.register({
|
|
15
|
+
key: "user",
|
|
16
|
+
shouldInclude(payload) {
|
|
17
|
+
return Boolean(payload.config.user);
|
|
18
|
+
},
|
|
19
|
+
render(payload) {
|
|
20
|
+
return String(payload.config.user);
|
|
21
|
+
},
|
|
22
|
+
style(rendered, payload) {
|
|
23
|
+
return payload.applyTheme(rendered, "app");
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
.register({
|
|
27
|
+
key: "organization",
|
|
28
|
+
shouldInclude(payload) {
|
|
29
|
+
return Boolean(payload.config.organization);
|
|
30
|
+
},
|
|
31
|
+
render(payload) {
|
|
32
|
+
return String(payload.config.organization);
|
|
33
|
+
},
|
|
34
|
+
style(rendered, payload) {
|
|
35
|
+
return payload.applyTheme(rendered, "app");
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../src/nest/logging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,oBAAoB;KACjB,QAAQ,CAAC;IACR,GAAG,EAAE,MAAM;IACX,aAAa,CAAC,OAAO;QACnB,OAAO,OAAO,CAAE,OAAO,CAAC,MAAkC,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,CAAC,OAAO;QACZ,OAAO,MAAM,CAAE,OAAO,CAAC,MAAkC,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;IACD,KAAK,CAAC,QAAQ,EAAE,OAAO;QACrB,OAAO,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF,CAAC;KACD,QAAQ,CAAC;IACR,GAAG,EAAE,cAAc;IACnB,aAAa,CAAC,OAAO;QACnB,OAAO,OAAO,CAAE,OAAO,CAAC,MAAkC,CAAC,YAAY,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,CAAC,OAAO;QACZ,OAAO,MAAM,CAAE,OAAO,CAAC,MAAkC,CAAC,YAAY,CAAC,CAAC;IAC1E,CAAC;IACD,KAAK,CAAC,QAAQ,EAAE,OAAO;QACrB,OAAO,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF,CAAC,CAAC"}
|
package/lib/types/index.d.cts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export * from "./utils.d.cts";
|
|
7
7
|
export declare const VERSION: string;
|
|
8
|
-
export declare const COMMIT = "
|
|
9
|
-
export declare const FULL_VERSION = "0.
|
|
8
|
+
export declare const COMMIT = "00bac68";
|
|
9
|
+
export declare const FULL_VERSION = "0.2.0-00bac68";
|
|
10
10
|
export declare const PACKAGE_NAME: string;
|
package/lib/types/index.d.mts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export * from "./utils.d.mts";
|
|
7
7
|
export declare const VERSION: string;
|
|
8
|
-
export declare const COMMIT = "
|
|
9
|
-
export declare const FULL_VERSION = "0.
|
|
8
|
+
export declare const COMMIT = "00bac68";
|
|
9
|
+
export declare const FULL_VERSION = "0.2.0-00bac68";
|
|
10
10
|
export declare const PACKAGE_NAME: string;
|
|
@@ -3,9 +3,11 @@ export * from "./utils.d.cts";
|
|
|
3
3
|
export * from "./authService.d.cts";
|
|
4
4
|
export * from "./keycloakAuthHandler.d.cts";
|
|
5
5
|
export * from "./keycloakModule.d.cts";
|
|
6
|
+
import "./logging";
|
|
6
7
|
/**
|
|
7
8
|
* @summary Nest-style auth integrations.
|
|
8
9
|
* @description Framework-agnostic auth helpers compatible with Decaf request context handling.
|
|
10
|
+
* Imports the `user`/`organization` log parameter registrations as a side effect.
|
|
9
11
|
* @namespace nest
|
|
10
12
|
* @memberOf module:integrations
|
|
11
13
|
*/
|
|
@@ -3,9 +3,11 @@ export * from "./utils.d.mts";
|
|
|
3
3
|
export * from "./authService.d.mts";
|
|
4
4
|
export * from "./keycloakAuthHandler.d.mts";
|
|
5
5
|
export * from "./keycloakModule.d.mts";
|
|
6
|
+
import "./logging";
|
|
6
7
|
/**
|
|
7
8
|
* @summary Nest-style auth integrations.
|
|
8
9
|
* @description Framework-agnostic auth helpers compatible with Decaf request context handling.
|
|
10
|
+
* Imports the `user`/`organization` log parameter registrations as a side effect.
|
|
9
11
|
* @namespace nest
|
|
10
12
|
* @memberOf module:integrations
|
|
11
13
|
*/
|
|
@@ -1,7 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/nest/keycloakAuthHandler
|
|
3
|
+
* @summary Keycloak request auth handler.
|
|
4
|
+
* @description Translates Keycloak JWT payloads into Decaf-friendly auth data.
|
|
5
|
+
* Extends the framework-agnostic {@link AuthHandler} from `@decaf-ts/for-http/server`.
|
|
6
|
+
*
|
|
7
|
+
* Only overrides the two extension points:
|
|
8
|
+
* - {@link extractFromAuth} — decodes the JWT and returns auth data (no validation).
|
|
9
|
+
* Returns empty data for public routes without requiring a token.
|
|
10
|
+
* - {@link validate} — validates the JWT via {@link AuthService.assertValidToken},
|
|
11
|
+
* then delegates to the base class for route-level and model-level role checks.
|
|
12
|
+
* Skips entirely for public routes.
|
|
13
|
+
*
|
|
14
|
+
* Does NOT override `bindToContext` — the base class default `ctx.accumulate(data)`
|
|
15
|
+
* is sufficient. Does NOT override `authorize`.
|
|
16
|
+
*/
|
|
17
|
+
import type { Constructor } from "@decaf-ts/decoration";
|
|
18
|
+
import { Context, ContextualArgs } from "@decaf-ts/core";
|
|
19
|
+
import { AuthHandler, AuthData } from "@decaf-ts/for-http/server";
|
|
2
20
|
import { AuthService } from "./authService.d.cts";
|
|
3
|
-
|
|
21
|
+
import type { AuthExecutionContextLike } from "./types.d.cts";
|
|
22
|
+
/**
|
|
23
|
+
* Auth data returned by {@link KeycloakAuthHandler.extractFromAuth}.
|
|
24
|
+
*
|
|
25
|
+
* Carries the raw JWT `token` so that {@link KeycloakAuthHandler.validate} can
|
|
26
|
+
* validate it against the Keycloak instance (signature, expiry, revocation, etc.).
|
|
27
|
+
*/
|
|
28
|
+
export interface KeycloakAuthData extends AuthData {
|
|
29
|
+
/** The raw JWT extracted from the request. Empty for public routes. */
|
|
30
|
+
token: string;
|
|
31
|
+
/** Whether the request targets a public route (skips validation). */
|
|
32
|
+
isPublic: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare class KeycloakAuthHandler extends AuthHandler<AuthExecutionContextLike, Context, KeycloakAuthData> {
|
|
4
35
|
private readonly authService;
|
|
5
36
|
constructor(authService?: AuthService);
|
|
6
|
-
|
|
37
|
+
protected extractFromAuth(ctx: AuthExecutionContextLike): KeycloakAuthData;
|
|
38
|
+
/**
|
|
39
|
+
* Validates the JWT against the Keycloak instance (signature, expiry, etc.)
|
|
40
|
+
* via {@link AuthService.assertValidToken}, then delegates to the base class
|
|
41
|
+
* for route-level and model-level role checks. Skips entirely for public routes.
|
|
42
|
+
*/
|
|
43
|
+
protected validate(data: KeycloakAuthData, routeRoles: string[] | undefined, model: string | Constructor, ...args: ContextualArgs<Context>): Promise<void>;
|
|
7
44
|
}
|
|
@@ -1,7 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/nest/keycloakAuthHandler
|
|
3
|
+
* @summary Keycloak request auth handler.
|
|
4
|
+
* @description Translates Keycloak JWT payloads into Decaf-friendly auth data.
|
|
5
|
+
* Extends the framework-agnostic {@link AuthHandler} from `@decaf-ts/for-http/server`.
|
|
6
|
+
*
|
|
7
|
+
* Only overrides the two extension points:
|
|
8
|
+
* - {@link extractFromAuth} — decodes the JWT and returns auth data (no validation).
|
|
9
|
+
* Returns empty data for public routes without requiring a token.
|
|
10
|
+
* - {@link validate} — validates the JWT via {@link AuthService.assertValidToken},
|
|
11
|
+
* then delegates to the base class for route-level and model-level role checks.
|
|
12
|
+
* Skips entirely for public routes.
|
|
13
|
+
*
|
|
14
|
+
* Does NOT override `bindToContext` — the base class default `ctx.accumulate(data)`
|
|
15
|
+
* is sufficient. Does NOT override `authorize`.
|
|
16
|
+
*/
|
|
17
|
+
import type { Constructor } from "@decaf-ts/decoration";
|
|
18
|
+
import { Context, ContextualArgs } from "@decaf-ts/core";
|
|
19
|
+
import { AuthHandler, AuthData } from "@decaf-ts/for-http/server";
|
|
2
20
|
import { AuthService } from "./authService.d.mts";
|
|
3
|
-
|
|
21
|
+
import type { AuthExecutionContextLike } from "./types.d.mts";
|
|
22
|
+
/**
|
|
23
|
+
* Auth data returned by {@link KeycloakAuthHandler.extractFromAuth}.
|
|
24
|
+
*
|
|
25
|
+
* Carries the raw JWT `token` so that {@link KeycloakAuthHandler.validate} can
|
|
26
|
+
* validate it against the Keycloak instance (signature, expiry, revocation, etc.).
|
|
27
|
+
*/
|
|
28
|
+
export interface KeycloakAuthData extends AuthData {
|
|
29
|
+
/** The raw JWT extracted from the request. Empty for public routes. */
|
|
30
|
+
token: string;
|
|
31
|
+
/** Whether the request targets a public route (skips validation). */
|
|
32
|
+
isPublic: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare class KeycloakAuthHandler extends AuthHandler<AuthExecutionContextLike, Context, KeycloakAuthData> {
|
|
4
35
|
private readonly authService;
|
|
5
36
|
constructor(authService?: AuthService);
|
|
6
|
-
|
|
37
|
+
protected extractFromAuth(ctx: AuthExecutionContextLike): KeycloakAuthData;
|
|
38
|
+
/**
|
|
39
|
+
* Validates the JWT against the Keycloak instance (signature, expiry, etc.)
|
|
40
|
+
* via {@link AuthService.assertValidToken}, then delegates to the base class
|
|
41
|
+
* for route-level and model-level role checks. Skips entirely for public routes.
|
|
42
|
+
*/
|
|
43
|
+
protected validate(data: KeycloakAuthData, routeRoles: string[] | undefined, model: string | Constructor, ...args: ContextualArgs<Context>): Promise<void>;
|
|
7
44
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module integrations/nest/types
|
|
3
3
|
* @summary Nest integration types.
|
|
4
|
-
* @description
|
|
4
|
+
* @description Keycloak-specific payload types, a platform-specific execution context
|
|
5
|
+
* type, and re-exports of the framework-agnostic auth primitives from
|
|
6
|
+
* `@decaf-ts/for-http/server`.
|
|
5
7
|
*/
|
|
8
|
+
import type { AuthData, AuthRequestLike, UserData } from "@decaf-ts/for-http/server";
|
|
9
|
+
export type { AuthData, AuthRequestLike, UserData };
|
|
10
|
+
/**
|
|
11
|
+
* Structural subset of a NestJS-like execution context that exposes the HTTP request.
|
|
12
|
+
*
|
|
13
|
+
* Defined here (not in for-http) because the base `AuthHandler` class is intentionally
|
|
14
|
+
* generic over its execution context — only the platform that consumes it needs to know
|
|
15
|
+
* the concrete shape.
|
|
16
|
+
*/
|
|
17
|
+
export interface AuthExecutionContextLike {
|
|
18
|
+
switchToHttp(): {
|
|
19
|
+
getRequest<T = AuthRequestLike>(): T;
|
|
20
|
+
};
|
|
21
|
+
getHandler?(): {
|
|
22
|
+
name?: string;
|
|
23
|
+
};
|
|
24
|
+
getClass?(): {
|
|
25
|
+
name?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
6
28
|
export interface KeycloakAccessTokenPayload {
|
|
7
29
|
preferred_username?: string;
|
|
8
30
|
email?: string;
|
|
@@ -29,20 +51,3 @@ export interface KeycloakUser {
|
|
|
29
51
|
family_name?: string;
|
|
30
52
|
realm?: string;
|
|
31
53
|
}
|
|
32
|
-
export interface AuthRequestLike {
|
|
33
|
-
path?: string;
|
|
34
|
-
method?: string;
|
|
35
|
-
headers?: Record<string, unknown>;
|
|
36
|
-
[key: symbol | string]: unknown;
|
|
37
|
-
}
|
|
38
|
-
export interface AuthExecutionContextLike {
|
|
39
|
-
switchToHttp(): {
|
|
40
|
-
getRequest<T extends AuthRequestLike = AuthRequestLike>(): T;
|
|
41
|
-
};
|
|
42
|
-
getHandler?(): {
|
|
43
|
-
name?: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export interface AuthHandlerLike {
|
|
47
|
-
authorize(context: AuthExecutionContextLike, resource?: string): Promise<void>;
|
|
48
|
-
}
|
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module integrations/nest/types
|
|
3
3
|
* @summary Nest integration types.
|
|
4
|
-
* @description
|
|
4
|
+
* @description Keycloak-specific payload types, a platform-specific execution context
|
|
5
|
+
* type, and re-exports of the framework-agnostic auth primitives from
|
|
6
|
+
* `@decaf-ts/for-http/server`.
|
|
5
7
|
*/
|
|
8
|
+
import type { AuthData, AuthRequestLike, UserData } from "@decaf-ts/for-http/server";
|
|
9
|
+
export type { AuthData, AuthRequestLike, UserData };
|
|
10
|
+
/**
|
|
11
|
+
* Structural subset of a NestJS-like execution context that exposes the HTTP request.
|
|
12
|
+
*
|
|
13
|
+
* Defined here (not in for-http) because the base `AuthHandler` class is intentionally
|
|
14
|
+
* generic over its execution context — only the platform that consumes it needs to know
|
|
15
|
+
* the concrete shape.
|
|
16
|
+
*/
|
|
17
|
+
export interface AuthExecutionContextLike {
|
|
18
|
+
switchToHttp(): {
|
|
19
|
+
getRequest<T = AuthRequestLike>(): T;
|
|
20
|
+
};
|
|
21
|
+
getHandler?(): {
|
|
22
|
+
name?: string;
|
|
23
|
+
};
|
|
24
|
+
getClass?(): {
|
|
25
|
+
name?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
6
28
|
export interface KeycloakAccessTokenPayload {
|
|
7
29
|
preferred_username?: string;
|
|
8
30
|
email?: string;
|
|
@@ -29,20 +51,3 @@ export interface KeycloakUser {
|
|
|
29
51
|
family_name?: string;
|
|
30
52
|
realm?: string;
|
|
31
53
|
}
|
|
32
|
-
export interface AuthRequestLike {
|
|
33
|
-
path?: string;
|
|
34
|
-
method?: string;
|
|
35
|
-
headers?: Record<string, unknown>;
|
|
36
|
-
[key: symbol | string]: unknown;
|
|
37
|
-
}
|
|
38
|
-
export interface AuthExecutionContextLike {
|
|
39
|
-
switchToHttp(): {
|
|
40
|
-
getRequest<T extends AuthRequestLike = AuthRequestLike>(): T;
|
|
41
|
-
};
|
|
42
|
-
getHandler?(): {
|
|
43
|
-
name?: string;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export interface AuthHandlerLike {
|
|
47
|
-
authorize(context: AuthExecutionContextLike, resource?: string): Promise<void>;
|
|
48
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decaf-ts/integrations",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.mts",
|
|
@@ -244,6 +244,7 @@
|
|
|
244
244
|
"@decaf-ts/crypto": "latest",
|
|
245
245
|
"@decaf-ts/db-decorators": "latest",
|
|
246
246
|
"@decaf-ts/decoration": "latest",
|
|
247
|
+
"@decaf-ts/decorator-validation": "latest",
|
|
247
248
|
"@decaf-ts/injectable-decorators": "latest",
|
|
248
249
|
"@decaf-ts/logging": "latest",
|
|
249
250
|
"@decaf-ts/transactional-decorators": "latest",
|
|
@@ -253,11 +254,31 @@
|
|
|
253
254
|
"uuid": "^11.1.1"
|
|
254
255
|
},
|
|
255
256
|
"devDependencies": {
|
|
257
|
+
"@decaf-ts/for-http": "latest",
|
|
258
|
+
"@decaf-ts/for-nest": "^0.11.2-refactor",
|
|
256
259
|
"@decaf-ts/utils": "latest",
|
|
257
|
-
"@
|
|
260
|
+
"@nestjs/common": "^11.0.0",
|
|
261
|
+
"@nestjs/core": "^11.0.0",
|
|
262
|
+
"@nestjs/platform-express": "^11.0.0",
|
|
263
|
+
"@nestjs/swagger": "^11.4.4",
|
|
264
|
+
"@nestjs/testing": "^11.0.0",
|
|
265
|
+
"@types/jest": "^30.0.0",
|
|
266
|
+
"@types/supertest": "^6.0.0",
|
|
267
|
+
"reflect-metadata": "^0.2.0",
|
|
268
|
+
"rxjs": "^7.8.0",
|
|
269
|
+
"supertest": "^7.0.0"
|
|
270
|
+
},
|
|
271
|
+
"peerDependencies": {
|
|
272
|
+
"@decaf-ts/for-http": ">=0.18.0"
|
|
273
|
+
},
|
|
274
|
+
"peerDependenciesMeta": {
|
|
275
|
+
"@decaf-ts/for-http": {
|
|
276
|
+
"optional": true
|
|
277
|
+
}
|
|
258
278
|
},
|
|
259
279
|
"overrides": {
|
|
260
|
-
"js-yaml": "^4.2.0"
|
|
280
|
+
"js-yaml": "^4.2.0",
|
|
281
|
+
"multer": "^2.1.2"
|
|
261
282
|
},
|
|
262
283
|
"optionalDependencies": {
|
|
263
284
|
"@aws-sdk/client-s3": "^3.1075.0",
|