@steedos/accounts 2.2.52-beta.21 → 2.2.52-beta.25
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/LICENSE.txt +2 -3
- package/lib/core/index.js +18 -18
- package/lib/database-mongo/mongo.js +93 -90
- package/lib/database-mongo/mongo.js.map +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/lib/mail.js +2 -2
- package/lib/oauth2/stub/oidc-cert.js +1 -1
- package/lib/oauth2/stub/oidc-cert.js.map +1 -1
- package/lib/password/accounts-password.js +54 -41
- package/lib/password/accounts-password.js.map +1 -1
- package/lib/password/index.js +1 -1
- package/lib/password/index.js.map +1 -1
- package/lib/password/utils/encryption.js +3 -3
- package/lib/rest-express/endpoints/authorize.js +2 -2
- package/lib/rest-express/endpoints/get-user.js +2 -2
- package/lib/rest-express/endpoints/impersonate.js +2 -2
- package/lib/rest-express/endpoints/initServer.js +2 -2
- package/lib/rest-express/endpoints/login.js +2 -2
- package/lib/rest-express/endpoints/logout.js +2 -2
- package/lib/rest-express/endpoints/oauth/provider-callback.js +3 -3
- package/lib/rest-express/endpoints/oauth/provider-callback.js.map +1 -1
- package/lib/rest-express/endpoints/password/change-password.js +2 -2
- package/lib/rest-express/endpoints/password/register.js +2 -2
- package/lib/rest-express/endpoints/password/reset.js +4 -4
- package/lib/rest-express/endpoints/password/two-factor.js +6 -6
- package/lib/rest-express/endpoints/password/verify-email.js +6 -6
- package/lib/rest-express/endpoints/password/verify.js +4 -4
- package/lib/rest-express/endpoints/put-user-name.js +2 -2
- package/lib/rest-express/endpoints/refresh-access-token.js +2 -2
- package/lib/rest-express/endpoints/service-authenticate.js +2 -2
- package/lib/rest-express/endpoints/spaces.js +2 -2
- package/lib/rest-express/endpoints/steedos/create-tenant.js +2 -2
- package/lib/rest-express/endpoints/steedos/get-tenant.js +2 -2
- package/lib/rest-express/endpoints/steedos/settings.js +2 -2
- package/lib/rest-express/endpoints/update-session.js +2 -2
- package/lib/rest-express/express-middleware.js +1 -1
- package/lib/rest-express/express-middleware.js.map +1 -1
- package/lib/rest-express/user-loader.js +2 -2
- package/lib/rest-express/utils/steedos-auth.js +2 -2
- package/lib/rest-express/utils/steedos-auth.js.map +1 -1
- package/lib/rest-express/utils/users.js +4 -4
- package/lib/saml-idp/express-middleware.js +10 -10
- package/lib/saml-idp/express-middleware.js.map +1 -1
- package/lib/server/accounts-server.js +41 -32
- package/lib/server/accounts-server.js.map +1 -1
- package/lib/server/utils/email.js +2 -2
- package/lib/types/index.js +14 -14
- package/lib/types/index.js.map +1 -1
- package/package.json +6 -6
- package/src/database-mongo/mongo.ts +3 -0
- package/src/index.ts +3 -3
- package/src/password/accounts-password.ts +17 -5
- package/src/server/accounts-server.ts +18 -3
- package/src/server/types/jwt-data.ts +10 -1
- package/src/types/types/connection-informations.ts +9 -0
|
@@ -28,7 +28,7 @@ import isMobile from "ismobilejs";
|
|
|
28
28
|
|
|
29
29
|
const defaultOptions = {
|
|
30
30
|
ambiguousErrorMessages: true,
|
|
31
|
-
tokenSecret:
|
|
31
|
+
tokenSecret: generateRandomToken(),
|
|
32
32
|
tokenConfigs: {
|
|
33
33
|
accessToken: {
|
|
34
34
|
expiresIn: "90m",
|
|
@@ -211,6 +211,8 @@ export class AccountsServer {
|
|
|
211
211
|
phone_logout_other_clients,
|
|
212
212
|
phone_login_expiration_in_days,
|
|
213
213
|
space,
|
|
214
|
+
provider,
|
|
215
|
+
jwtToken,
|
|
214
216
|
} = infos;
|
|
215
217
|
|
|
216
218
|
let is_phone = false;
|
|
@@ -251,7 +253,7 @@ export class AccountsServer {
|
|
|
251
253
|
//3 清理用户所有session 缓存
|
|
252
254
|
removeUserSessionsCacheByUserId(user.id, is_phone);
|
|
253
255
|
}
|
|
254
|
-
const token = generateRandomToken();
|
|
256
|
+
const token = jwtToken || generateRandomToken();
|
|
255
257
|
const sessionId = await this.db.createSession(user.id, token, {
|
|
256
258
|
ip,
|
|
257
259
|
userAgent,
|
|
@@ -260,11 +262,14 @@ export class AccountsServer {
|
|
|
260
262
|
is_phone,
|
|
261
263
|
is_tablet,
|
|
262
264
|
space,
|
|
265
|
+
provider
|
|
263
266
|
});
|
|
264
267
|
|
|
265
268
|
const { accessToken, refreshToken } = this.createTokens({
|
|
266
269
|
token,
|
|
267
270
|
userId: user.id,
|
|
271
|
+
name: user.name,
|
|
272
|
+
email: user.email
|
|
268
273
|
});
|
|
269
274
|
|
|
270
275
|
return {
|
|
@@ -365,6 +370,8 @@ export class AccountsServer {
|
|
|
365
370
|
token: newSessionId,
|
|
366
371
|
isImpersonated: true,
|
|
367
372
|
userId: user.id,
|
|
373
|
+
name: user.name,
|
|
374
|
+
email: user.email,
|
|
368
375
|
});
|
|
369
376
|
const impersonationResult = {
|
|
370
377
|
authorized: true,
|
|
@@ -434,6 +441,8 @@ export class AccountsServer {
|
|
|
434
441
|
const tokens = this.createTokens({
|
|
435
442
|
token: sessionToken,
|
|
436
443
|
userId: user.id,
|
|
444
|
+
name: user.name,
|
|
445
|
+
email: user.email
|
|
437
446
|
});
|
|
438
447
|
await this.db.updateSession(session.id, { ip, userAgent });
|
|
439
448
|
|
|
@@ -467,16 +476,22 @@ export class AccountsServer {
|
|
|
467
476
|
token,
|
|
468
477
|
isImpersonated = false,
|
|
469
478
|
userId,
|
|
479
|
+
name,
|
|
480
|
+
email
|
|
470
481
|
}: {
|
|
471
482
|
token: string;
|
|
472
483
|
isImpersonated?: boolean;
|
|
473
484
|
userId: string;
|
|
485
|
+
name: string,
|
|
486
|
+
email: string
|
|
474
487
|
}): Tokens {
|
|
475
488
|
const { tokenSecret, tokenConfigs } = this.options;
|
|
476
489
|
const jwtData: JwtData = {
|
|
477
|
-
token,
|
|
490
|
+
// token,
|
|
478
491
|
isImpersonated,
|
|
479
492
|
userId,
|
|
493
|
+
name,
|
|
494
|
+
email
|
|
480
495
|
};
|
|
481
496
|
const accessToken = generateAccessToken({
|
|
482
497
|
data: jwtData,
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-03-28 09:35:34
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2022-07-01 15:01:17
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
1
8
|
export interface JwtData {
|
|
2
|
-
token
|
|
9
|
+
token?: string;
|
|
3
10
|
isImpersonated: boolean;
|
|
4
11
|
userId: string;
|
|
12
|
+
name: string,
|
|
13
|
+
email: string,
|
|
5
14
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-03-28 09:35:34
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2022-06-29 16:05:04
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
1
8
|
export interface ConnectionInformations {
|
|
2
9
|
ip?: string;
|
|
3
10
|
userAgent?: string;
|
|
@@ -8,4 +15,6 @@ export interface ConnectionInformations {
|
|
|
8
15
|
login_expiration_in_days?: number;
|
|
9
16
|
phone_logout_other_clients?: boolean;
|
|
10
17
|
phone_login_expiration_in_days?: number;
|
|
18
|
+
provider?: string;
|
|
19
|
+
jwtToken?: string;
|
|
11
20
|
}
|