@darraghor/nest-backend-libs 6.0.0 → 7.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/README.md +35 -1
- package/dist/authorization/authz.module.js +1 -0
- package/dist/authorization/authz.module.js.map +1 -1
- package/dist/authorization/better-authz.module.d.ts +10 -0
- package/dist/authorization/better-authz.module.js +54 -0
- package/dist/authorization/better-authz.module.js.map +1 -0
- package/dist/authorization/better-authz.options.d.ts +12 -0
- package/dist/authorization/better-authz.options.js +2 -0
- package/dist/authorization/better-authz.options.js.map +1 -0
- package/dist/authorization/config/AuthConfigurationService.js.map +1 -1
- package/dist/authorization/config/BetterAuthConfigurationService.d.ts +8 -0
- package/dist/authorization/config/BetterAuthConfigurationService.js +33 -0
- package/dist/authorization/config/BetterAuthConfigurationService.js.map +1 -0
- package/dist/authorization/guards/ClaimsAuthorisationGuard.js.map +1 -1
- package/dist/authorization/models/AuthenticatedUserProfile.d.ts +17 -0
- package/dist/authorization/models/AuthenticatedUserProfile.js +2 -0
- package/dist/authorization/models/AuthenticatedUserProfile.js.map +1 -0
- package/dist/authorization/services/BetterAuthUserValidation.service.d.ts +23 -0
- package/dist/authorization/services/BetterAuthUserValidation.service.js +197 -0
- package/dist/authorization/services/BetterAuthUserValidation.service.js.map +1 -0
- package/dist/authorization/services/UserValidation.service.js.map +1 -1
- package/dist/authorization/strategies/apikeystrategy.js.map +1 -1
- package/dist/authorization/strategies/authzstrategy.js.map +1 -1
- package/dist/authorization/strategies/better-auth-apikey.strategy.d.ts +15 -0
- package/dist/authorization/strategies/better-auth-apikey.strategy.js +44 -0
- package/dist/authorization/strategies/better-auth-apikey.strategy.js.map +1 -0
- package/dist/authorization/strategies/better-auth.strategy.d.ts +15 -0
- package/dist/authorization/strategies/better-auth.strategy.js +55 -0
- package/dist/authorization/strategies/better-auth.strategy.js.map +1 -0
- package/dist/authzclient/AuthClientConfigurationService.js.map +1 -1
- package/dist/authzclient/authz-client.module.js +1 -0
- package/dist/authzclient/authz-client.module.js.map +1 -1
- package/dist/authzclient/authz.service.js.map +1 -1
- package/dist/cli/commands/WriteApiClientCommand.js.map +1 -1
- package/dist/core-config/CoreConfig.module.js.map +1 -1
- package/dist/core-config/CoreConfigurationService.js.map +1 -1
- package/dist/database-postgres/PostgresTypeOrmConfigurationProvider.js.map +1 -1
- package/dist/database-sqlite/SqliteTypeOrmConfigurationProvider.js.map +1 -1
- package/dist/exports/authorization.d.ts +4 -0
- package/dist/exports/authorization.js +2 -0
- package/dist/exports/authorization.js.map +1 -1
- package/dist/health/Health.controller.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/invitations/InvitationConfigurationService.js.map +1 -1
- package/dist/invitations/invitation.controller.js +5 -1
- package/dist/invitations/invitation.controller.js.map +1 -1
- package/dist/invitations/invitation.module.js.map +1 -1
- package/dist/invitations/invitation.service.js.map +1 -1
- package/dist/logger/LoggingConfigurationService.js.map +1 -1
- package/dist/logger/logger.module.js.map +1 -1
- package/dist/organisation/organisation.controller.js.map +1 -1
- package/dist/organisation/organisation.service.js.map +1 -1
- package/dist/organisation-memberships/organisation-memberships.controller.js.map +1 -1
- package/dist/organisation-memberships/organisation-memberships.service.js.map +1 -1
- package/dist/organisation-subscriptions/all-subscriptions.controller.js.map +1 -1
- package/dist/organisation-subscriptions/organisation-subscriptions.controller.js.map +1 -1
- package/dist/organisation-subscriptions/organisation-subscriptions.service.js.map +1 -1
- package/dist/payment-sessions/payment-session.controller.js +3 -1
- package/dist/payment-sessions/payment-session.controller.js.map +1 -1
- package/dist/payment-sessions/payment-session.service.js.map +1 -1
- package/dist/root-app/SwaggerGen.js.map +1 -1
- package/dist/root-app/app.controller.js.map +1 -1
- package/dist/root-app/core-app.module.d.ts +4 -0
- package/dist/root-app/core-app.module.js +2 -2
- package/dist/root-app/core-app.module.js.map +1 -1
- package/dist/root-app/notfound.interceptor.js.map +1 -1
- package/dist/runningCommandLine/CliCommandService.js.map +1 -1
- package/dist/smtp-email-client/EmailConfigurationService.js.map +1 -1
- package/dist/smtp-email-client/email-client.service.js.map +1 -1
- package/dist/smtp-email-client/email.controller.js.map +1 -1
- package/dist/smtp-email-client/smtp-email-client.module.js.map +1 -1
- package/dist/smtp-email-client/smtp-email-handler.js.map +1 -1
- package/dist/stripe-client/StripeClientConfigurationService.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-checkout-controller.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-customer-portal-controller.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-events-controller.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-unauthenticated-checkout-controller.js.map +1 -1
- package/dist/stripe-client/controllers/stripe-webhook-controller.js.map +1 -1
- package/dist/stripe-client/services/auth-stripe-checkout.service.js.map +1 -1
- package/dist/stripe-client/services/queued-payment-event.handler.js.map +1 -1
- package/dist/stripe-client/services/stripe-checkout.service.js.map +1 -1
- package/dist/stripe-client/services/stripe-webhook-handler.service.js.map +1 -1
- package/dist/stripe-client/services/subscriptionRecord.mapper.js.map +1 -1
- package/dist/stripe-client/stripe-account.module.js.map +1 -1
- package/dist/stripe-payments/controllers/secure-stripe-checkout.controller.js.map +1 -1
- package/dist/stripe-payments/controllers/secure-stripe-events.controller.js.map +1 -1
- package/dist/stripe-payments/controllers/secure-stripe-webhook.controller.js.map +1 -1
- package/dist/stripe-payments/services/default-stripe-payments-entitlement-store.js.map +1 -1
- package/dist/stripe-payments/services/secure-stripe-checkout.service.js.map +1 -1
- package/dist/stripe-payments/services/secure-stripe-product.service.js.map +1 -1
- package/dist/stripe-payments/services/secure-stripe-webhook.service.js.map +1 -1
- package/dist/stripe-payments/services/secure-subscription.service.js.map +1 -1
- package/dist/stripe-payments/services/stripe-payment-event.processor.js.map +1 -1
- package/dist/stripe-payments/services/stripe-payment-event.service.js.map +1 -1
- package/dist/stripe-payments/services/stripe-payment-fulfillment.service.js.map +1 -1
- package/dist/stripe-payments/services/stripe-payments-operations.service.js.map +1 -1
- package/dist/stripe-payments/services/stripe-payments-telemetry.service.js.map +1 -1
- package/dist/stripe-payments/stripe-payments.module.js.map +1 -1
- package/dist/super-powers/super-powers.controller.js.map +1 -1
- package/dist/super-powers/super-powers.service.js.map +1 -1
- package/dist/twitter-client/TwitterClientConfigurationService.js.map +1 -1
- package/dist/twitter-client/services/twitter-client.service.js.map +1 -1
- package/dist/twitter-client/twitter-account.module.js.map +1 -1
- package/dist/user/dto/userResponseDto.d.ts +1 -0
- package/dist/user/dto/userResponseDto.js +5 -0
- package/dist/user/dto/userResponseDto.js.map +1 -1
- package/dist/user/entities/user.entity.d.ts +2 -0
- package/dist/user/entities/user.entity.js +11 -1
- package/dist/user/entities/user.entity.js.map +1 -1
- package/dist/user/user.controller.d.ts +1 -1
- package/dist/user/user.controller.js.map +1 -1
- package/dist/user/user.service.d.ts +1 -0
- package/dist/user/user.service.js +12 -0
- package/dist/user/user.service.js.map +1 -1
- package/dist/user-api-key/user-apikey.controller.js.map +1 -1
- package/dist/user-api-key/user-apikey.service.js.map +1 -1
- package/package.json +7 -9
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ You can see how this library is used in a NestJS application on GitHub as [use-m
|
|
|
11
11
|
The library includes the following modules that can be imported into your NestJS application. They are mostly dependant on each other so you should import them all. But they are things that are common to most applications so it makes sense to have them together in this library if you use this stack.
|
|
12
12
|
|
|
13
13
|
- Authorization
|
|
14
|
-
-
|
|
14
|
+
- Better Auth session and bearer-token authorization
|
|
15
15
|
- Configuration
|
|
16
16
|
- Postgres + typeorm
|
|
17
17
|
- SQLite + typeorm
|
|
@@ -41,6 +41,33 @@ import {
|
|
|
41
41
|
import {NEST_BACKEND_LIB_ENTITIES} from "@darraghor/nest-backend-libs/database";
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
## Authentication and authorization
|
|
45
|
+
|
|
46
|
+
`BetterAuthzModule` is the opinionated integration for new applications. Host Better Auth
|
|
47
|
+
in the NestJS application (or another backend service) and provide a resolver that converts
|
|
48
|
+
its session into `AuthenticatedUserProfile`. The module keeps `DefaultAuthGuard`, application
|
|
49
|
+
users, organisations, invitations, claims, and API-key auth consistent without importing a
|
|
50
|
+
frontend framework or the Better Auth SDK into this library.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
BetterAuthzModule.forRootAsync({
|
|
54
|
+
imports: [ConfigModule],
|
|
55
|
+
inject: [ConfigService],
|
|
56
|
+
useFactory: () => ({
|
|
57
|
+
resolveUser: async (request) => resolveApplicationAuthSession(request),
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The resolver may accept secure session cookies, signed bearer tokens, or both. This supports
|
|
63
|
+
server-rendered frontends and independent browser SPAs—including SSE clients—through the same
|
|
64
|
+
backend authorization contract.
|
|
65
|
+
|
|
66
|
+
Add `authProviderUserId` to the consuming application's migration. On first login, a verified
|
|
67
|
+
identity is linked to exactly one existing application user with the same email, preserving
|
|
68
|
+
memberships and subscriptions. Duplicate matches fail closed. `AuthzModule` and
|
|
69
|
+
`auth0UserId` remain available for staged upgrades but are deprecated.
|
|
70
|
+
|
|
44
71
|
## Stripe payments
|
|
45
72
|
|
|
46
73
|
`StripePaymentsModule` is the opinionated Stripe integration for new applications. It
|
|
@@ -108,6 +135,13 @@ existing health or metrics endpoint.
|
|
|
108
135
|
available for existing applications but are deprecated. They accept unsafe legacy
|
|
109
136
|
inputs and do not receive fixes made to the v2 flow; migrate to `StripePaymentsModule`.
|
|
110
137
|
|
|
138
|
+
### TypeScript toolchain
|
|
139
|
+
|
|
140
|
+
`pnpm build` uses the TypeScript 7 native compiler provided by `@typescript/native`.
|
|
141
|
+
The `typescript` package is intentionally aliased to the TypeScript 6 compatibility
|
|
142
|
+
release so ESLint and other tools that use the TypeScript compiler API continue to
|
|
143
|
+
work. Keep build commands on `tsc` and compiler-API tooling on `typescript`/`tsc6`.
|
|
144
|
+
|
|
111
145
|
### Testing
|
|
112
146
|
|
|
113
147
|
https://stripe.com/docs/webhooks/test
|
|
@@ -45,6 +45,7 @@ let AuthzModule = AuthzModule_1 = class AuthzModule {
|
|
|
45
45
|
};
|
|
46
46
|
AuthzModule = AuthzModule_1 = __decorate([
|
|
47
47
|
Module({})
|
|
48
|
+
/** @deprecated Use BetterAuthzModule for new applications. */
|
|
48
49
|
], AuthzModule);
|
|
49
50
|
export { AuthzModule };
|
|
50
51
|
//# sourceMappingURL=authz.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authz.module.js","sourceRoot":"","sources":["../../src/authorization/authz.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAgB,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,wBAAwB,EAAC,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAC,qBAAqB,EAAC,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,IAAI,EAAC,MAAM,iCAAiC,CAAC;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAC,UAAU,EAAC,MAAM,8CAA8C,CAAC;AACxE,OAAO,EACH,oBAAoB,GAEvB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"authz.module.js","sourceRoot":"","sources":["../../src/authorization/authz.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAgB,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,wBAAwB,EAAC,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAC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AsyncOptions } from "./better-authz.options.js";
|
|
3
|
+
/**
|
|
4
|
+
* Provider-neutral session authorization module designed for Better Auth.
|
|
5
|
+
* It preserves the existing `DefaultAuthGuard` contract used by controllers.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BetterAuthzModule {
|
|
8
|
+
static forRoot(): never;
|
|
9
|
+
static forRootAsync(options: BetterAuthzModuleAsyncOptions): DynamicModule;
|
|
10
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var BetterAuthzModule_1;
|
|
8
|
+
import { Module } from "@nestjs/common";
|
|
9
|
+
import { PassportModule } from "@nestjs/passport";
|
|
10
|
+
import { TypeOrmModule } from "@nestjs/typeorm";
|
|
11
|
+
import { Invitation } from "../invitations/entities/invitation.entity.js";
|
|
12
|
+
import { User } from "../user/entities/user.entity.js";
|
|
13
|
+
import { BETTER_AUTHZ_MODULE_OPTIONS, } from "./better-authz.options.js";
|
|
14
|
+
import { BetterAuthConfigurationService } from "./config/BetterAuthConfigurationService.js";
|
|
15
|
+
import { BetterAuthApiKeyStrategy } from "./strategies/better-auth-apikey.strategy.js";
|
|
16
|
+
import { BetterAuthStrategy } from "./strategies/better-auth.strategy.js";
|
|
17
|
+
import { BetterAuthUserValidationService } from "./services/BetterAuthUserValidation.service.js";
|
|
18
|
+
/**
|
|
19
|
+
* Provider-neutral session authorization module designed for Better Auth.
|
|
20
|
+
* It preserves the existing `DefaultAuthGuard` contract used by controllers.
|
|
21
|
+
*/
|
|
22
|
+
let BetterAuthzModule = BetterAuthzModule_1 = class BetterAuthzModule {
|
|
23
|
+
static forRoot() {
|
|
24
|
+
throw new Error("BetterAuthzModule.forRoot() is not supported. Use forRootAsync() instead.");
|
|
25
|
+
}
|
|
26
|
+
static forRootAsync(options) {
|
|
27
|
+
return {
|
|
28
|
+
module: BetterAuthzModule_1,
|
|
29
|
+
global: options.isGlobal ?? false,
|
|
30
|
+
imports: [
|
|
31
|
+
...(options.imports ?? []),
|
|
32
|
+
PassportModule.register({ defaultStrategy: "jwt" }),
|
|
33
|
+
TypeOrmModule.forFeature([User, Invitation]),
|
|
34
|
+
],
|
|
35
|
+
providers: [
|
|
36
|
+
{
|
|
37
|
+
provide: BETTER_AUTHZ_MODULE_OPTIONS,
|
|
38
|
+
useFactory: options.useFactory,
|
|
39
|
+
inject: options.inject ?? [],
|
|
40
|
+
},
|
|
41
|
+
BetterAuthApiKeyStrategy,
|
|
42
|
+
BetterAuthConfigurationService,
|
|
43
|
+
BetterAuthStrategy,
|
|
44
|
+
BetterAuthUserValidationService,
|
|
45
|
+
],
|
|
46
|
+
exports: [BetterAuthConfigurationService, PassportModule],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
BetterAuthzModule = BetterAuthzModule_1 = __decorate([
|
|
51
|
+
Module({})
|
|
52
|
+
], BetterAuthzModule);
|
|
53
|
+
export { BetterAuthzModule };
|
|
54
|
+
//# sourceMappingURL=better-authz.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"better-authz.module.js","sourceRoot":"","sources":["../../src/authorization/better-authz.module.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAgB,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,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|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ModuleMetadata } from "@nestjs/common";
|
|
2
|
+
import type { AuthenticatedUserProfileResolver } from "./models/AuthenticatedUserProfile.js";
|
|
3
|
+
export declare const BETTER_AUTHZ_MODULE_OPTIONS: unique symbol;
|
|
4
|
+
export interface BetterAuthzModuleOptions {
|
|
5
|
+
resolveUser: AuthenticatedUserProfileResolver;
|
|
6
|
+
superUserIds?: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface BetterAuthzModuleAsyncOptions extends Pick<ModuleMetadata, "imports"> {
|
|
9
|
+
useFactory: (...arguments_: any[]) => Promise<BetterAuthzModuleOptions> | BetterAuthzModuleOptions;
|
|
10
|
+
inject?: any[];
|
|
11
|
+
isGlobal?: boolean;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"better-authz.options.js","sourceRoot":"","sources":["../../src/authorization/better-authz.options.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAC7C,6BAA6B,CAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthConfigurationService.js","sourceRoot":"","sources":["../../../src/authorization/config/AuthConfigurationService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAC,6BAA6B,EAAC,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AAIlD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,6BAA6B;IAG3D;
|
|
1
|
+
{"version":3,"file":"AuthConfigurationService.js","sourceRoot":"","sources":["../../../src/authorization/config/AuthConfigurationService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAC,6BAA6B,EAAC,MAAM,sDAAsD,CAAC;AACnG,OAAO,EAAC,oBAAoB,EAAC,MAAM,qBAAqB,CAAC;AAIlD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,6BAA6B;IAG3D,OAAO;IAFnB,YAEY,OAA2B;QAEnC,KAAK,EAAE,CAAC;uBAFA,OAAO;IAGnB,CAAC;IAED,IAEI,aAAa;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;IACtC,CAAC;IAED,IAEI,WAAW;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACpC,CAAC;IAED,IAEI,YAAY;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;IACrC,CAAC;CACJ,CAAA;AAjBG;IAAC,SAAS,EAAE;IACX,QAAQ,EAAE;;;6DAGV;AAED;IAAC,SAAS,EAAE;IACX,QAAQ,EAAE;;;2DAGV;AAED;IAAC,SAAS,EAAE;IACX,OAAO,EAAE;;;4DAGT;AAxBQ,wBAAwB;IADpC,UAAU,EAAE;IAGJ,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;;GAFxB,wBAAwB,CAyBpC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type BetterAuthzModuleOptions } from "../better-authz.options.js";
|
|
2
|
+
import type { AuthenticatedUserProfileResolver } from "../models/AuthenticatedUserProfile.js";
|
|
3
|
+
export declare class BetterAuthConfigurationService {
|
|
4
|
+
private readonly options;
|
|
5
|
+
constructor(options: BetterAuthzModuleOptions);
|
|
6
|
+
get resolveUser(): AuthenticatedUserProfileResolver;
|
|
7
|
+
get superUserIds(): string[];
|
|
8
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
14
|
+
import { BETTER_AUTHZ_MODULE_OPTIONS, } from "../better-authz.options.js";
|
|
15
|
+
let BetterAuthConfigurationService = class BetterAuthConfigurationService {
|
|
16
|
+
options;
|
|
17
|
+
constructor(options) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
}
|
|
20
|
+
get resolveUser() {
|
|
21
|
+
return this.options.resolveUser;
|
|
22
|
+
}
|
|
23
|
+
get superUserIds() {
|
|
24
|
+
return this.options.superUserIds ?? [];
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
BetterAuthConfigurationService = __decorate([
|
|
28
|
+
Injectable(),
|
|
29
|
+
__param(0, Inject(BETTER_AUTHZ_MODULE_OPTIONS)),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], BetterAuthConfigurationService);
|
|
32
|
+
export { BetterAuthConfigurationService };
|
|
33
|
+
//# sourceMappingURL=BetterAuthConfigurationService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BetterAuthConfigurationService.js","sourceRoot":"","sources":["../../../src/authorization/config/BetterAuthConfigurationService.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACH,2BAA2B,GAE9B,MAAM,4BAA4B,CAAC;AAI7B,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGlB,OAAO;IAF5B,YAEqB,OAAiC;uBAAjC,OAAO;IACzB,CAAC;IAEJ,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACpC,CAAC;IAED,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,CAAC;IAC3C,CAAC;CACJ,CAAA;AAbY,8BAA8B;IAD1C,UAAU,EAAE;IAGJ,WAAA,MAAM,CAAC,2BAA2B,CAAC,CAAA;;GAF/B,8BAA8B,CAa1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClaimsAuthorisationGuard.js","sourceRoot":"","sources":["../../../src/authorization/guards/ClaimsAuthorisationGuard.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAGH,UAAU,EACV,MAAM,GACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAIhC,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAGJ;
|
|
1
|
+
{"version":3,"file":"ClaimsAuthorisationGuard.js","sourceRoot":"","sources":["../../../src/authorization/guards/ClaimsAuthorisationGuard.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAGH,UAAU,EACV,MAAM,GACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAIhC,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAGJ,SAAS;IAFrB,MAAM,GAAG,IAAI,MAAM,CAAC,2BAAyB,IAAI,CAAC,CAAC;IAEpE,YAA6B,SAAoB;yBAApB,SAAS;IAAc,CAAC;IAErD,WAAW,CACP,OAAyB;QAEzB,IAAI,CAAC;YACD,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CACvC,qBAAqB,EACrB,OAAO,CAAC,UAAU,EAAE,CACvB,CAAC;YAEF,MAAM,WAAW,GAAG,OAAO;iBACtB,YAAY,EAAE;iBACd,UAAU,EAAmB,CAAC;YACnC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;YAE9B,uEAAuE;YACvE,IAAI,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACrD,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,uEAAuE;YACvE,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC;gBACrB,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC,eAAe,EAAE,EAAE,CAC9C,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,CAC7C,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;YACjD,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;CACJ,CAAA;AApCY,wBAAwB;IADpC,UAAU,EAAE;qCAI+B,SAAS;GAHxC,wBAAwB,CAoCpC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Request } from "express";
|
|
2
|
+
/**
|
|
3
|
+
* Provider-neutral identity returned after an authentication session is
|
|
4
|
+
* validated. Application authorization remains owned by the Nest backend.
|
|
5
|
+
*/
|
|
6
|
+
export interface AuthenticatedUserProfile {
|
|
7
|
+
id: string;
|
|
8
|
+
email: string;
|
|
9
|
+
emailVerified: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
familyName?: string;
|
|
12
|
+
givenName?: string;
|
|
13
|
+
picture?: string;
|
|
14
|
+
username?: string;
|
|
15
|
+
permissions?: string[];
|
|
16
|
+
}
|
|
17
|
+
export type AuthenticatedUserProfileResolver = (request: Request) => Promise<AuthenticatedUserProfile | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthenticatedUserProfile.js","sourceRoot":"","sources":["../../../src/authorization/models/AuthenticatedUserProfile.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Repository } from "typeorm";
|
|
2
|
+
import { Invitation } from "../../invitations/entities/invitation.entity.js";
|
|
3
|
+
import { User } from "../../user/entities/user.entity.js";
|
|
4
|
+
import { BetterAuthConfigurationService } from "../config/BetterAuthConfigurationService.js";
|
|
5
|
+
import type { AuthenticatedUserProfile } from "../models/AuthenticatedUserProfile.js";
|
|
6
|
+
import type { RequestUser } from "../models/RequestWithUser.js";
|
|
7
|
+
export declare class BetterAuthUserValidationService {
|
|
8
|
+
private readonly userRepository;
|
|
9
|
+
private readonly invitationRepository;
|
|
10
|
+
private readonly config;
|
|
11
|
+
private readonly logger;
|
|
12
|
+
constructor(userRepository: Repository<User>, invitationRepository: Repository<Invitation>, config: BetterAuthConfigurationService);
|
|
13
|
+
validateUser(profile: AuthenticatedUserProfile, invitationId?: string): Promise<RequestUser>;
|
|
14
|
+
findUserByApiKey(apiKey: string): Promise<User | null>;
|
|
15
|
+
private addPermissionsToUser;
|
|
16
|
+
private findUserById;
|
|
17
|
+
private findUserByAuthProviderId;
|
|
18
|
+
private findAndLinkExistingUser;
|
|
19
|
+
private get userRelations();
|
|
20
|
+
private handleInvitedUser;
|
|
21
|
+
private handleNewIndependentUser;
|
|
22
|
+
private mapProfileToEntity;
|
|
23
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
var BetterAuthUserValidationService_1;
|
|
14
|
+
import { BadRequestException, Injectable, Logger, NotFoundException, } from "@nestjs/common";
|
|
15
|
+
import { InjectRepository } from "@nestjs/typeorm";
|
|
16
|
+
import { ILike, IsNull, MoreThan, Repository } from "typeorm";
|
|
17
|
+
import { Invitation } from "../../invitations/entities/invitation.entity.js";
|
|
18
|
+
import { OrganisationMembership } from "../../organisation-memberships/entities/organisation-membership.entity.js";
|
|
19
|
+
import { Roles } from "../../organisation/dto/RolesEnum.js";
|
|
20
|
+
import { MembershipRole } from "../../organisation/entities/member-role.entity.js";
|
|
21
|
+
import { Organisation } from "../../organisation/entities/organisation.entity.js";
|
|
22
|
+
import { User } from "../../user/entities/user.entity.js";
|
|
23
|
+
import { BetterAuthConfigurationService } from "../config/BetterAuthConfigurationService.js";
|
|
24
|
+
let BetterAuthUserValidationService = BetterAuthUserValidationService_1 = class BetterAuthUserValidationService {
|
|
25
|
+
userRepository;
|
|
26
|
+
invitationRepository;
|
|
27
|
+
config;
|
|
28
|
+
logger = new Logger(BetterAuthUserValidationService_1.name);
|
|
29
|
+
constructor(userRepository, invitationRepository, config) {
|
|
30
|
+
this.userRepository = userRepository;
|
|
31
|
+
this.invitationRepository = invitationRepository;
|
|
32
|
+
this.config = config;
|
|
33
|
+
}
|
|
34
|
+
async validateUser(profile, invitationId) {
|
|
35
|
+
if (invitationId) {
|
|
36
|
+
return this.addPermissionsToUser(await this.handleInvitedUser(profile, invitationId), profile.permissions);
|
|
37
|
+
}
|
|
38
|
+
let foundUser = await this.findUserByAuthProviderId(profile.id);
|
|
39
|
+
if (!foundUser && profile.emailVerified) {
|
|
40
|
+
foundUser = await this.findAndLinkExistingUser(profile);
|
|
41
|
+
}
|
|
42
|
+
if (foundUser?.memberships && foundUser.memberships.length > 0) {
|
|
43
|
+
return this.addPermissionsToUser(foundUser, profile.permissions);
|
|
44
|
+
}
|
|
45
|
+
return this.addPermissionsToUser(await this.handleNewIndependentUser(foundUser, profile), profile.permissions);
|
|
46
|
+
}
|
|
47
|
+
async findUserByApiKey(apiKey) {
|
|
48
|
+
return this.userRepository.findOne({
|
|
49
|
+
where: { apiKeys: { apiKey } },
|
|
50
|
+
relations: this.userRelations,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
addPermissionsToUser(user, authProviderPermissions) {
|
|
54
|
+
if (!user.id) {
|
|
55
|
+
throw new Error("Unable to authenticate a valid application user");
|
|
56
|
+
}
|
|
57
|
+
const permissions = new Set(authProviderPermissions ?? []);
|
|
58
|
+
if (user.authProviderUserId &&
|
|
59
|
+
this.config.superUserIds.includes(user.authProviderUserId)) {
|
|
60
|
+
permissions.add("read:all");
|
|
61
|
+
permissions.add("modify:all");
|
|
62
|
+
}
|
|
63
|
+
const activeSubscriptionProductKeys = new Set(user.memberships
|
|
64
|
+
?.flatMap((membership) => membership.organisation.subscriptionRecords ?? [])
|
|
65
|
+
.filter((subscription) => subscription.validUntil > new Date())
|
|
66
|
+
.map((subscription) => subscription.internalSku) ?? []);
|
|
67
|
+
return {
|
|
68
|
+
// RequestUser deliberately serializes the persisted user into a request principal.
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-spread
|
|
70
|
+
...user,
|
|
71
|
+
permissions: [...permissions],
|
|
72
|
+
activeSubscriptionProductKeys: [...activeSubscriptionProductKeys],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
async findUserById(id) {
|
|
76
|
+
return this.userRepository.findOne({
|
|
77
|
+
where: { id },
|
|
78
|
+
relations: this.userRelations,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async findUserByAuthProviderId(authProviderUserId) {
|
|
82
|
+
return this.userRepository.findOne({
|
|
83
|
+
where: { authProviderUserId },
|
|
84
|
+
relations: this.userRelations,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async findAndLinkExistingUser(profile) {
|
|
88
|
+
const matches = await this.userRepository.find({
|
|
89
|
+
where: { email: ILike(profile.email) },
|
|
90
|
+
relations: this.userRelations,
|
|
91
|
+
take: 2,
|
|
92
|
+
});
|
|
93
|
+
if (matches.length > 1) {
|
|
94
|
+
this.logger.warn(`Cannot automatically link auth identity ${profile.id}: multiple application users share its verified email`);
|
|
95
|
+
throw new BadRequestException("This identity cannot be linked automatically. Contact support.");
|
|
96
|
+
}
|
|
97
|
+
if (matches.length === 0) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const user = matches[0];
|
|
101
|
+
this.mapProfileToEntity(user, profile);
|
|
102
|
+
await this.userRepository.save(user);
|
|
103
|
+
this.logger.log(`Linked auth identity ${profile.id} to existing application user ${String(user.id)}`);
|
|
104
|
+
return user;
|
|
105
|
+
}
|
|
106
|
+
get userRelations() {
|
|
107
|
+
return {
|
|
108
|
+
memberships: {
|
|
109
|
+
roles: true,
|
|
110
|
+
user: false,
|
|
111
|
+
organisation: { subscriptionRecords: true },
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
async handleInvitedUser(profile, invitationCode) {
|
|
116
|
+
const now = new Date();
|
|
117
|
+
const invitation = await this.invitationRepository.findOne({
|
|
118
|
+
where: {
|
|
119
|
+
uuid: invitationCode,
|
|
120
|
+
acceptedOn: IsNull(),
|
|
121
|
+
expiresOn: MoreThan(now),
|
|
122
|
+
},
|
|
123
|
+
relations: {
|
|
124
|
+
organisationMembership: {
|
|
125
|
+
user: true,
|
|
126
|
+
organisation: true,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
if (!invitation) {
|
|
131
|
+
throw new NotFoundException("Valid invitation not found with provided code");
|
|
132
|
+
}
|
|
133
|
+
invitation.acceptedOn = new Date();
|
|
134
|
+
const memberRole = invitation.organisationMembership.roles?.find((role) => role.name === Roles.invited.toString());
|
|
135
|
+
if (!memberRole) {
|
|
136
|
+
throw new Error("Invited role not found for member");
|
|
137
|
+
}
|
|
138
|
+
memberRole.name = Roles.member;
|
|
139
|
+
this.mapProfileToEntity(invitation.organisationMembership.user, profile);
|
|
140
|
+
try {
|
|
141
|
+
await this.invitationRepository.save(invitation);
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
if (error.message?.includes("duplicate key")) {
|
|
145
|
+
throw new BadRequestException("User is already a member of this organisation");
|
|
146
|
+
}
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
const user = await this.findUserById(invitation.organisationMembership.user.id);
|
|
150
|
+
if (!user) {
|
|
151
|
+
throw new Error("User not found after accepting invitation");
|
|
152
|
+
}
|
|
153
|
+
return user;
|
|
154
|
+
}
|
|
155
|
+
async handleNewIndependentUser(foundUser, profile) {
|
|
156
|
+
this.logger.log(`Provisioning application user ${profile.id}`);
|
|
157
|
+
const ownerRole = new MembershipRole();
|
|
158
|
+
ownerRole.name = Roles.owner;
|
|
159
|
+
const organisation = new Organisation();
|
|
160
|
+
organisation.name = profile.givenName
|
|
161
|
+
? `${profile.givenName}'s Organisation`
|
|
162
|
+
: "My Organisation";
|
|
163
|
+
const membership = new OrganisationMembership();
|
|
164
|
+
membership.organisation = organisation;
|
|
165
|
+
membership.roles = [ownerRole];
|
|
166
|
+
const user = foundUser ?? this.userRepository.create();
|
|
167
|
+
user.memberships = [membership];
|
|
168
|
+
this.mapProfileToEntity(user, profile);
|
|
169
|
+
const savedUser = await this.userRepository.save(user);
|
|
170
|
+
const loadedUser = await this.findUserById(savedUser.id);
|
|
171
|
+
if (!loadedUser) {
|
|
172
|
+
throw new Error("User not found after provisioning");
|
|
173
|
+
}
|
|
174
|
+
return loadedUser;
|
|
175
|
+
}
|
|
176
|
+
mapProfileToEntity(user, profile) {
|
|
177
|
+
user.authProviderUserId = profile.id;
|
|
178
|
+
user.blocked = false;
|
|
179
|
+
user.email = profile.email;
|
|
180
|
+
user.emailVerified = profile.emailVerified;
|
|
181
|
+
user.familyName = profile.familyName;
|
|
182
|
+
user.givenName = profile.givenName;
|
|
183
|
+
user.name = profile.name;
|
|
184
|
+
user.picture = profile.picture;
|
|
185
|
+
user.username = profile.username;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
BetterAuthUserValidationService = BetterAuthUserValidationService_1 = __decorate([
|
|
189
|
+
Injectable(),
|
|
190
|
+
__param(0, InjectRepository(User)),
|
|
191
|
+
__param(1, InjectRepository(Invitation)),
|
|
192
|
+
__metadata("design:paramtypes", [Repository,
|
|
193
|
+
Repository,
|
|
194
|
+
BetterAuthConfigurationService])
|
|
195
|
+
], BetterAuthUserValidationService);
|
|
196
|
+
export { BetterAuthUserValidationService };
|
|
197
|
+
//# sourceMappingURL=BetterAuthUserValidation.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BetterAuthUserValidation.service.js","sourceRoot":"","sources":["../../../src/authorization/services/BetterAuthUserValidation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EACH,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,iBAAiB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,KAAK,EA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,UAAU;QACxB,8BAA8B;GARlD,+BAA+B,CA6O3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserValidation.service.js","sourceRoot":"","sources":["../../../src/authorization/services/UserValidation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gEAAgE;AAChE,OAAO,EACH,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,iBAAiB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AACrD,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,UAAU,EAAC,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAC,sBAAsB,EAAC,MAAM,2EAA2E,CAAC;AACjH,OAAO,EAAC,KAAK,EAAC,MAAM,qCAAqC,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAC,YAAY,EAAC,MAAM,oDAAoD,CAAC;AAChF,OAAO,EAAC,IAAI,EAAC,MAAM,oCAAoC,CAAC;AACxD,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAMxE,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAIlB;
|
|
1
|
+
{"version":3,"file":"UserValidation.service.js","sourceRoot":"","sources":["../../../src/authorization/services/UserValidation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gEAAgE;AAChE,OAAO,EACH,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,iBAAiB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AACrD,OAAO,EAAC,kBAAk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,CAAC,oBAAoB,CAAC;IACzC;
|
|
1
|
+
{"version":3,"file":"apikeystrategy.js","sourceRoot":"","sources":["../../../src/authorization/strategies/apikeystrategy.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,qBAAqB,EAAC,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAInC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,gBAAgB,CAAC,oBAAoB,CAAC;IACzC,qBAAqB;IAAlD,YAA6B,qBAA4C;QACrE,KAAK,CACD,EAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAC,EAC7C,IAAI;QACJ,6DAA6D;QAC7D,mBAAmB;QACnB,KAAK,EACD,MAAc,EACd,IAIY,EACd,EAAE;YACA,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC,CACJ,CAAC;qCAhBuB,qBAAqB;IAiBlD,CAAC;IAED,KAAK,CAAC,QAAQ,CACV,MAAc,EACd,IAIY;QAEZ,IAAI,CAAC;YACD,MAAM,SAAS,GACX,MAAM,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAE9D,uEAAuE;YACvE,IAAI,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;gBACnC,IAAI,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;YACvC,CAAC;YAED,oEAAoE;YACpE,IAAI,CAAC,SAAS,EAAE,SAAU,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,KAAc,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;CACJ,CAAA;AA3CY,cAAc;IAD1B,UAAU,EAAE;qCAE2C,qBAAqB;GADhE,cAAc,CA2C1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authzstrategy.js","sourceRoot":"","sources":["../../../src/authorization/strategies/authzstrategy.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAG3C,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAC,qBAAqB,EAAC,MAAM,uCAAuC,CAAC;AAGrE,IAAM,WAAW,mBAAjB,MAAM,WAAY,SAAQ,gBAAgB,CAAC,QAAQ,CAAC;IAGlC;
|
|
1
|
+
{"version":3,"file":"authzstrategy.js","sourceRoot":"","sources":["../../../src/authorization/strategies/authzstrategy.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAG3C,OAAO,EAAC,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAE/E,OAAO,EAAC,qBAAqB,EAAC,MAAM,uCAAuC,CAAC;AAGrE,IAAM,WAAW,mBAAjB,MAAM,WAAY,SAAQ,gBAAgB,CAAC,QAAQ,CAAC;IAGlC,qBAAqB;IAFzB,MAAM,GAAG,IAAI,MAAM,CAAC,cAAY,IAAI,CAAC,CAAC;IACvD,YACqB,qBAA4C,EAC7D,MAAgC;QAEhC,KAAK,CAAC;YACF,mBAAmB,EAAE,iBAAiB,CAAC;gBACnC,KAAK,EAAE,IAAI;gBACX,SAAS,EAAE,IAAI;gBACf,qBAAqB,EAAE,CAAC;gBACxB,OAAO,EAAE,WAAW,MAAM,CAAC,WAAW,wBAAwB;aACjE,CAAC;YACF,iBAAiB,EAAE,IAAI;YAEvB,cAAc,EAAE,UAAU,CAAC,2BAA2B,EAAE;YACxD,QAAQ,EAAE,MAAM,CAAC,aAAa;YAC9B,MAAM,EAAE,WAAW,MAAM,CAAC,WAAW,GAAG;YACxC,UAAU,EAAE,CAAC,OAAO,CAAC;SACxB,CAAC,CAAC;qCAhBc,qBAAqB;IAiB1C,CAAC;IAED,KAAK,CAAC,QAAQ,CACV,OAAgB,EAChB,OAAoB;QAEpB,MAAM,cAAc,GAAG,UAAU,CAAC,2BAA2B,EAAE;QAC3D,8DAA8D;QAC9D,OAAc,CACjB,CAAC;QACF,IAAI,CAAC,cAAc,EAAE,CAAC;YAClB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACvD,OAAO;QACX,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG;QACX,uEAAuE;QACvE,qCAAqC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CACtE,CAAC;QACF,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,YAAsB,CAAC;QAE1D,OAAO,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAC1C,OAAO,EACP,cAAc,EACd,YAAY,CACf,CAAC;IACN,CAAC;CACJ,CAAA;AA9CY,WAAW;IADvB,UAAU,EAAE;qCAImC,qBAAqB;QACrD,wBAAwB;GAJ3B,WAAW,CA8CvB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HeaderAPIKeyStrategy } from "passport-headerapikey";
|
|
2
|
+
import type { User } from "../../user/entities/user.entity.js";
|
|
3
|
+
import { BetterAuthUserValidationService } from "../services/BetterAuthUserValidation.service.js";
|
|
4
|
+
declare const BetterAuthApiKeyStrategy_base: new (header: {
|
|
5
|
+
header: string;
|
|
6
|
+
prefix: string;
|
|
7
|
+
}, passReqToCallback: boolean) => HeaderAPIKeyStrategy & {
|
|
8
|
+
validate(...args: any[]): unknown;
|
|
9
|
+
};
|
|
10
|
+
export declare class BetterAuthApiKeyStrategy extends BetterAuthApiKeyStrategy_base {
|
|
11
|
+
private readonly userValidationService;
|
|
12
|
+
constructor(userValidationService: BetterAuthUserValidationService);
|
|
13
|
+
validate(apiKey: string, done: (error?: Error, user?: User) => void): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Injectable } from "@nestjs/common";
|
|
11
|
+
import { PassportStrategy } from "@nestjs/passport";
|
|
12
|
+
import { HeaderAPIKeyStrategy } from "passport-headerapikey";
|
|
13
|
+
import { BetterAuthUserValidationService } from "../services/BetterAuthUserValidation.service.js";
|
|
14
|
+
let BetterAuthApiKeyStrategy = class BetterAuthApiKeyStrategy extends PassportStrategy(HeaderAPIKeyStrategy) {
|
|
15
|
+
userValidationService;
|
|
16
|
+
constructor(userValidationService) {
|
|
17
|
+
super({ header: "Authorization", prefix: "Api-Key " }, true,
|
|
18
|
+
// passport-headerapikey's callback overload is missing from its types.
|
|
19
|
+
// @ts-expect-error -- callback mode is supported by the runtime strategy.
|
|
20
|
+
async (apiKey, done) => {
|
|
21
|
+
await this.validate(apiKey, done);
|
|
22
|
+
});
|
|
23
|
+
this.userValidationService = userValidationService;
|
|
24
|
+
}
|
|
25
|
+
async validate(apiKey, done) {
|
|
26
|
+
try {
|
|
27
|
+
const user = await this.userValidationService.findUserByApiKey(apiKey);
|
|
28
|
+
if (!user) {
|
|
29
|
+
done(new Error("Invalid API key"));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
done(undefined, user);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
done(error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
BetterAuthApiKeyStrategy = __decorate([
|
|
40
|
+
Injectable(),
|
|
41
|
+
__metadata("design:paramtypes", [BetterAuthUserValidationService])
|
|
42
|
+
], BetterAuthApiKeyStrategy);
|
|
43
|
+
export { BetterAuthApiKeyStrategy };
|
|
44
|
+
//# sourceMappingURL=better-auth-apikey.strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"better-auth-apikey.strategy.js","sourceRoot":"","sources":["../../../src/authorization/strategies/better-auth-apikey.strategy.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,oBAAoB,EAAC,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAC,+BAA+B,EAAC,MAAM,iDAAiD,CAAC;AAGzF,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,gBAAgB,CAC1D,oBAAoB,CACvB;IAEwB,qBAAqB;IAD1C,YACqB,qBAAsD;QAEvE,KAAK,CACD,EAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAC,EAC7C,IAAI;QACJ,uEAAuE;QACvE,0EAA0E;QAC1E,KAAK,EACD,MAAc,EACd,IAA0C,EAC5C,EAAE;YACA,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC,CACJ,CAAC;qCAbe,qBAAqB;IAc1C,CAAC;IAED,KAAK,CAAC,QAAQ,CACV,MAAc,EACd,IAA0C;QAE1C,IAAI,CAAC;YACD,MAAM,IAAI,GACN,MAAM,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;YAC9D,IAAI,CAAC,IAAI,EAAE,CAAC;gBACR,IAAI,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;gBACnC,OAAO;YACX,CAAC;YACD,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,KAAc,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;CACJ,CAAA;AApCY,wBAAwB;IADpC,UAAU,EAAE;qCAKmC,+BAA+B;GAJlE,wBAAwB,CAoCpC"}
|