@steedos/service-identity-jwt 2.2.55-beta.7 → 2.3.0-beta.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.
|
@@ -2,20 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Account = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
/*
|
|
6
|
-
* @Author: baozhoutao@steedos.com
|
|
7
|
-
* @Date: 2022-06-27 15:17:27
|
|
8
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
9
|
-
* @LastEditTime: 2022-07-18 13:30:25
|
|
10
|
-
* @Description:
|
|
11
|
-
*/
|
|
12
5
|
const accounts_1 = require("@steedos/accounts");
|
|
13
6
|
const requestIp = require("request-ip");
|
|
14
7
|
const objectql_1 = require("@steedos/objectql");
|
|
15
8
|
const getUserAgent = (req) => {
|
|
16
9
|
let userAgent = req.headers['user-agent'] || '';
|
|
17
10
|
if (req.headers['x-ucbrowser-ua']) {
|
|
18
|
-
// special case of UC Browser
|
|
19
11
|
userAgent = req.headers['x-ucbrowser-ua'];
|
|
20
12
|
}
|
|
21
13
|
return userAgent;
|
|
@@ -24,7 +16,6 @@ class Account {
|
|
|
24
16
|
static ssoLogin(req, res, options = { user: null, err: null, redirect: true, accessToken: null }) {
|
|
25
17
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
18
|
let { user, err } = options;
|
|
27
|
-
//TODO
|
|
28
19
|
if (err || !user) {
|
|
29
20
|
(0, objectql_1.getSteedosSchema)().broker.logger.error(`oidc sso login error: ${err}`);
|
|
30
21
|
return res.redirect("/api/global/auth/oidc/error-callback");
|
|
@@ -36,7 +27,6 @@ class Account {
|
|
|
36
27
|
let phone_logout_other_clients = false;
|
|
37
28
|
let phone_login_expiration_in_days = null;
|
|
38
29
|
let space = null;
|
|
39
|
-
// 获取用户简档
|
|
40
30
|
const userProfile = yield accounts_1.accountsServer.getUserProfile(user.id);
|
|
41
31
|
if (userProfile) {
|
|
42
32
|
logout_other_clients = userProfile.logout_other_clients || false;
|
|
@@ -47,7 +37,6 @@ class Account {
|
|
|
47
37
|
userProfile.phone_login_expiration_in_days;
|
|
48
38
|
space = userProfile.space;
|
|
49
39
|
}
|
|
50
|
-
// 更新user_providers
|
|
51
40
|
const loginResult = yield accounts_1.accountsServer.loginWithUser(user, Object.assign({}, {
|
|
52
41
|
ip,
|
|
53
42
|
userAgent
|
|
@@ -58,7 +47,6 @@ class Account {
|
|
|
58
47
|
phone_login_expiration_in_days,
|
|
59
48
|
space,
|
|
60
49
|
provider: 'jwt',
|
|
61
|
-
// jwtToken: options.accessToken // 如果使用jwt token 会导致cookie太大
|
|
62
50
|
}));
|
|
63
51
|
(0, accounts_1.setAuthCookies)(req, res, loginResult.user._id, loginResult.token, loginResult.tokens.accessToken);
|
|
64
52
|
if (options.redirect) {
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
/*
|
|
5
|
-
* @Author: baozhoutao@steedos.com
|
|
6
|
-
* @Date: 2022-06-08 23:28:39
|
|
7
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
8
|
-
* @LastEditTime: 2022-07-16 16:18:31
|
|
9
|
-
* @Description:
|
|
10
|
-
*/
|
|
11
4
|
const express = require("express");
|
|
12
5
|
const account_1 = require("./account");
|
|
13
6
|
const passport = require('passport');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-identity-jwt",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0-beta.3",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"steedos"
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
"description": "steedos package",
|
|
12
12
|
"repository": {},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@steedos/accounts": "2.
|
|
14
|
+
"@steedos/accounts": "2.3.0-beta.3",
|
|
15
15
|
"express": "4.18.1",
|
|
16
|
+
"passport": "^0.6.0",
|
|
16
17
|
"passport-jwt": "^4.0.0"
|
|
17
18
|
},
|
|
18
19
|
"license": "MIT",
|
|
@@ -20,5 +21,5 @@
|
|
|
20
21
|
"publishConfig": {
|
|
21
22
|
"access": "public"
|
|
22
23
|
},
|
|
23
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "bb746c90035f38b361011e4b10f0993a390e8355"
|
|
24
25
|
}
|