@mondomob/gae-node-nestjs 12.0.0-alpha-2 → 12.0.0-alpha-3
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/_test/mocks.d.ts +9 -0
- package/dist/_test/mocks.js +27 -0
- package/dist/_test/mocks.js.map +1 -0
- package/dist/_test/request-scope-test-utils.d.ts +3 -0
- package/dist/_test/request-scope-test-utils.js +18 -0
- package/dist/_test/request-scope-test-utils.js.map +1 -0
- package/dist/auth/auth-user.model.d.ts +9 -0
- package/dist/auth/auth-user.model.js +33 -0
- package/dist/auth/auth-user.model.js.map +1 -0
- package/dist/auth/auth.callbacks.d.ts +8 -0
- package/dist/auth/auth.callbacks.js +5 -0
- package/dist/auth/auth.callbacks.js.map +1 -0
- package/dist/auth/auth.configurer.d.ts +35 -0
- package/dist/auth/auth.configurer.js +212 -0
- package/dist/auth/auth.configurer.js.map +1 -0
- package/dist/auth/auth.controller.d.ts +27 -0
- package/dist/auth/auth.controller.js +312 -0
- package/dist/auth/auth.controller.js.map +1 -0
- package/dist/auth/auth.guard.d.ts +16 -0
- package/dist/auth/auth.guard.js +127 -0
- package/dist/auth/auth.guard.js.map +1 -0
- package/dist/auth/auth.listener.d.ts +5 -0
- package/dist/auth/auth.listener.js +5 -0
- package/dist/auth/auth.listener.js.map +1 -0
- package/dist/auth/auth.repository.d.ts +52 -0
- package/dist/auth/auth.repository.js +79 -0
- package/dist/auth/auth.repository.js.map +1 -0
- package/dist/auth/auth.resolver.d.ts +13 -0
- package/dist/auth/auth.resolver.js +86 -0
- package/dist/auth/auth.resolver.js.map +1 -0
- package/dist/auth/auth.service.d.ts +35 -0
- package/dist/auth/auth.service.js +299 -0
- package/dist/auth/auth.service.js.map +1 -0
- package/dist/auth/auth.task.controller.d.ts +13 -0
- package/dist/auth/auth.task.controller.js +76 -0
- package/dist/auth/auth.task.controller.js.map +1 -0
- package/dist/auth/auth.task.service.d.ts +8 -0
- package/dist/auth/auth.task.service.js +26 -0
- package/dist/auth/auth.task.service.js.map +1 -0
- package/dist/auth/csrf.interceptor.d.ts +11 -0
- package/dist/auth/csrf.interceptor.js +38 -0
- package/dist/auth/csrf.interceptor.js.map +1 -0
- package/dist/auth/invite-user.service.d.ts +45 -0
- package/dist/auth/invite-user.service.js +215 -0
- package/dist/auth/invite-user.service.js.map +1 -0
- package/dist/auth/invite.callbacks.d.ts +6 -0
- package/dist/auth/invite.callbacks.js +5 -0
- package/dist/auth/invite.callbacks.js.map +1 -0
- package/dist/auth/login-identifier.repository.d.ts +13 -0
- package/dist/auth/login-identifier.repository.js +28 -0
- package/dist/auth/login-identifier.repository.js.map +1 -0
- package/dist/auth/password-reset.service.d.ts +15 -0
- package/dist/auth/password-reset.service.js +81 -0
- package/dist/auth/password-reset.service.js.map +1 -0
- package/dist/auth/user.service.d.ts +27 -0
- package/dist/auth/user.service.js +94 -0
- package/dist/auth/user.service.js.map +1 -0
- package/dist/configuration.d.ts +84 -0
- package/dist/configuration.js +5 -0
- package/dist/configuration.js.map +1 -0
- package/dist/configure.d.ts +40 -0
- package/dist/configure.js +85 -0
- package/dist/configure.js.map +1 -0
- package/dist/context/context-middleware.d.ts +15 -0
- package/dist/context/context-middleware.js +37 -0
- package/dist/context/context-middleware.js.map +1 -0
- package/dist/context/context-request-scope.d.ts +8 -0
- package/dist/context/context-request-scope.js +29 -0
- package/dist/context/context-request-scope.js.map +1 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +9 -0
- package/dist/context/index.js.map +1 -0
- package/dist/datastore/context.d.ts +36 -0
- package/dist/datastore/context.js +27 -0
- package/dist/datastore/context.js.map +1 -0
- package/dist/datastore/datastore.provider.d.ts +8 -0
- package/dist/datastore/datastore.provider.js +30 -0
- package/dist/datastore/datastore.provider.js.map +1 -0
- package/dist/datastore/filters.d.ts +19 -0
- package/dist/datastore/filters.js +27 -0
- package/dist/datastore/filters.js.map +1 -0
- package/dist/datastore/loader.d.ts +50 -0
- package/dist/datastore/loader.js +147 -0
- package/dist/datastore/loader.js.map +1 -0
- package/dist/datastore/node-datastore-session.d.ts +17 -0
- package/dist/datastore/node-datastore-session.js +87 -0
- package/dist/datastore/node-datastore-session.js.map +1 -0
- package/dist/datastore/repository.d.ts +45 -0
- package/dist/datastore/repository.js +150 -0
- package/dist/datastore/repository.js.map +1 -0
- package/dist/datastore/transactional.d.ts +4 -0
- package/dist/datastore/transactional.js +13 -0
- package/dist/datastore/transactional.js.map +1 -0
- package/dist/error/NonFatalError.d.ts +3 -0
- package/dist/error/NonFatalError.js +11 -0
- package/dist/error/NonFatalError.js.map +1 -0
- package/dist/filter.d.ts +5 -0
- package/dist/filter.js +40 -0
- package/dist/filter.js.map +1 -0
- package/dist/gcloud/logging.d.ts +1 -0
- package/dist/gcloud/logging.js +5 -0
- package/dist/gcloud/logging.js.map +1 -0
- package/dist/gcloud/storage.provider.d.ts +12 -0
- package/dist/gcloud/storage.provider.js +41 -0
- package/dist/gcloud/storage.provider.js.map +1 -0
- package/dist/gcloud/tasks.d.ts +10 -0
- package/dist/gcloud/tasks.js +68 -0
- package/dist/gcloud/tasks.js.map +1 -0
- package/dist/graphql/GraphQLMiddleware.d.ts +0 -0
- package/dist/graphql/GraphQLMiddleware.js +2 -0
- package/dist/graphql/GraphQLMiddleware.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/index.d.ts +1 -0
- package/dist/logging/index.js +8 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logging-internal.d.ts +2 -0
- package/dist/logging/logging-internal.js +20 -0
- package/dist/logging/logging-internal.js.map +1 -0
- package/dist/logging/logging-request-scope.d.ts +15 -0
- package/dist/logging/logging-request-scope.js +39 -0
- package/dist/logging/logging-request-scope.js.map +1 -0
- package/dist/logging/logging.d.ts +34 -0
- package/dist/logging/logging.js +55 -0
- package/dist/logging/logging.js.map +1 -0
- package/dist/mail/gmail/gmail.configurer.d.ts +15 -0
- package/dist/mail/gmail/gmail.configurer.js +59 -0
- package/dist/mail/gmail/gmail.configurer.js.map +1 -0
- package/dist/mail/gmail/gmail.controller.d.ts +9 -0
- package/dist/mail/gmail/gmail.controller.js +62 -0
- package/dist/mail/gmail/gmail.controller.js.map +1 -0
- package/dist/mail/gmail/gmail.sender.d.ts +12 -0
- package/dist/mail/gmail/gmail.sender.js +62 -0
- package/dist/mail/gmail/gmail.sender.js.map +1 -0
- package/dist/mail/gmail/stored.credentials.repository.d.ts +12 -0
- package/dist/mail/gmail/stored.credentials.repository.js +23 -0
- package/dist/mail/gmail/stored.credentials.repository.js.map +1 -0
- package/dist/mail/mail-logging.sender.d.ts +9 -0
- package/dist/mail/mail-logging.sender.js +42 -0
- package/dist/mail/mail-logging.sender.js.map +1 -0
- package/dist/mail/mail-subject.sender.d.ts +12 -0
- package/dist/mail/mail-subject.sender.js +33 -0
- package/dist/mail/mail-subject.sender.js.map +1 -0
- package/dist/mail/mail-whitelist.sender.d.ts +14 -0
- package/dist/mail/mail-whitelist.sender.js +59 -0
- package/dist/mail/mail-whitelist.sender.js.map +1 -0
- package/dist/mail/mail.diverter.d.ts +13 -0
- package/dist/mail/mail.diverter.js +65 -0
- package/dist/mail/mail.diverter.js.map +1 -0
- package/dist/mail/mail.sender.d.ts +6 -0
- package/dist/mail/mail.sender.js +5 -0
- package/dist/mail/mail.sender.js.map +1 -0
- package/dist/mail/smtp/smtp.sender.d.ts +10 -0
- package/dist/mail/smtp/smtp.sender.js +65 -0
- package/dist/mail/smtp/smtp.sender.js.map +1 -0
- package/dist/mail-templates/base.d.ts +2 -0
- package/dist/mail-templates/base.js +328 -0
- package/dist/mail-templates/base.js.map +1 -0
- package/dist/mail-templates/invite.d.ts +1 -0
- package/dist/mail-templates/invite.js +19 -0
- package/dist/mail-templates/invite.js.map +1 -0
- package/dist/module.d.ts +16 -0
- package/dist/module.js +136 -0
- package/dist/module.js.map +1 -0
- package/dist/request-scope/index.d.ts +2 -0
- package/dist/request-scope/index.js +9 -0
- package/dist/request-scope/index.js.map +1 -0
- package/dist/request-scope/request-scope-interceptor.d.ts +5 -0
- package/dist/request-scope/request-scope-interceptor.js +3 -0
- package/dist/request-scope/request-scope-interceptor.js.map +1 -0
- package/dist/request-scope/request-scope.d.ts +12 -0
- package/dist/request-scope/request-scope.js +79 -0
- package/dist/request-scope/request-scope.js.map +1 -0
- package/dist/request-scope/request-scope.middleware.d.ts +15 -0
- package/dist/request-scope/request-scope.middleware.js +53 -0
- package/dist/request-scope/request-scope.middleware.js.map +1 -0
- package/dist/search/search.service.d.ts +52 -0
- package/dist/search/search.service.js +90 -0
- package/dist/search/search.service.js.map +1 -0
- package/dist/search/searchable.repository.d.ts +36 -0
- package/dist/search/searchable.repository.js +95 -0
- package/dist/search/searchable.repository.js.map +1 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/util/arrays.d.ts +1 -0
- package/dist/util/arrays.js +10 -0
- package/dist/util/arrays.js.map +1 -0
- package/dist/util/guards.d.ts +1 -0
- package/dist/util/guards.js +7 -0
- package/dist/util/guards.js.map +1 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +5 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/nestjs.d.ts +9 -0
- package/dist/util/nestjs.js +9 -0
- package/dist/util/nestjs.js.map +1 -0
- package/dist/util/types.d.ts +4 -0
- package/dist/util/types.js +8 -0
- package/dist/util/types.js.map +1 -0
- package/dist/validator.d.ts +1 -0
- package/dist/validator.js +5 -0
- package/dist/validator.js.map +1 -0
- package/mondomob-gae-node-nestjs-12.0.0-alpha-3.tgz +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Configuration, Context, MailSender } from '..';
|
|
2
|
+
import { Options } from 'nodemailer/lib/mailer';
|
|
3
|
+
export declare const testConfiguration: (overrides?: Partial<Configuration>) => Configuration;
|
|
4
|
+
export declare const mockContext: () => Context<import("..").IUser>;
|
|
5
|
+
export declare class MockMailSender implements MailSender {
|
|
6
|
+
send(context: Context, mailOptions: Options): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const isMock: (obj: any) => boolean;
|
|
9
|
+
export declare const partialInstance: <T>(props?: Partial<T>) => T;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.partialInstance = exports.isMock = exports.MockMailSender = exports.mockContext = exports.testConfiguration = void 0;
|
|
4
|
+
const ts_mockito_1 = require("ts-mockito");
|
|
5
|
+
const loader_1 = require("../datastore/loader");
|
|
6
|
+
const testConfiguration = (overrides) => (Object.assign({ auth: {}, bucket: 'required but not important for test', environment: 'required but not important for test', gmailUser: 'required but not important for test', host: 'required but not important for test', location: 'required but not important for test', projectId: 'required but not important for test', systemSecret: Buffer.from([]), isDevelopment() {
|
|
7
|
+
return true;
|
|
8
|
+
} }, overrides));
|
|
9
|
+
exports.testConfiguration = testConfiguration;
|
|
10
|
+
const mockContext = () => {
|
|
11
|
+
const datastoreLoader = (0, ts_mockito_1.mock)(loader_1.DatastoreLoader);
|
|
12
|
+
const context = {
|
|
13
|
+
datastore: (0, ts_mockito_1.instance)(datastoreLoader),
|
|
14
|
+
};
|
|
15
|
+
(0, ts_mockito_1.when)(datastoreLoader.inTransaction((0, ts_mockito_1.anyFunction)())).thenCall((cb) => cb(context));
|
|
16
|
+
return context;
|
|
17
|
+
};
|
|
18
|
+
exports.mockContext = mockContext;
|
|
19
|
+
class MockMailSender {
|
|
20
|
+
async send(context, mailOptions) { }
|
|
21
|
+
}
|
|
22
|
+
exports.MockMailSender = MockMailSender;
|
|
23
|
+
const isMock = (obj) => '__tsmockitoMocker' in obj;
|
|
24
|
+
exports.isMock = isMock;
|
|
25
|
+
const partialInstance = (props = {}) => (Object.assign({}, props));
|
|
26
|
+
exports.partialInstance = partialInstance;
|
|
27
|
+
//# sourceMappingURL=mocks.js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,CAAC,kBAAK,KAAK,CAAQ,CAAA,CAAC;AAAxE,QAAA,eAAe,mBAAyD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.interceptorTest = void 0;
|
|
4
|
+
const ts_mockito_1 = require("ts-mockito");
|
|
5
|
+
const request_scope_middleware_1 = require("../request-scope/request-scope.middleware");
|
|
6
|
+
const mocks_1 = require("./mocks");
|
|
7
|
+
const configProvider = (0, mocks_1.partialInstance)({ requestScope: { enabled: true } });
|
|
8
|
+
const interceptorTest = (interceptor, req, testAssertions) => {
|
|
9
|
+
const request = (0, mocks_1.isMock)(req) ? (0, ts_mockito_1.instance)(req) : req;
|
|
10
|
+
let nextCalled = false;
|
|
11
|
+
new request_scope_middleware_1.RequestScopeMiddleware(configProvider, [interceptor]).use(request, (0, ts_mockito_1.instance)((0, ts_mockito_1.mock)()), () => {
|
|
12
|
+
nextCalled = true;
|
|
13
|
+
testAssertions();
|
|
14
|
+
});
|
|
15
|
+
expect(nextCalled).toBe(true);
|
|
16
|
+
};
|
|
17
|
+
exports.interceptorTest = interceptorTest;
|
|
18
|
+
//# sourceMappingURL=request-scope-test-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-scope-test-utils.js","sourceRoot":"","sources":["../../src/_test/request-scope-test-utils.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAE5C,wFAAmF;AACnF,mCAAkD;AAIlD,MAAM,cAAc,GAAG,IAAA,uBAAe,EAAgB,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AAEpF,MAAM,eAAe,GAAG,CAC7B,WAAoC,EACpC,GAAM,EACN,cAA0B,EAC1B,EAAE;IACF,MAAM,OAAO,GAAG,IAAA,cAAM,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAA,qBAAQ,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAClD,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,IAAI,iDAAsB,CAAC,cAAc,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,qBAAQ,EAAC,IAAA,iBAAI,GAAY,CAAC,EAAE,GAAG,EAAE;QACtG,UAAU,GAAG,IAAI,CAAC;QAClB,cAAc,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC,CAAC;AAZW,QAAA,eAAe,mBAY1B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthUser = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const graphql_1 = require("@nestjs/graphql");
|
|
6
|
+
let Credentials = class Credentials {
|
|
7
|
+
};
|
|
8
|
+
tslib_1.__decorate([
|
|
9
|
+
(0, graphql_1.Field)(),
|
|
10
|
+
tslib_1.__metadata("design:type", String)
|
|
11
|
+
], Credentials.prototype, "username", void 0);
|
|
12
|
+
tslib_1.__decorate([
|
|
13
|
+
(0, graphql_1.Field)(),
|
|
14
|
+
tslib_1.__metadata("design:type", String)
|
|
15
|
+
], Credentials.prototype, "type", void 0);
|
|
16
|
+
Credentials = tslib_1.__decorate([
|
|
17
|
+
(0, graphql_1.ObjectType)()
|
|
18
|
+
], Credentials);
|
|
19
|
+
let AuthUser = class AuthUser {
|
|
20
|
+
};
|
|
21
|
+
exports.AuthUser = AuthUser;
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, graphql_1.Field)(),
|
|
24
|
+
tslib_1.__metadata("design:type", Credentials)
|
|
25
|
+
], AuthUser.prototype, "credentials", void 0);
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
(0, graphql_1.Field)(() => [String]),
|
|
28
|
+
tslib_1.__metadata("design:type", Array)
|
|
29
|
+
], AuthUser.prototype, "roles", void 0);
|
|
30
|
+
exports.AuthUser = AuthUser = tslib_1.__decorate([
|
|
31
|
+
(0, graphql_1.ObjectType)()
|
|
32
|
+
], AuthUser);
|
|
33
|
+
//# sourceMappingURL=auth-user.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-user.model.js","sourceRoot":"","sources":["../../src/auth/auth-user.model.ts"],"names":[],"mappings":";;;;AAAA,6CAAoD;AAGpD,IAAM,WAAW,GAAjB,MAAM,WAAW;CAKhB,CAAA;AAHC;IADC,IAAA,eAAK,GAAE;;6CACS;AAEjB;IADC,IAAA,eAAK,GAAE;;yCACK;AAJT,WAAW;IADhB,IAAA,oBAAU,GAAE;GACP,WAAW,CAKhB;AAGM,IAAM,QAAQ,GAAd,MAAM,QAAQ;CAKpB,CAAA;AALY,4BAAQ;AAEnB;IADC,IAAA,eAAK,GAAE;sCACM,WAAW;6CAAC;AAE1B;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,CAAC,MAAO,CAAC,CAAC;;uCACE;mBAJd,QAAQ;IADpB,IAAA,oBAAU,GAAE;GACA,QAAQ,CAKpB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Request } from 'express';
|
|
2
|
+
export declare const AUTH_CALLBACKS = "AuthCallbacks";
|
|
3
|
+
export interface AuthCallbacks {
|
|
4
|
+
buildUserRolesList?(authType: string, profileData: any): string[];
|
|
5
|
+
buildUserPropertiesObject?(authType: string, profileData: any): any;
|
|
6
|
+
buildAuthenticationOptions?(authType: string, req: Request, defaultAuthenticateOptions: any): any;
|
|
7
|
+
getLoginIdentifier?(authType: string, authToken: any): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.callbacks.js","sourceRoot":"","sources":["../../src/auth/auth.callbacks.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Request } from 'express';
|
|
2
|
+
import { Profile } from 'passport-auth0';
|
|
3
|
+
import { IVerifyOptions } from 'passport-local';
|
|
4
|
+
import { Configuration } from '../configuration';
|
|
5
|
+
import { IUser } from '../datastore/context';
|
|
6
|
+
import { DatastoreProvider } from '../datastore/datastore.provider';
|
|
7
|
+
import { AuthCallbacks } from './auth.callbacks';
|
|
8
|
+
import { AuthService } from './auth.service';
|
|
9
|
+
export declare class AuthConfigurer {
|
|
10
|
+
private readonly configuration;
|
|
11
|
+
private readonly authService;
|
|
12
|
+
private readonly authCallbacks;
|
|
13
|
+
private readonly datastore;
|
|
14
|
+
private readonly logger;
|
|
15
|
+
constructor(datastoreProvider: DatastoreProvider, configuration: Configuration, authService: AuthService, authCallbacks: AuthCallbacks);
|
|
16
|
+
private init;
|
|
17
|
+
beginAuthenticateGoogle(): any;
|
|
18
|
+
completeAuthenticateGoogle(): any;
|
|
19
|
+
beginAuthenticateSaml(): any;
|
|
20
|
+
completeAuthenticateSaml(): any;
|
|
21
|
+
beginAuthenticateOidc(): any;
|
|
22
|
+
completeAuthenticateOidc(): any;
|
|
23
|
+
beginAuthenticateAuth0(req: Request): any;
|
|
24
|
+
completeAuthenticateAuth0(req: Request): any;
|
|
25
|
+
getSignoutUrlAuth0(): string;
|
|
26
|
+
authenticateLocal(): any;
|
|
27
|
+
authenticateFake(): any;
|
|
28
|
+
validate: (username: string, password: string, done: (error: Error | null, user: IUser | false) => void) => Promise<void>;
|
|
29
|
+
validateFakeLogin: (req: Request, username: string, password: string, done: (error: Error | null, user: IUser | false) => void) => Promise<void>;
|
|
30
|
+
validateGmail: (accessToken: string, refreshToken: string, profile: object, done: (error: Error | null, user: IUser | false) => void) => Promise<void>;
|
|
31
|
+
validateSaml: (profile: any, done: any) => Promise<void>;
|
|
32
|
+
validateOidc: (_issuer: any, _sub: any, profile: any, _accessToken: any, _refreshToken: any, done: (error: Error | null, user: IUser | false) => void) => Promise<void>;
|
|
33
|
+
validateAuth0: (accessToken: string, refreshToken: string, extraParams: any, profile: Profile, done: (error: Error | null, user: IUser | false) => void) => Promise<void>;
|
|
34
|
+
validateAuth: (done: (error: Error | null, user: IUser | false, options?: IVerifyOptions) => void, auth: () => Promise<IUser>) => Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthConfigurer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
const passport_saml_1 = require("@node-saml/passport-saml");
|
|
7
|
+
const jsonwebtoken_1 = require("jsonwebtoken");
|
|
8
|
+
const lodash_1 = require("lodash");
|
|
9
|
+
const passport = require("passport");
|
|
10
|
+
const passport_auth0_1 = require("passport-auth0");
|
|
11
|
+
const passport_google_oauth20_1 = require("passport-google-oauth20");
|
|
12
|
+
const passport_local_1 = require("passport-local");
|
|
13
|
+
const passport_openidconnect_1 = require("passport-openidconnect");
|
|
14
|
+
const context_1 = require("../datastore/context");
|
|
15
|
+
const datastore_provider_1 = require("../datastore/datastore.provider");
|
|
16
|
+
const logging_1 = require("../logging");
|
|
17
|
+
const auth_callbacks_1 = require("./auth.callbacks");
|
|
18
|
+
const auth_service_1 = require("./auth.service");
|
|
19
|
+
const user_service_1 = require("./user.service");
|
|
20
|
+
const GOOGLE_SIGNIN = 'google';
|
|
21
|
+
const SAML_SIGNIN = 'saml';
|
|
22
|
+
const AUTH0_SIGNIN = 'auth0';
|
|
23
|
+
const OIDC_SIGNIN = 'oidc';
|
|
24
|
+
const LOCAL_SIGNIN = 'local-signin';
|
|
25
|
+
const FAKE_SIGNIN = 'fake-signin';
|
|
26
|
+
const DEFAULT_FAILURE_REDIRECT = '/';
|
|
27
|
+
let AuthConfigurer = class AuthConfigurer {
|
|
28
|
+
constructor(datastoreProvider, configuration, authService, authCallbacks) {
|
|
29
|
+
this.configuration = configuration;
|
|
30
|
+
this.authService = authService;
|
|
31
|
+
this.authCallbacks = authCallbacks;
|
|
32
|
+
this.validate = async (username, password, done) => this.validateAuth(done, () => this.authService.validateUser((0, context_1.newContext)(this.datastore), username, password));
|
|
33
|
+
this.validateFakeLogin = async (req, username, password, done) => this.validateAuth(done, () => this.authService.validateFakeLogin((0, context_1.newContext)(this.datastore), req.headers['x-fake-secret'], username, (0, lodash_1.get)(req, 'body.name', ''), (0, lodash_1.get)(req, 'body.roles', []), (0, lodash_1.get)(req, 'body.orgId', ''), (0, lodash_1.get)(req, 'body.props', {})));
|
|
34
|
+
this.validateGmail = async (accessToken, refreshToken, profile, done) => this.validateAuth(done, () => this.authService.validateUserGoogle((0, context_1.newContext)(this.datastore), profile));
|
|
35
|
+
this.validateSaml = (profile, done) => this.validateAuth(done, () => this.authService.validateUserSaml((0, context_1.newContext)(this.datastore), profile));
|
|
36
|
+
this.validateOidc = (_issuer, _sub, profile, _accessToken, _refreshToken, done) => this.validateAuth(done, () => this.authService.validateUserOidc((0, context_1.newContext)(this.datastore), profile, !!this.configuration.auth.oidc.replaceAuth, this.configuration.auth.oidc.newUserRoles));
|
|
37
|
+
this.validateAuth0 = (accessToken, refreshToken, extraParams, profile, done) => this.validateAuth(done, () => {
|
|
38
|
+
const decoded = (0, jsonwebtoken_1.decode)(extraParams.id_token);
|
|
39
|
+
const { email, name } = decoded;
|
|
40
|
+
const normalisedEmail = (0, user_service_1.normaliseEmail)(email);
|
|
41
|
+
const namespace = this.configuration.auth.auth0.namespace;
|
|
42
|
+
const roles = decoded[`${namespace}roles`];
|
|
43
|
+
const orgId = decoded[`${namespace}orgId`];
|
|
44
|
+
let id = normalisedEmail;
|
|
45
|
+
if (this.authCallbacks && this.authCallbacks.getLoginIdentifier) {
|
|
46
|
+
id = this.authCallbacks.getLoginIdentifier(AUTH0_SIGNIN, decoded);
|
|
47
|
+
}
|
|
48
|
+
let props = decoded[`${namespace}props`];
|
|
49
|
+
if (this.authCallbacks && this.authCallbacks.buildUserPropertiesObject) {
|
|
50
|
+
props = this.authCallbacks.buildUserPropertiesObject(AUTH0_SIGNIN, decoded);
|
|
51
|
+
}
|
|
52
|
+
if (!roles || !roles.length) {
|
|
53
|
+
this.logger.warn(`No roles were provided by auth0 for ${normalisedEmail}`);
|
|
54
|
+
}
|
|
55
|
+
return this.authService.validateUserAuth0((0, context_1.newContext)(this.datastore), id, normalisedEmail, name, orgId, roles, props);
|
|
56
|
+
});
|
|
57
|
+
this.validateAuth = async (done, auth) => {
|
|
58
|
+
try {
|
|
59
|
+
const user = await auth();
|
|
60
|
+
if (!user) {
|
|
61
|
+
return done(null, false, new common_1.UnauthorizedException());
|
|
62
|
+
}
|
|
63
|
+
done(null, user);
|
|
64
|
+
}
|
|
65
|
+
catch (ex) {
|
|
66
|
+
this.logger.error(ex);
|
|
67
|
+
if (ex instanceof auth_service_1.AuthenticationFailedException) {
|
|
68
|
+
done(null, false, ex);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
done(new common_1.UnauthorizedException(ex, 'Internal error'), false);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
this.datastore = datastoreProvider.datastore;
|
|
76
|
+
this.logger = (0, logging_1.createLogger)('auth');
|
|
77
|
+
this.init();
|
|
78
|
+
}
|
|
79
|
+
init() {
|
|
80
|
+
passport.serializeUser((user, done) => {
|
|
81
|
+
done(null, { id: user.id });
|
|
82
|
+
});
|
|
83
|
+
passport.deserializeUser(async (user, done) => {
|
|
84
|
+
done(null, { id: user.id });
|
|
85
|
+
});
|
|
86
|
+
if (this.configuration.auth.local && this.configuration.auth.local.enabled) {
|
|
87
|
+
passport.use(LOCAL_SIGNIN, new passport_local_1.Strategy({}, this.validate));
|
|
88
|
+
}
|
|
89
|
+
if (this.configuration.auth.fake && this.configuration.auth.fake.enabled) {
|
|
90
|
+
if (!this.configuration.isDevelopment()) {
|
|
91
|
+
if (!this.configuration.auth.fake.secret) {
|
|
92
|
+
throw new Error('Fake login must have secret configured in non-development environments');
|
|
93
|
+
}
|
|
94
|
+
this.logger.warn('Fake login is enabled');
|
|
95
|
+
}
|
|
96
|
+
passport.use(FAKE_SIGNIN, new passport_local_1.Strategy({ passReqToCallback: true }, this.validateFakeLogin));
|
|
97
|
+
}
|
|
98
|
+
if (this.configuration.auth.google && this.configuration.auth.google.enabled) {
|
|
99
|
+
passport.use(new passport_google_oauth20_1.Strategy({
|
|
100
|
+
clientID: this.configuration.auth.google.clientId,
|
|
101
|
+
clientSecret: this.configuration.auth.google.secret,
|
|
102
|
+
callbackURL: `${this.configuration.host}/auth/signin/google/callback`,
|
|
103
|
+
userProfileURL: 'https://www.googleapis.com/oauth2/v3/userinfo',
|
|
104
|
+
}, this.validateGmail));
|
|
105
|
+
}
|
|
106
|
+
if (this.configuration.auth.saml && this.configuration.auth.saml.enabled) {
|
|
107
|
+
passport.use(SAML_SIGNIN, new passport_saml_1.Strategy({
|
|
108
|
+
entryPoint: this.configuration.auth.saml.identityProviderUrl,
|
|
109
|
+
callbackUrl: `${this.configuration.host}/auth/signin/saml/acs`,
|
|
110
|
+
issuer: this.configuration.host,
|
|
111
|
+
audience: this.configuration.host,
|
|
112
|
+
acceptedClockSkewMs: 5000,
|
|
113
|
+
idpCert: this.configuration.auth.saml.cert,
|
|
114
|
+
wantAuthnResponseSigned: false,
|
|
115
|
+
}, this.validateSaml, () => undefined));
|
|
116
|
+
}
|
|
117
|
+
if (this.configuration.auth.auth0 && this.configuration.auth.auth0.enabled) {
|
|
118
|
+
passport.use(AUTH0_SIGNIN, new passport_auth0_1.Strategy({
|
|
119
|
+
domain: this.configuration.auth.auth0.domain,
|
|
120
|
+
clientID: this.configuration.auth.auth0.clientId,
|
|
121
|
+
clientSecret: this.configuration.auth.auth0.secret,
|
|
122
|
+
callbackURL: `${this.configuration.host}/auth/signin/auth0/callback`,
|
|
123
|
+
}, this.validateAuth0));
|
|
124
|
+
}
|
|
125
|
+
if (this.configuration.auth.oidc && this.configuration.auth.oidc.enabled) {
|
|
126
|
+
const { authUrl, clientId, enabled, issuer, secret, tokenUrl, userInfoUrl } = this.configuration.auth.oidc;
|
|
127
|
+
passport.use(OIDC_SIGNIN, new passport_openidconnect_1.Strategy({
|
|
128
|
+
issuer,
|
|
129
|
+
authorizationURL: authUrl,
|
|
130
|
+
tokenURL: tokenUrl,
|
|
131
|
+
userInfoURL: userInfoUrl,
|
|
132
|
+
clientID: clientId,
|
|
133
|
+
clientSecret: secret,
|
|
134
|
+
callbackURL: `${this.configuration.host}/auth/signin/oidc/callback`,
|
|
135
|
+
scope: 'profile email',
|
|
136
|
+
}, this.validateOidc));
|
|
137
|
+
this.logger.info(`Configured ${OIDC_SIGNIN} authentication strategy`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
beginAuthenticateGoogle() {
|
|
141
|
+
const options = {
|
|
142
|
+
scope: ['profile', 'email'],
|
|
143
|
+
};
|
|
144
|
+
return passport.authenticate(GOOGLE_SIGNIN, options);
|
|
145
|
+
}
|
|
146
|
+
completeAuthenticateGoogle() {
|
|
147
|
+
return passport.authenticate(GOOGLE_SIGNIN, {
|
|
148
|
+
failureRedirect: this.configuration.auth.google.failureRedirect || DEFAULT_FAILURE_REDIRECT,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
beginAuthenticateSaml() {
|
|
152
|
+
return passport.authenticate(SAML_SIGNIN, {
|
|
153
|
+
failureRedirect: this.configuration.auth.saml.failureRedirect || DEFAULT_FAILURE_REDIRECT,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
completeAuthenticateSaml() {
|
|
157
|
+
return passport.authenticate(SAML_SIGNIN, {
|
|
158
|
+
failureRedirect: this.configuration.auth.saml.failureRedirect || DEFAULT_FAILURE_REDIRECT,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
beginAuthenticateOidc() {
|
|
162
|
+
return passport.authenticate(OIDC_SIGNIN, {
|
|
163
|
+
scope: ['openid', 'profile', 'email'],
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
completeAuthenticateOidc() {
|
|
167
|
+
return passport.authenticate(OIDC_SIGNIN, {
|
|
168
|
+
failureRedirect: this.configuration.auth.oidc.failureRedirect || DEFAULT_FAILURE_REDIRECT,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
beginAuthenticateAuth0(req) {
|
|
172
|
+
const defaultOptions = {
|
|
173
|
+
scope: ['openid', 'email', 'profile'],
|
|
174
|
+
};
|
|
175
|
+
let options;
|
|
176
|
+
if (this.authCallbacks && this.authCallbacks.buildAuthenticationOptions) {
|
|
177
|
+
options = this.authCallbacks.buildAuthenticationOptions(AUTH0_SIGNIN, req, defaultOptions);
|
|
178
|
+
}
|
|
179
|
+
return passport.authenticate(AUTH0_SIGNIN, options || defaultOptions);
|
|
180
|
+
}
|
|
181
|
+
completeAuthenticateAuth0(req) {
|
|
182
|
+
const defaultOptions = {
|
|
183
|
+
failureRedirect: this.configuration.auth.auth0.failureRedirect || DEFAULT_FAILURE_REDIRECT,
|
|
184
|
+
};
|
|
185
|
+
let options;
|
|
186
|
+
if (this.authCallbacks && this.authCallbacks.buildAuthenticationOptions) {
|
|
187
|
+
options = this.authCallbacks.buildAuthenticationOptions(AUTH0_SIGNIN, req, defaultOptions);
|
|
188
|
+
}
|
|
189
|
+
return passport.authenticate(AUTH0_SIGNIN, options || defaultOptions);
|
|
190
|
+
}
|
|
191
|
+
getSignoutUrlAuth0() {
|
|
192
|
+
const clientId = this.configuration.auth.auth0.clientId;
|
|
193
|
+
const domain = this.configuration.auth.auth0.domain;
|
|
194
|
+
const host = this.configuration.host;
|
|
195
|
+
return `https://${domain}/v2/logout?client_id=${clientId}&returnTo=${host}`;
|
|
196
|
+
}
|
|
197
|
+
authenticateLocal() {
|
|
198
|
+
return passport.authenticate(LOCAL_SIGNIN, {});
|
|
199
|
+
}
|
|
200
|
+
authenticateFake() {
|
|
201
|
+
return passport.authenticate(FAKE_SIGNIN, {});
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
exports.AuthConfigurer = AuthConfigurer;
|
|
205
|
+
exports.AuthConfigurer = AuthConfigurer = tslib_1.__decorate([
|
|
206
|
+
(0, common_1.Injectable)(),
|
|
207
|
+
tslib_1.__param(1, (0, common_1.Inject)('Configuration')),
|
|
208
|
+
tslib_1.__param(3, (0, common_1.Optional)()),
|
|
209
|
+
tslib_1.__param(3, (0, common_1.Inject)(auth_callbacks_1.AUTH_CALLBACKS)),
|
|
210
|
+
tslib_1.__metadata("design:paramtypes", [datastore_provider_1.DatastoreProvider, Object, auth_service_1.AuthService, Object])
|
|
211
|
+
], AuthConfigurer);
|
|
212
|
+
//# sourceMappingURL=auth.configurer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.configurer.js","sourceRoot":"","sources":["../../src/auth/auth.configurer.ts"],"names":[],"mappings":";;;;AACA,2CAAqF;AACrF,4DAAoE;AAEpE,+CAAsC;AACtC,mCAA6B;AAC7B,qCAAqC;AACrC,mDAAoE;AACpE,qEAAqE;AACrE,mDAA2E;AAC3E,mEAAkE;AAElE,kDAAyD;AACzD,wEAAoE;AACpE,wCAAkD;AAClD,qDAAiE;AACjE,iDAA4E;AAC5E,iDAAgD;AAEhD,MAAM,aAAa,GAAG,QAAQ,CAAC;AAC/B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,YAAY,GAAG,OAAO,CAAC;AAC7B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,WAAW,GAAG,aAAa,CAAC;AAElC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAG9B,IAAM,cAAc,GAApB,MAAM,cAAc;IAIzB,YACE,iBAAoC,EACX,aAA6C,EACrD,WAAwB,EACL,aAA6C;QAFvC,kBAAa,GAAb,aAAa,CAAe;QACrD,gBAA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Y,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,gBAAgB;QACd,OAAO,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC;CA6GF,CAAA;AAjSY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAOR,mBAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;IAEvB,mBAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,mBAAA,IAAA,eAAM,EAAC,+BAAc,CAAC,CAAA;6CAHhB,sCAAiB,UAEN,0BAAW;GAPhC,cAAc,CAiS1B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import { Configuration, Context, InviteUserService } from '..';
|
|
3
|
+
import { AuthConfigurer } from './auth.configurer';
|
|
4
|
+
import { AuthListener } from './auth.listener';
|
|
5
|
+
export declare class AuthController {
|
|
6
|
+
private readonly authConfigurer;
|
|
7
|
+
private readonly inviteUserService;
|
|
8
|
+
private readonly configuration;
|
|
9
|
+
private readonly authListener;
|
|
10
|
+
private logger;
|
|
11
|
+
constructor(authConfigurer: AuthConfigurer, inviteUserService: InviteUserService, configuration: Configuration, authListener: AuthListener);
|
|
12
|
+
signIn(req: Request, res: Response, next: (err: Error) => void): void;
|
|
13
|
+
signInFake(req: Request, res: Response, next: (err: Error) => void): void;
|
|
14
|
+
activate(req: Request, res: Response, next: (err: Error) => void, context: Context): Promise<void>;
|
|
15
|
+
reInviteUser(req: Request, res: Response, next: (err: Error) => void, context: Context): Promise<void>;
|
|
16
|
+
signOutLocal(req: Request, res: Response, next: (err: Error) => void): void;
|
|
17
|
+
signOut(req: Request, res: Response, next: (err: Error) => void): void;
|
|
18
|
+
signInGoogle(req: Request, res: Response, next: () => void): void;
|
|
19
|
+
completeSignInGoogle(req: Request, res: Response): void;
|
|
20
|
+
signInSaml(req: Request, res: Response, next: () => void): void;
|
|
21
|
+
completeSignInSaml(req: Request, res: Response): void;
|
|
22
|
+
signInAuth0(req: Request, res: Response, next: () => void): void;
|
|
23
|
+
signOutAuth0(req: Request, res: Response): void;
|
|
24
|
+
completeSignInAuth0(req: Request, res: Response): void;
|
|
25
|
+
signInOidc(req: Request, res: Response, next: () => void): void;
|
|
26
|
+
completeSignInOidc(req: Request, res: Response): void;
|
|
27
|
+
}
|