@breadstone/archipel-platform-authentication 0.0.6 → 0.0.8
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/package.json +3 -2
- package/src/AuthModule.js +7 -6
- package/src/apple/env.js +6 -0
- package/src/env.d.ts +8 -0
- package/src/env.js +9 -1
- package/src/github/env.js +6 -0
- package/src/google/env.js +6 -0
- package/src/microsoft/env.js +6 -0
- package/src/services/MfaService.d.ts +1 -1
- package/src/services/MfaService.js +2 -2
- package/src/services/mfa/channels/EmailOtpMfaChannel.d.ts +2 -1
- package/src/services/mfa/channels/EmailOtpMfaChannel.js +2 -1
- package/src/services/mfa/channels/PushMfaChannel.d.ts +2 -1
- package/src/services/mfa/channels/PushMfaChannel.js +2 -1
- package/src/services/mfa/channels/SmsMfaChannel.d.ts +2 -1
- package/src/services/mfa/channels/SmsMfaChannel.js +2 -1
- package/src/services/mfa/channels/TotpMfaChannel.d.ts +2 -1
- package/src/services/mfa/channels/TotpMfaChannel.js +2 -1
- package/src/strategies/AppleStrategy.js +6 -1
- package/src/strategies/GithubStrategy.js +6 -0
- package/src/strategies/GoogleStrategy.js +6 -1
- package/src/strategies/LocalStrategy.d.ts +1 -1
- package/src/strategies/LocalStrategy.js +2 -2
- package/src/strategies/MicrosoftStrategy.js +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@breadstone/archipel-platform-authentication",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "JWT and OAuth authentication, MFA, session management, and email verification for NestJS applications.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
"README.md"
|
|
74
74
|
],
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@breadstone/archipel-platform-core": "0.0.
|
|
76
|
+
"@breadstone/archipel-platform-core": "0.0.8",
|
|
77
|
+
"@breadstone/archipel-platform-cryptography": "0.0.8",
|
|
77
78
|
"passport": "0.7.0",
|
|
78
79
|
"passport-custom": "1.1.1",
|
|
79
80
|
"passport-jwt": "4.0.1",
|
package/src/AuthModule.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.AuthModule = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
|
|
8
|
+
const archipel_platform_cryptography_1 = require("@breadstone/archipel-platform-cryptography");
|
|
8
9
|
const common_1 = require("@nestjs/common");
|
|
9
10
|
const jwt_1 = require("@nestjs/jwt");
|
|
10
11
|
const passport_1 = require("@nestjs/passport");
|
|
@@ -112,8 +113,8 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
112
113
|
PushMfaChannel_1.PushMfaChannel,
|
|
113
114
|
MfaEncryptionService_1.MfaEncryptionService,
|
|
114
115
|
{
|
|
115
|
-
provide:
|
|
116
|
-
useClass:
|
|
116
|
+
provide: archipel_platform_cryptography_1.OTP_SERVICE_TOKEN,
|
|
117
|
+
useClass: archipel_platform_cryptography_1.OtpService,
|
|
117
118
|
},
|
|
118
119
|
{
|
|
119
120
|
provide: MfaTokens_1.MFA_CHANNELS,
|
|
@@ -122,8 +123,8 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
122
123
|
},
|
|
123
124
|
archipel_platform_core_1.DeviceParserService,
|
|
124
125
|
middlewares_1.LastActiveMiddleware,
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
archipel_platform_cryptography_1.BcryptService,
|
|
127
|
+
archipel_platform_cryptography_1.CryptoService,
|
|
127
128
|
],
|
|
128
129
|
exports: [
|
|
129
130
|
AuthTokenService_1.AuthTokenService,
|
|
@@ -136,8 +137,8 @@ let AuthModule = AuthModule_1 = class AuthModule {
|
|
|
136
137
|
AnonymousAuthGuard_1.AnonymousAuthGuard,
|
|
137
138
|
GithubAuthGuard_1.GithubAuthGuard,
|
|
138
139
|
RolesGuard_1.RolesGuard,
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
archipel_platform_cryptography_1.BcryptService,
|
|
141
|
+
archipel_platform_cryptography_1.CryptoService,
|
|
141
142
|
],
|
|
142
143
|
};
|
|
143
144
|
}
|
package/src/apple/env.js
CHANGED
|
@@ -16,5 +16,11 @@ exports.APPLE_AUTH_CONFIG_ENTRIES = [
|
|
|
16
16
|
defaultValue: '/auth/apple/callback',
|
|
17
17
|
description: 'Apple Sign-In callback URL.',
|
|
18
18
|
},
|
|
19
|
+
{
|
|
20
|
+
key: env_1.AUTH_APPLE_SCOPE,
|
|
21
|
+
required: false,
|
|
22
|
+
defaultValue: 'name,email',
|
|
23
|
+
description: 'Comma-separated list of Apple Sign-In scopes.',
|
|
24
|
+
},
|
|
19
25
|
];
|
|
20
26
|
//# sourceMappingURL=env.js.map
|
package/src/env.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export declare const AUTH_GOOGLE_CLIENT_ID: import("@breadstone/archipel-platfor
|
|
|
29
29
|
export declare const AUTH_GOOGLE_CLIENT_SECRET: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
30
30
|
/** Google OAuth2 callback URL. */
|
|
31
31
|
export declare const AUTH_GOOGLE_CALLBACK_URL: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
32
|
+
/** Comma-separated list of Google OAuth scopes (e.g. `'email,profile'`). */
|
|
33
|
+
export declare const AUTH_GOOGLE_SCOPE: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
32
34
|
/** Microsoft OAuth2 client ID. */
|
|
33
35
|
export declare const AUTH_MICROSOFT_CLIENT_ID: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
34
36
|
/** Microsoft OAuth2 client secret. */
|
|
@@ -37,6 +39,8 @@ export declare const AUTH_MICROSOFT_CLIENT_SECRET: import("@breadstone/archipel-
|
|
|
37
39
|
export declare const AUTH_MICROSOFT_CALLBACK_URL: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
38
40
|
/** Microsoft tenant ID or `'common'` for multi-tenant. */
|
|
39
41
|
export declare const AUTH_MICROSOFT_TENANT: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
42
|
+
/** Comma-separated list of Microsoft OAuth scopes (e.g. `'user.read,mail.read'`). */
|
|
43
|
+
export declare const AUTH_MICROSOFT_SCOPE: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
40
44
|
/** Apple Sign-In private key (PEM string). */
|
|
41
45
|
export declare const AUTH_APPLE_PRIVATE_KEY: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
42
46
|
/** Apple Sign-In client (service) ID. */
|
|
@@ -47,12 +51,16 @@ export declare const AUTH_APPLE_TEAM_ID: import("@breadstone/archipel-platform-c
|
|
|
47
51
|
export declare const AUTH_APPLE_KEY_ID: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
48
52
|
/** Apple Sign-In callback URL. */
|
|
49
53
|
export declare const AUTH_APPLE_CALLBACK_URL: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
54
|
+
/** Comma-separated list of Apple Sign-In scopes (e.g. `'name,email'`). */
|
|
55
|
+
export declare const AUTH_APPLE_SCOPE: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
50
56
|
/** GitHub OAuth client ID. */
|
|
51
57
|
export declare const AUTH_GITHUB_CLIENT_ID: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
52
58
|
/** GitHub OAuth client secret. */
|
|
53
59
|
export declare const AUTH_GITHUB_CLIENT_SECRET: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
54
60
|
/** GitHub OAuth callback URL. */
|
|
55
61
|
export declare const AUTH_GITHUB_CALLBACK_URL: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
62
|
+
/** Comma-separated list of GitHub OAuth scopes (e.g. `'user:email,read:user'`). */
|
|
63
|
+
export declare const AUTH_GITHUB_SCOPE: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
56
64
|
/** Username used for the anonymous seed user. */
|
|
57
65
|
export declare const SEED_ANONYMOUS_USERNAME: import("@breadstone/archipel-platform-core").IConfigKey<string>;
|
|
58
66
|
/** Core configuration entries required by `platform-authentication`. */
|
package/src/env.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// #region Imports
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = exports.SEED_ANONYMOUS_USERNAME = exports.AUTH_GITHUB_CALLBACK_URL = exports.AUTH_GITHUB_CLIENT_SECRET = exports.AUTH_GITHUB_CLIENT_ID = exports.AUTH_APPLE_CALLBACK_URL = exports.AUTH_APPLE_KEY_ID = exports.AUTH_APPLE_TEAM_ID = exports.AUTH_APPLE_CLIENT_ID = exports.AUTH_APPLE_PRIVATE_KEY = exports.AUTH_MICROSOFT_TENANT = exports.AUTH_MICROSOFT_CALLBACK_URL = exports.AUTH_MICROSOFT_CLIENT_SECRET = exports.AUTH_MICROSOFT_CLIENT_ID = exports.AUTH_GOOGLE_CALLBACK_URL = exports.AUTH_GOOGLE_CLIENT_SECRET = exports.AUTH_GOOGLE_CLIENT_ID = exports.AUTH_MFA_PUSH_MIN_RESEND = exports.AUTH_MFA_PUSH_CODE_TTL = exports.AUTH_MFA_EMAIL_MIN_RESEND = exports.AUTH_MFA_EMAIL_CODE_TTL = exports.AUTH_MFA_SMS_MIN_RESEND = exports.AUTH_MFA_SMS_CODE_TTL = exports.AUTH_MFA_MAX_ATTEMPTS = exports.AUTH_MFA_CHALLENGE_EXPIRES_IN = exports.AUTH_MFA_ENCRYPTION_KEY = exports.AUTH_VERIFY_JWT_EXPIRES_IN = exports.AUTH_JWT_EXPIRES_IN = exports.AUTH_JWT_SECRET = void 0;
|
|
4
|
+
exports.PLATFORM_AUTHENTICATION_CONFIG_ENTRIES = exports.SEED_ANONYMOUS_USERNAME = exports.AUTH_GITHUB_SCOPE = exports.AUTH_GITHUB_CALLBACK_URL = exports.AUTH_GITHUB_CLIENT_SECRET = exports.AUTH_GITHUB_CLIENT_ID = exports.AUTH_APPLE_SCOPE = exports.AUTH_APPLE_CALLBACK_URL = exports.AUTH_APPLE_KEY_ID = exports.AUTH_APPLE_TEAM_ID = exports.AUTH_APPLE_CLIENT_ID = exports.AUTH_APPLE_PRIVATE_KEY = exports.AUTH_MICROSOFT_SCOPE = exports.AUTH_MICROSOFT_TENANT = exports.AUTH_MICROSOFT_CALLBACK_URL = exports.AUTH_MICROSOFT_CLIENT_SECRET = exports.AUTH_MICROSOFT_CLIENT_ID = exports.AUTH_GOOGLE_SCOPE = exports.AUTH_GOOGLE_CALLBACK_URL = exports.AUTH_GOOGLE_CLIENT_SECRET = exports.AUTH_GOOGLE_CLIENT_ID = exports.AUTH_MFA_PUSH_MIN_RESEND = exports.AUTH_MFA_PUSH_CODE_TTL = exports.AUTH_MFA_EMAIL_MIN_RESEND = exports.AUTH_MFA_EMAIL_CODE_TTL = exports.AUTH_MFA_SMS_MIN_RESEND = exports.AUTH_MFA_SMS_CODE_TTL = exports.AUTH_MFA_MAX_ATTEMPTS = exports.AUTH_MFA_CHALLENGE_EXPIRES_IN = exports.AUTH_MFA_ENCRYPTION_KEY = exports.AUTH_VERIFY_JWT_EXPIRES_IN = exports.AUTH_JWT_EXPIRES_IN = exports.AUTH_JWT_SECRET = void 0;
|
|
5
5
|
const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
|
|
6
6
|
// #endregion
|
|
7
7
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -52,6 +52,8 @@ exports.AUTH_GOOGLE_CLIENT_ID = (0, archipel_platform_core_1.createConfigKey)('A
|
|
|
52
52
|
exports.AUTH_GOOGLE_CLIENT_SECRET = (0, archipel_platform_core_1.createConfigKey)('AUTH_GOOGLE_CLIENT_SECRET');
|
|
53
53
|
/** Google OAuth2 callback URL. */
|
|
54
54
|
exports.AUTH_GOOGLE_CALLBACK_URL = (0, archipel_platform_core_1.createConfigKey)('AUTH_GOOGLE_CALLBACK_URL');
|
|
55
|
+
/** Comma-separated list of Google OAuth scopes (e.g. `'email,profile'`). */
|
|
56
|
+
exports.AUTH_GOOGLE_SCOPE = (0, archipel_platform_core_1.createConfigKey)('AUTH_GOOGLE_SCOPE');
|
|
55
57
|
// ──────────────────────────────────────────────────────────────
|
|
56
58
|
// OAuth — Microsoft
|
|
57
59
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -63,6 +65,8 @@ exports.AUTH_MICROSOFT_CLIENT_SECRET = (0, archipel_platform_core_1.createConfig
|
|
|
63
65
|
exports.AUTH_MICROSOFT_CALLBACK_URL = (0, archipel_platform_core_1.createConfigKey)('AUTH_MICROSOFT_CALLBACK_URL');
|
|
64
66
|
/** Microsoft tenant ID or `'common'` for multi-tenant. */
|
|
65
67
|
exports.AUTH_MICROSOFT_TENANT = (0, archipel_platform_core_1.createConfigKey)('AUTH_MICROSOFT_TENANT');
|
|
68
|
+
/** Comma-separated list of Microsoft OAuth scopes (e.g. `'user.read,mail.read'`). */
|
|
69
|
+
exports.AUTH_MICROSOFT_SCOPE = (0, archipel_platform_core_1.createConfigKey)('AUTH_MICROSOFT_SCOPE');
|
|
66
70
|
// ──────────────────────────────────────────────────────────────
|
|
67
71
|
// OAuth — Apple
|
|
68
72
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -76,6 +80,8 @@ exports.AUTH_APPLE_TEAM_ID = (0, archipel_platform_core_1.createConfigKey)('AUTH
|
|
|
76
80
|
exports.AUTH_APPLE_KEY_ID = (0, archipel_platform_core_1.createConfigKey)('AUTH_APPLE_KEY_ID');
|
|
77
81
|
/** Apple Sign-In callback URL. */
|
|
78
82
|
exports.AUTH_APPLE_CALLBACK_URL = (0, archipel_platform_core_1.createConfigKey)('AUTH_APPLE_CALLBACK_URL');
|
|
83
|
+
/** Comma-separated list of Apple Sign-In scopes (e.g. `'name,email'`). */
|
|
84
|
+
exports.AUTH_APPLE_SCOPE = (0, archipel_platform_core_1.createConfigKey)('AUTH_APPLE_SCOPE');
|
|
79
85
|
// ──────────────────────────────────────────────────────────────
|
|
80
86
|
// OAuth — GitHub
|
|
81
87
|
// ──────────────────────────────────────────────────────────────
|
|
@@ -85,6 +91,8 @@ exports.AUTH_GITHUB_CLIENT_ID = (0, archipel_platform_core_1.createConfigKey)('A
|
|
|
85
91
|
exports.AUTH_GITHUB_CLIENT_SECRET = (0, archipel_platform_core_1.createConfigKey)('AUTH_GITHUB_CLIENT_SECRET');
|
|
86
92
|
/** GitHub OAuth callback URL. */
|
|
87
93
|
exports.AUTH_GITHUB_CALLBACK_URL = (0, archipel_platform_core_1.createConfigKey)('AUTH_GITHUB_CALLBACK_URL');
|
|
94
|
+
/** Comma-separated list of GitHub OAuth scopes (e.g. `'user:email,read:user'`). */
|
|
95
|
+
exports.AUTH_GITHUB_SCOPE = (0, archipel_platform_core_1.createConfigKey)('AUTH_GITHUB_SCOPE');
|
|
88
96
|
// ──────────────────────────────────────────────────────────────
|
|
89
97
|
// Seed / Misc
|
|
90
98
|
// ──────────────────────────────────────────────────────────────
|
package/src/github/env.js
CHANGED
|
@@ -14,5 +14,11 @@ exports.GITHUB_AUTH_CONFIG_ENTRIES = [
|
|
|
14
14
|
defaultValue: '/auth/github/callback',
|
|
15
15
|
description: 'GitHub OAuth callback URL.',
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
key: env_1.AUTH_GITHUB_SCOPE,
|
|
19
|
+
required: false,
|
|
20
|
+
defaultValue: 'user:email',
|
|
21
|
+
description: 'Comma-separated list of GitHub OAuth scopes.',
|
|
22
|
+
},
|
|
17
23
|
];
|
|
18
24
|
//# sourceMappingURL=env.js.map
|
package/src/google/env.js
CHANGED
|
@@ -14,5 +14,11 @@ exports.GOOGLE_AUTH_CONFIG_ENTRIES = [
|
|
|
14
14
|
defaultValue: '/auth/google/callback',
|
|
15
15
|
description: 'Google OAuth2 callback URL.',
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
key: env_1.AUTH_GOOGLE_SCOPE,
|
|
19
|
+
required: false,
|
|
20
|
+
defaultValue: 'email,profile',
|
|
21
|
+
description: 'Comma-separated list of Google OAuth scopes.',
|
|
22
|
+
},
|
|
17
23
|
];
|
|
18
24
|
//# sourceMappingURL=env.js.map
|
package/src/microsoft/env.js
CHANGED
|
@@ -15,5 +15,11 @@ exports.MICROSOFT_AUTH_CONFIG_ENTRIES = [
|
|
|
15
15
|
description: 'Microsoft OAuth2 callback URL.',
|
|
16
16
|
},
|
|
17
17
|
{ key: env_1.AUTH_MICROSOFT_TENANT, required: false, defaultValue: 'common', description: 'Microsoft tenant ID.' },
|
|
18
|
+
{
|
|
19
|
+
key: env_1.AUTH_MICROSOFT_SCOPE,
|
|
20
|
+
required: false,
|
|
21
|
+
defaultValue: 'user.read',
|
|
22
|
+
description: 'Comma-separated list of Microsoft OAuth scopes.',
|
|
23
|
+
},
|
|
18
24
|
];
|
|
19
25
|
//# sourceMappingURL=env.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BcryptService } from '@breadstone/archipel-platform-
|
|
1
|
+
import { BcryptService } from '@breadstone/archipel-platform-cryptography';
|
|
2
2
|
import { MfaSubjectPort } from '../contracts/MfaSubjectPort';
|
|
3
3
|
import { IMfaConfirmation, IMfaSetup } from '../models';
|
|
4
4
|
import { IMfaChannel } from './mfa/IMfaChannel';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.MfaService = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const
|
|
6
|
+
const archipel_platform_cryptography_1 = require("@breadstone/archipel-platform-cryptography");
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const node_crypto_1 = require("node:crypto");
|
|
9
9
|
const MfaSubjectPort_1 = require("../contracts/MfaSubjectPort");
|
|
@@ -244,7 +244,7 @@ exports.MfaService = MfaService;
|
|
|
244
244
|
exports.MfaService = MfaService = tslib_1.__decorate([
|
|
245
245
|
(0, common_1.Injectable)(),
|
|
246
246
|
tslib_1.__param(3, (0, common_1.Inject)(MfaTokens_1.MFA_CHANNELS)),
|
|
247
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
247
|
+
tslib_1.__metadata("design:paramtypes", [archipel_platform_cryptography_1.BcryptService,
|
|
248
248
|
MfaSubjectPort_1.MfaSubjectPort,
|
|
249
249
|
MfaEncryptionService_1.MfaEncryptionService, Array])
|
|
250
250
|
], MfaService);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfigService } from '@breadstone/archipel-platform-core';
|
|
2
|
+
import { BcryptService } from '@breadstone/archipel-platform-cryptography';
|
|
2
3
|
import { MfaSubjectPort } from '../../../contracts/MfaSubjectPort';
|
|
3
4
|
import { IMfaSetup } from '../../../models';
|
|
4
5
|
import { IMfaChannel } from '../IMfaChannel';
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.EmailOtpMfaChannel = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
|
|
8
|
+
const archipel_platform_cryptography_1 = require("@breadstone/archipel-platform-cryptography");
|
|
8
9
|
const common_1 = require("@nestjs/common");
|
|
9
10
|
const node_crypto_1 = require("node:crypto");
|
|
10
11
|
const MfaSubjectPort_1 = require("../../../contracts/MfaSubjectPort");
|
|
@@ -147,6 +148,6 @@ let EmailOtpMfaChannel = EmailOtpMfaChannel_1 = class EmailOtpMfaChannel {
|
|
|
147
148
|
exports.EmailOtpMfaChannel = EmailOtpMfaChannel;
|
|
148
149
|
exports.EmailOtpMfaChannel = EmailOtpMfaChannel = EmailOtpMfaChannel_1 = tslib_1.__decorate([
|
|
149
150
|
(0, common_1.Injectable)(),
|
|
150
|
-
tslib_1.__metadata("design:paramtypes", [MfaSubjectPort_1.MfaSubjectPort, archipel_platform_core_1.ConfigService,
|
|
151
|
+
tslib_1.__metadata("design:paramtypes", [MfaSubjectPort_1.MfaSubjectPort, archipel_platform_core_1.ConfigService, archipel_platform_cryptography_1.BcryptService])
|
|
151
152
|
], EmailOtpMfaChannel);
|
|
152
153
|
//# sourceMappingURL=EmailOtpMfaChannel.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfigService } from '@breadstone/archipel-platform-core';
|
|
2
|
+
import { BcryptService } from '@breadstone/archipel-platform-cryptography';
|
|
2
3
|
import { MfaSubjectPort } from '../../../contracts/MfaSubjectPort';
|
|
3
4
|
import { IMfaSetup } from '../../../models';
|
|
4
5
|
import { IMfaChannel } from '../IMfaChannel';
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.PushMfaChannel = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
|
|
8
|
+
const archipel_platform_cryptography_1 = require("@breadstone/archipel-platform-cryptography");
|
|
8
9
|
const common_1 = require("@nestjs/common");
|
|
9
10
|
const node_crypto_1 = require("node:crypto");
|
|
10
11
|
const MfaSubjectPort_1 = require("../../../contracts/MfaSubjectPort");
|
|
@@ -145,6 +146,6 @@ let PushMfaChannel = PushMfaChannel_1 = class PushMfaChannel {
|
|
|
145
146
|
exports.PushMfaChannel = PushMfaChannel;
|
|
146
147
|
exports.PushMfaChannel = PushMfaChannel = PushMfaChannel_1 = tslib_1.__decorate([
|
|
147
148
|
(0, common_1.Injectable)(),
|
|
148
|
-
tslib_1.__metadata("design:paramtypes", [MfaSubjectPort_1.MfaSubjectPort, archipel_platform_core_1.ConfigService,
|
|
149
|
+
tslib_1.__metadata("design:paramtypes", [MfaSubjectPort_1.MfaSubjectPort, archipel_platform_core_1.ConfigService, archipel_platform_cryptography_1.BcryptService])
|
|
149
150
|
], PushMfaChannel);
|
|
150
151
|
//# sourceMappingURL=PushMfaChannel.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ConfigService } from '@breadstone/archipel-platform-core';
|
|
2
|
+
import { BcryptService } from '@breadstone/archipel-platform-cryptography';
|
|
2
3
|
import { MfaSubjectPort } from '../../../contracts/MfaSubjectPort';
|
|
3
4
|
import { IMfaSetup } from '../../../models';
|
|
4
5
|
import { IMfaChannel } from '../IMfaChannel';
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.SmsMfaChannel = void 0;
|
|
6
6
|
const tslib_1 = require("tslib");
|
|
7
7
|
const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
|
|
8
|
+
const archipel_platform_cryptography_1 = require("@breadstone/archipel-platform-cryptography");
|
|
8
9
|
const common_1 = require("@nestjs/common");
|
|
9
10
|
const node_crypto_1 = require("node:crypto");
|
|
10
11
|
const MfaSubjectPort_1 = require("../../../contracts/MfaSubjectPort");
|
|
@@ -153,6 +154,6 @@ let SmsMfaChannel = SmsMfaChannel_1 = class SmsMfaChannel {
|
|
|
153
154
|
exports.SmsMfaChannel = SmsMfaChannel;
|
|
154
155
|
exports.SmsMfaChannel = SmsMfaChannel = SmsMfaChannel_1 = tslib_1.__decorate([
|
|
155
156
|
(0, common_1.Injectable)(),
|
|
156
|
-
tslib_1.__metadata("design:paramtypes", [MfaSubjectPort_1.MfaSubjectPort, archipel_platform_core_1.ConfigService,
|
|
157
|
+
tslib_1.__metadata("design:paramtypes", [MfaSubjectPort_1.MfaSubjectPort, archipel_platform_core_1.ConfigService, archipel_platform_cryptography_1.BcryptService])
|
|
157
158
|
], SmsMfaChannel);
|
|
158
159
|
//# sourceMappingURL=SmsMfaChannel.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ConfigService
|
|
1
|
+
import { ConfigService } from '@breadstone/archipel-platform-core';
|
|
2
|
+
import { IOtpService } from '@breadstone/archipel-platform-cryptography';
|
|
2
3
|
import { MfaSubjectPort } from '../../../contracts/MfaSubjectPort';
|
|
3
4
|
import { IMfaSetup } from '../../../models';
|
|
4
5
|
import { IMfaChannel } from '../IMfaChannel';
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.TotpMfaChannel = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const archipel_platform_core_1 = require("@breadstone/archipel-platform-core");
|
|
7
|
+
const archipel_platform_cryptography_1 = require("@breadstone/archipel-platform-cryptography");
|
|
7
8
|
const common_1 = require("@nestjs/common");
|
|
8
9
|
const MfaSubjectPort_1 = require("../../../contracts/MfaSubjectPort");
|
|
9
10
|
const MfaEncryptionService_1 = require("../MfaEncryptionService");
|
|
@@ -92,7 +93,7 @@ let TotpMfaChannel = class TotpMfaChannel {
|
|
|
92
93
|
exports.TotpMfaChannel = TotpMfaChannel;
|
|
93
94
|
exports.TotpMfaChannel = TotpMfaChannel = tslib_1.__decorate([
|
|
94
95
|
(0, common_1.Injectable)(),
|
|
95
|
-
tslib_1.__param(3, (0, common_1.Inject)(
|
|
96
|
+
tslib_1.__param(3, (0, common_1.Inject)(archipel_platform_cryptography_1.OTP_SERVICE_TOKEN)),
|
|
96
97
|
tslib_1.__metadata("design:paramtypes", [MfaSubjectPort_1.MfaSubjectPort,
|
|
97
98
|
archipel_platform_core_1.ConfigService,
|
|
98
99
|
MfaEncryptionService_1.MfaEncryptionService, Object])
|
|
@@ -26,13 +26,18 @@ let AppleStrategy = class AppleStrategy extends (0, passport_1.PassportStrategy)
|
|
|
26
26
|
constructor(socialAuth, configService) {
|
|
27
27
|
const rawPrivateKey = configService.get('AUTH_APPLE_PRIVATE_KEY');
|
|
28
28
|
const normalizedPrivateKey = rawPrivateKey.replace(/\r/g, '').replace(/\\n/g, '\n');
|
|
29
|
+
const scope = configService
|
|
30
|
+
.tryGet('AUTH_APPLE_SCOPE', 'name,email')
|
|
31
|
+
.split(',')
|
|
32
|
+
.map((s) => s.trim())
|
|
33
|
+
.filter(Boolean);
|
|
29
34
|
super({
|
|
30
35
|
clientID: configService.get('AUTH_APPLE_CLIENT_ID'),
|
|
31
36
|
teamID: configService.get('AUTH_APPLE_TEAM_ID'),
|
|
32
37
|
keyID: configService.get('AUTH_APPLE_KEY_ID'),
|
|
33
38
|
callbackURL: configService.tryGet('AUTH_APPLE_CALLBACK_URL', '/auth/apple/callback'),
|
|
34
39
|
privateKeyString: normalizedPrivateKey,
|
|
35
|
-
scope
|
|
40
|
+
scope,
|
|
36
41
|
state: true,
|
|
37
42
|
});
|
|
38
43
|
this._socialAuth = socialAuth;
|
|
@@ -20,10 +20,16 @@ let GithubStrategy = class GithubStrategy extends (0, passport_1.PassportStrateg
|
|
|
20
20
|
* @param configService Configuration service instance.
|
|
21
21
|
*/
|
|
22
22
|
constructor(socialAuth, configService) {
|
|
23
|
+
const scope = configService
|
|
24
|
+
.tryGet('AUTH_GITHUB_SCOPE', 'user:email')
|
|
25
|
+
.split(',')
|
|
26
|
+
.map((s) => s.trim())
|
|
27
|
+
.filter(Boolean);
|
|
23
28
|
super({
|
|
24
29
|
clientID: configService.get('AUTH_GITHUB_CLIENT_ID'),
|
|
25
30
|
clientSecret: configService.get('AUTH_GITHUB_CLIENT_SECRET'),
|
|
26
31
|
callbackURL: configService.tryGet('AUTH_GITHUB_CALLBACK_URL', '/auth/github/callback'),
|
|
32
|
+
scope,
|
|
27
33
|
});
|
|
28
34
|
this._socialAuth = socialAuth;
|
|
29
35
|
}
|
|
@@ -25,11 +25,16 @@ let GoogleStrategy = class GoogleStrategy extends (0, passport_1.PassportStrateg
|
|
|
25
25
|
* @param configService Configuration service instance.
|
|
26
26
|
*/
|
|
27
27
|
constructor(socialAuth, configService) {
|
|
28
|
+
const scope = configService
|
|
29
|
+
.tryGet('AUTH_GOOGLE_SCOPE', 'email,profile')
|
|
30
|
+
.split(',')
|
|
31
|
+
.map((s) => s.trim())
|
|
32
|
+
.filter(Boolean);
|
|
28
33
|
super({
|
|
29
34
|
clientID: configService.get('AUTH_GOOGLE_CLIENT_ID'),
|
|
30
35
|
clientSecret: configService.get('AUTH_GOOGLE_CLIENT_SECRET'),
|
|
31
36
|
callbackURL: configService.tryGet('AUTH_GOOGLE_CALLBACK_URL', '/auth/google/callback'),
|
|
32
|
-
scope
|
|
37
|
+
scope,
|
|
33
38
|
state: true,
|
|
34
39
|
});
|
|
35
40
|
this._socialAuth = socialAuth;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BcryptService } from '@breadstone/archipel-platform-
|
|
1
|
+
import { BcryptService } from '@breadstone/archipel-platform-cryptography';
|
|
2
2
|
import { Strategy } from 'passport-local';
|
|
3
3
|
import { AuthSubjectPort } from '../contracts/AuthSubjectPort';
|
|
4
4
|
import type { IAuthSubject } from '../contracts/IAuthSubject';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.LocalStrategy = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
|
-
const
|
|
6
|
+
const archipel_platform_cryptography_1 = require("@breadstone/archipel-platform-cryptography");
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const passport_1 = require("@nestjs/passport");
|
|
9
9
|
const passport_local_1 = require("passport-local");
|
|
@@ -54,6 +54,6 @@ let LocalStrategy = class LocalStrategy extends (0, passport_1.PassportStrategy)
|
|
|
54
54
|
exports.LocalStrategy = LocalStrategy;
|
|
55
55
|
exports.LocalStrategy = LocalStrategy = tslib_1.__decorate([
|
|
56
56
|
(0, common_1.Injectable)(),
|
|
57
|
-
tslib_1.__metadata("design:paramtypes", [AuthSubjectPort_1.AuthSubjectPort,
|
|
57
|
+
tslib_1.__metadata("design:paramtypes", [AuthSubjectPort_1.AuthSubjectPort, archipel_platform_cryptography_1.BcryptService])
|
|
58
58
|
], LocalStrategy);
|
|
59
59
|
//# sourceMappingURL=LocalStrategy.js.map
|
|
@@ -25,12 +25,17 @@ let MicrosoftStrategy = class MicrosoftStrategy extends (0, passport_1.PassportS
|
|
|
25
25
|
* @param configService Configuration service instance.
|
|
26
26
|
*/
|
|
27
27
|
constructor(socialAuth, configService) {
|
|
28
|
+
const scope = configService
|
|
29
|
+
.tryGet('AUTH_MICROSOFT_SCOPE', 'user.read')
|
|
30
|
+
.split(',')
|
|
31
|
+
.map((s) => s.trim())
|
|
32
|
+
.filter(Boolean);
|
|
28
33
|
super({
|
|
29
34
|
clientID: configService.get('AUTH_MICROSOFT_CLIENT_ID'),
|
|
30
35
|
clientSecret: configService.get('AUTH_MICROSOFT_CLIENT_SECRET'),
|
|
31
36
|
callbackURL: configService.tryGet('AUTH_MICROSOFT_CALLBACK_URL', '/auth/microsoft/callback'),
|
|
32
37
|
tenant: configService.tryGet('AUTH_MICROSOFT_TENANT', 'common'),
|
|
33
|
-
scope
|
|
38
|
+
scope,
|
|
34
39
|
state: true,
|
|
35
40
|
});
|
|
36
41
|
this._socialAuth = socialAuth;
|