@flink-app/generic-auth-plugin 0.12.1-alpha.23 → 0.12.1-alpha.27
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/.flink/generatedHandlers.ts +1 -1
- package/.flink/generatedJobs.ts +1 -1
- package/.flink/generatedRepos.ts +1 -1
- package/.flink/schemas/schemas.json +5 -1
- package/.flink/schemas/schemas.ts +1 -1
- package/.flink/start.ts +1 -1
- package/dist/.flink/generatedHandlers.js +1 -1
- package/dist/.flink/generatedJobs.js +1 -1
- package/dist/.flink/generatedRepos.js +1 -1
- package/dist/.flink/schemas/schemas.json +5 -1
- package/dist/.flink/start.js +1 -1
- package/dist/src/coreFunctions.d.ts +2 -2
- package/dist/src/coreFunctions.js +19 -1
- package/dist/src/genericAuthContext.d.ts +2 -2
- package/dist/src/handlers/UserCreate.js +4 -4
- package/dist/src/schemas/User.d.ts +2 -1
- package/dist/src/schemas/UserCreateReq.d.ts +2 -1
- package/package.json +2 -2
- package/src/coreFunctions.ts +23 -2
- package/src/genericAuthContext.ts +3 -2
- package/src/handlers/UserCreate.ts +3 -2
- package/src/schemas/User.ts +2 -1
- package/src/schemas/UserCreateReq.ts +5 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Thu Sep 11 2025 10:23:23 GMT+0200 (Central European Summer Time)
|
|
2
2
|
import { autoRegisteredHandlers, HttpMethod } from "@flink-app/flink";
|
|
3
3
|
import * as UserCreate_0 from "../src/handlers/UserCreate";
|
|
4
4
|
import * as UserLogin_0 from "../src/handlers/UserLogin";
|
package/.flink/generatedJobs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Thu Sep 11 2025 10:23:24 GMT+0200 (Central European Summer Time)
|
|
2
2
|
import { autoRegisteredJobs } from "@flink-app/flink";
|
|
3
3
|
export const jobs = [];
|
|
4
4
|
autoRegisteredJobs.push(...jobs);
|
package/.flink/generatedRepos.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Thu Sep 11 2025 10:23:23 GMT+0200 (Central European Summer Time)
|
|
2
2
|
import { autoRegisteredRepos } from "@flink-app/flink";
|
|
3
3
|
export const repos = [];
|
|
4
4
|
autoRegisteredRepos.push(...repos);
|
|
@@ -29,7 +29,7 @@ import { PutManagementUserRolesByUseridRes } from "../../src/schemas/Management/
|
|
|
29
29
|
import { PutManagementUserUsernameByUseridReq } from "../../src/schemas/Management/PutUserUsernameByUseridReq";
|
|
30
30
|
import { PutManagementUserUsernameByUseridRes } from "../../src/schemas/Management/PutUserUsernameByUseridRes";
|
|
31
31
|
|
|
32
|
-
// Generated
|
|
32
|
+
// Generated Thu Sep 11 2025 10:23:24 GMT+0200 (Central European Summer Time)
|
|
33
33
|
export interface UserCreate_7_ReqSchema extends UserCreateReq {}
|
|
34
34
|
|
|
35
35
|
export interface UserCreate_7_ResSchema extends UserCreateRes {}
|
package/.flink/start.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handlers = void 0;
|
|
4
|
-
// Generated
|
|
4
|
+
// Generated Thu Sep 11 2025 10:23:23 GMT+0200 (Central European Summer Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.handlers = [];
|
|
7
7
|
flink_1.autoRegisteredHandlers.push.apply(flink_1.autoRegisteredHandlers, exports.handlers);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jobs = void 0;
|
|
4
|
-
// Generated
|
|
4
|
+
// Generated Thu Sep 11 2025 10:23:24 GMT+0200 (Central European Summer Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.jobs = [];
|
|
7
7
|
flink_1.autoRegisteredJobs.push.apply(flink_1.autoRegisteredJobs, exports.jobs);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.repos = void 0;
|
|
4
|
-
// Generated
|
|
4
|
+
// Generated Thu Sep 11 2025 10:23:23 GMT+0200 (Central European Summer Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.repos = [];
|
|
7
7
|
flink_1.autoRegisteredRepos.push.apply(flink_1.autoRegisteredRepos, exports.repos);
|
package/dist/.flink/start.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Generated
|
|
3
|
+
// Generated Thu Sep 11 2025 10:23:24 GMT+0200 (Central European Summer Time)
|
|
4
4
|
require("./generatedHandlers");
|
|
5
5
|
require("./generatedRepos");
|
|
6
6
|
require("./generatedJobs");
|
|
@@ -11,14 +11,14 @@ import { GenericAuthsmsOptions } from "./genericAuthPluginOptions";
|
|
|
11
11
|
export declare function getJtwTokenPlugin(secret: string, rolePermissions?: {
|
|
12
12
|
[role: string]: string[];
|
|
13
13
|
}, passwordPolicy?: RegExp, tokenTTL?: number): JwtAuthPlugin;
|
|
14
|
-
export declare function createUser(repo: FlinkRepo<any, User>, auth: JwtAuthPlugin, username: string, password: string, authentificationMethod: "password" | "sms", roles: string[], profile: UserProfile, createPasswordHashAndSaltMethod?: {
|
|
14
|
+
export declare function createUser(repo: FlinkRepo<any, User>, auth: JwtAuthPlugin, username: string, password: string, authentificationMethod: "password" | "sms" | "bankid", roles: string[], profile: UserProfile, createPasswordHashAndSaltMethod?: {
|
|
15
15
|
(password: string): Promise<{
|
|
16
16
|
hash: string;
|
|
17
17
|
salt: string;
|
|
18
18
|
} | null>;
|
|
19
19
|
}, onUserCreated?: {
|
|
20
20
|
(user: User): Promise<void>;
|
|
21
|
-
}): Promise<UserCreateRes>;
|
|
21
|
+
}, personalNumber?: string): Promise<UserCreateRes>;
|
|
22
22
|
export declare function loginByToken(repo: FlinkRepo<any, User>, auth: JwtAuthPlugin, token: string, code: string, jwtSecret: string): Promise<UserLoginRes>;
|
|
23
23
|
export declare function loginUser(repo: FlinkRepo<any, User>, auth: JwtAuthPlugin, username: string, password: string | undefined, validatePasswordMethod?: {
|
|
24
24
|
(password: string, hash: string, salt: string): Promise<boolean>;
|
|
@@ -40,6 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.passwordResetComplete = exports.passwordResetStart = exports.changePassword = exports.loginUser = exports.loginByToken = exports.createUser = exports.getJtwTokenPlugin = void 0;
|
|
43
|
+
var flink_1 = require("@flink-app/flink");
|
|
43
44
|
var jwt_auth_plugin_1 = require("@flink-app/jwt-auth-plugin");
|
|
44
45
|
var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
45
46
|
function getJtwTokenPlugin(secret, rolePermissions, passwordPolicy, tokenTTL) {
|
|
@@ -70,7 +71,7 @@ function getJtwTokenPlugin(secret, rolePermissions, passwordPolicy, tokenTTL) {
|
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
73
|
exports.getJtwTokenPlugin = getJtwTokenPlugin;
|
|
73
|
-
function createUser(repo, auth, username, password, authentificationMethod, roles, profile, createPasswordHashAndSaltMethod, onUserCreated) {
|
|
74
|
+
function createUser(repo, auth, username, password, authentificationMethod, roles, profile, createPasswordHashAndSaltMethod, onUserCreated, personalNumber) {
|
|
74
75
|
return __awaiter(this, void 0, void 0, function () {
|
|
75
76
|
var existingUser, userData, passwordAndSalt, user, token;
|
|
76
77
|
return __generator(this, function (_a) {
|
|
@@ -93,6 +94,15 @@ function createUser(repo, auth, username, password, authentificationMethod, role
|
|
|
93
94
|
authentificationMethod: authentificationMethod,
|
|
94
95
|
pushNotificationTokens: [],
|
|
95
96
|
};
|
|
97
|
+
if (personalNumber) {
|
|
98
|
+
userData.personalNumber = personalNumber;
|
|
99
|
+
}
|
|
100
|
+
if (authentificationMethod == "bankid") {
|
|
101
|
+
if (!personalNumber) {
|
|
102
|
+
flink_1.log.warn("BankID login requested but no personal number found for user");
|
|
103
|
+
return [2 /*return*/, { status: "error" }];
|
|
104
|
+
}
|
|
105
|
+
}
|
|
96
106
|
if (!(authentificationMethod == "password")) return [3 /*break*/, 6];
|
|
97
107
|
passwordAndSalt = null;
|
|
98
108
|
if (!(createPasswordHashAndSaltMethod != null)) return [3 /*break*/, 3];
|
|
@@ -239,6 +249,14 @@ function loginUser(repo, auth, username, password, validatePasswordMethod, smsOp
|
|
|
239
249
|
validationToken: token,
|
|
240
250
|
}];
|
|
241
251
|
}
|
|
252
|
+
if (user.authentificationMethod == "bankid") {
|
|
253
|
+
if (!user.personalNumber) {
|
|
254
|
+
flink_1.log.warn("BankID login requested but no personal number found for user");
|
|
255
|
+
return [2 /*return*/, { status: "failed" }];
|
|
256
|
+
}
|
|
257
|
+
flink_1.log.warn("BankID login required to be handled in other way, i.e. using flink bankid plugin");
|
|
258
|
+
return [2 /*return*/, { status: "failed" }];
|
|
259
|
+
}
|
|
242
260
|
if (!valid) return [3 /*break*/, 13];
|
|
243
261
|
return [4 /*yield*/, auth.createToken({ username: username.toLowerCase(), _id: user._id }, user.roles)];
|
|
244
262
|
case 10:
|
|
@@ -15,12 +15,12 @@ export interface genericAuthContext {
|
|
|
15
15
|
(password: string, hash: string, salt: string): Promise<boolean>;
|
|
16
16
|
}, smsOptions?: GenericAuthsmsOptions, onSuccessfulLogin?: (user: User) => Promise<void>): Promise<UserLoginRes>;
|
|
17
17
|
loginByToken(repo: FlinkRepo<any, User>, auth: JwtAuthPlugin, token: string, code: string, jwtSecret: string): Promise<UserLoginRes>;
|
|
18
|
-
createUser(repo: FlinkRepo<any, User>, auth: JwtAuthPlugin, username: string, password: string, authentificationMethod: "password" | "sms", roles: string[], profile: UserProfile, createPasswordHashAndSaltMethod?: {
|
|
18
|
+
createUser(repo: FlinkRepo<any, User>, auth: JwtAuthPlugin, username: string, password: string, authentificationMethod: "password" | "sms" | "bankid", roles: string[], profile: UserProfile, createPasswordHashAndSaltMethod?: {
|
|
19
19
|
(password: string): Promise<{
|
|
20
20
|
hash: string;
|
|
21
21
|
salt: string;
|
|
22
22
|
} | null>;
|
|
23
|
-
}, onUserCreated?: (user: User) => Promise<void
|
|
23
|
+
}, onUserCreated?: (user: User) => Promise<void>, personalNumber?: string): Promise<UserCreateRes>;
|
|
24
24
|
changePassword(repo: FlinkRepo<any, User>, auth: JwtAuthPlugin, userId: string, newPassword: string, createPasswordHashAndSaltMethod?: {
|
|
25
25
|
(password: string): Promise<{
|
|
26
26
|
hash: string;
|
|
@@ -39,12 +39,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
40
|
var flink_1 = require("@flink-app/flink");
|
|
41
41
|
var userCreateHandler = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
42
|
-
var _c, password, username, authentificationMethod, profile, roles, pluginName, repo, re, createUserResponse;
|
|
42
|
+
var _c, password, username, authentificationMethod, profile, personalNumber, roles, pluginName, repo, re, createUserResponse;
|
|
43
43
|
var ctx = _b.ctx, req = _b.req, origin = _b.origin;
|
|
44
44
|
return __generator(this, function (_d) {
|
|
45
45
|
switch (_d.label) {
|
|
46
46
|
case 0:
|
|
47
|
-
_c = req.body, password = _c.password, username = _c.username, authentificationMethod = _c.authentificationMethod, profile = _c.profile;
|
|
47
|
+
_c = req.body, password = _c.password, username = _c.username, authentificationMethod = _c.authentificationMethod, profile = _c.profile, personalNumber = _c.personalNumber;
|
|
48
48
|
if (authentificationMethod == null) {
|
|
49
49
|
authentificationMethod = "password";
|
|
50
50
|
}
|
|
@@ -63,7 +63,7 @@ var userCreateHandler = function (_a) { return __awaiter(void 0, [_a], void 0, f
|
|
|
63
63
|
if (!re.test(username)) {
|
|
64
64
|
return [2 /*return*/, (0, flink_1.badRequest)("Username does not meet requirements", "usernameError")];
|
|
65
65
|
}
|
|
66
|
-
return [4 /*yield*/, ctx.plugins.genericAuthPlugin.createUser(repo, ctx.auth, username.toLocaleLowerCase(), password, authentificationMethod, roles, profile, ctx.plugins[pluginName].createPasswordHashAndSaltMethod, ctx.plugins[pluginName].onUserCreated)];
|
|
66
|
+
return [4 /*yield*/, ctx.plugins.genericAuthPlugin.createUser(repo, ctx.auth, username.toLocaleLowerCase(), password, authentificationMethod, roles, profile, ctx.plugins[pluginName].createPasswordHashAndSaltMethod, ctx.plugins[pluginName].onUserCreated, personalNumber)];
|
|
67
67
|
case 1:
|
|
68
68
|
createUserResponse = _d.sent();
|
|
69
69
|
if (createUserResponse.status != "success") {
|
|
@@ -85,4 +85,4 @@ var userCreateHandler = function (_a) { return __awaiter(void 0, [_a], void 0, f
|
|
|
85
85
|
}); };
|
|
86
86
|
exports.default = userCreateHandler;
|
|
87
87
|
exports.__assumedHttpMethod = "", exports.__file = "UserCreate.ts", exports.__query = [], exports.__params = [];
|
|
88
|
-
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "username": { "type": "string" }, "password": { "type": "string" }, "authentificationMethod": { "type": "string", "enum": ["password", "sms"] }, "profile": { "type": "object" } }, "required": ["username"], "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "status": { "type": "string", "enum": ["success", "error", "userExists", "passwordError"] }, "user": { "type": "object", "properties": { "_id": { "type": "string" }, "username": { "type": "string" }, "token": { "type": "string" } }, "required": ["_id", "username", "token"], "additionalProperties": false } }, "required": ["status"], "definitions": {} } };
|
|
88
|
+
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "username": { "type": "string" }, "password": { "type": "string" }, "personalNumber": { "type": "string" }, "authentificationMethod": { "type": "string", "enum": ["password", "sms", "bankid"] }, "profile": { "type": "object" } }, "required": ["username"], "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "status": { "type": "string", "enum": ["success", "error", "userExists", "passwordError"] }, "user": { "type": "object", "properties": { "_id": { "type": "string" }, "username": { "type": "string" }, "token": { "type": "string" } }, "required": ["_id", "username", "token"], "additionalProperties": false } }, "required": ["status"], "definitions": {} } };
|
|
@@ -3,11 +3,12 @@ import { UserProfile } from "./UserProfile";
|
|
|
3
3
|
export interface User {
|
|
4
4
|
_id: string;
|
|
5
5
|
username: string;
|
|
6
|
+
personalNumber?: string;
|
|
6
7
|
password?: string;
|
|
7
8
|
salt?: string;
|
|
8
9
|
pwdResetStartedAt?: string | null;
|
|
9
10
|
roles: string[];
|
|
10
|
-
authentificationMethod: "password" | "sms";
|
|
11
|
+
authentificationMethod: "password" | "sms" | "bankid";
|
|
11
12
|
profile: UserProfile;
|
|
12
13
|
pushNotificationTokens: Array<PushNotificationToken>;
|
|
13
14
|
}
|
|
@@ -2,6 +2,7 @@ import { UserProfile } from "./UserProfile";
|
|
|
2
2
|
export interface UserCreateReq {
|
|
3
3
|
username: string;
|
|
4
4
|
password?: string;
|
|
5
|
-
|
|
5
|
+
personalNumber?: string;
|
|
6
|
+
authentificationMethod?: "password" | "sms" | "bankid";
|
|
6
7
|
profile?: UserProfile;
|
|
7
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flink-app/generic-auth-plugin",
|
|
3
|
-
"version": "0.12.1-alpha.
|
|
3
|
+
"version": "0.12.1-alpha.27",
|
|
4
4
|
"description": "Flink plugin that provides a generic user authentification solution.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\"",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"ts-node": "^9.1.1",
|
|
31
31
|
"typescript": "5.4.5"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "6714d51c8e343b0bdfa82d34dbc205f112f9e3b9"
|
|
34
34
|
}
|
package/src/coreFunctions.ts
CHANGED
|
@@ -45,7 +45,7 @@ export async function createUser(
|
|
|
45
45
|
auth: JwtAuthPlugin,
|
|
46
46
|
username: string,
|
|
47
47
|
password: string,
|
|
48
|
-
authentificationMethod: "password" | "sms",
|
|
48
|
+
authentificationMethod: "password" | "sms" | "bankid",
|
|
49
49
|
roles: string[],
|
|
50
50
|
profile: UserProfile,
|
|
51
51
|
createPasswordHashAndSaltMethod?: {
|
|
@@ -53,7 +53,8 @@ export async function createUser(
|
|
|
53
53
|
},
|
|
54
54
|
onUserCreated?: {
|
|
55
55
|
(user: User): Promise<void>;
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
|
+
personalNumber?: string
|
|
57
58
|
): Promise<UserCreateRes> {
|
|
58
59
|
if (!roles.includes("user")) roles.push("user");
|
|
59
60
|
|
|
@@ -71,6 +72,17 @@ export async function createUser(
|
|
|
71
72
|
pushNotificationTokens: [],
|
|
72
73
|
};
|
|
73
74
|
|
|
75
|
+
if (personalNumber) {
|
|
76
|
+
userData.personalNumber = personalNumber;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (authentificationMethod == "bankid") {
|
|
80
|
+
if (!personalNumber) {
|
|
81
|
+
log.warn("BankID login requested but no personal number found for user");
|
|
82
|
+
return { status: "error" };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
74
86
|
if (authentificationMethod == "password") {
|
|
75
87
|
let passwordAndSalt = null;
|
|
76
88
|
if (createPasswordHashAndSaltMethod != null) {
|
|
@@ -205,6 +217,15 @@ export async function loginUser(
|
|
|
205
217
|
validationToken: token,
|
|
206
218
|
};
|
|
207
219
|
}
|
|
220
|
+
if (user.authentificationMethod == "bankid") {
|
|
221
|
+
if (!user.personalNumber) {
|
|
222
|
+
log.warn("BankID login requested but no personal number found for user");
|
|
223
|
+
return { status: "failed" };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
log.warn("BankID login required to be handled in other way, i.e. using flink bankid plugin");
|
|
227
|
+
return { status: "failed" };
|
|
228
|
+
}
|
|
208
229
|
|
|
209
230
|
if (valid) {
|
|
210
231
|
const token = await auth.createToken({ username: username.toLowerCase(), _id: user._id }, user.roles);
|
|
@@ -27,13 +27,14 @@ export interface genericAuthContext {
|
|
|
27
27
|
auth: JwtAuthPlugin,
|
|
28
28
|
username: string,
|
|
29
29
|
password: string,
|
|
30
|
-
authentificationMethod: "password" | "sms",
|
|
30
|
+
authentificationMethod: "password" | "sms" | "bankid",
|
|
31
31
|
roles: string[],
|
|
32
32
|
profile: UserProfile,
|
|
33
33
|
createPasswordHashAndSaltMethod?: {
|
|
34
34
|
(password: string): Promise<{ hash: string; salt: string } | null>;
|
|
35
35
|
},
|
|
36
|
-
onUserCreated?: (user: User) => Promise<void
|
|
36
|
+
onUserCreated?: (user: User) => Promise<void>,
|
|
37
|
+
personalNumber?: string
|
|
37
38
|
): Promise<UserCreateRes>;
|
|
38
39
|
changePassword(
|
|
39
40
|
repo: FlinkRepo<any, User>,
|
|
@@ -5,7 +5,7 @@ import { UserCreateReq } from "../schemas/UserCreateReq";
|
|
|
5
5
|
import { UserCreateRes } from "../schemas/UserCreateRes";
|
|
6
6
|
|
|
7
7
|
const userCreateHandler: Handler<FlinkContext<genericAuthContext>, UserCreateReq, UserCreateRes> = async ({ ctx, req, origin }) => {
|
|
8
|
-
let { password, username, authentificationMethod, profile } = req.body;
|
|
8
|
+
let { password, username, authentificationMethod, profile, personalNumber } = req.body;
|
|
9
9
|
if (authentificationMethod == null) {
|
|
10
10
|
authentificationMethod = "password";
|
|
11
11
|
}
|
|
@@ -36,7 +36,8 @@ const userCreateHandler: Handler<FlinkContext<genericAuthContext>, UserCreateReq
|
|
|
36
36
|
roles,
|
|
37
37
|
profile,
|
|
38
38
|
(<any>ctx.plugins)[pluginName].createPasswordHashAndSaltMethod,
|
|
39
|
-
(<any>ctx.plugins)[pluginName].onUserCreated
|
|
39
|
+
(<any>ctx.plugins)[pluginName].onUserCreated,
|
|
40
|
+
personalNumber
|
|
40
41
|
);
|
|
41
42
|
if (createUserResponse.status != "success") {
|
|
42
43
|
switch (createUserResponse.status) {
|
package/src/schemas/User.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { UserProfile } from "./UserProfile";
|
|
|
4
4
|
export interface User {
|
|
5
5
|
_id: string;
|
|
6
6
|
username: string;
|
|
7
|
+
personalNumber?: string;
|
|
7
8
|
|
|
8
9
|
password?: string;
|
|
9
10
|
salt?: string;
|
|
@@ -11,7 +12,7 @@ export interface User {
|
|
|
11
12
|
pwdResetStartedAt?: string | null;
|
|
12
13
|
roles: string[];
|
|
13
14
|
|
|
14
|
-
authentificationMethod: "password" | "sms";
|
|
15
|
+
authentificationMethod: "password" | "sms" | "bankid";
|
|
15
16
|
profile: UserProfile;
|
|
16
17
|
pushNotificationTokens: Array<PushNotificationToken>;
|
|
17
18
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { UserProfile } from "./UserProfile";
|
|
2
2
|
|
|
3
|
-
export interface UserCreateReq{
|
|
3
|
+
export interface UserCreateReq {
|
|
4
4
|
username: string;
|
|
5
5
|
password?: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
personalNumber?: string;
|
|
7
|
+
authentificationMethod?: "password" | "sms" | "bankid";
|
|
8
|
+
profile?: UserProfile;
|
|
9
|
+
}
|