@pubinfo/module-auth 2.0.8 → 2.0.9
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/index.js +163 -141
- package/dist/providers/4A.js +20 -18
- package/dist/providers/credentials.js +11 -9
- package/dist/providers/ding-zj.js +48 -44
- package/package.json +3 -3
package/dist/providers/4A.js
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
function i(e) {
|
|
2
|
+
const { clientId: r, redirectUri: t } = e;
|
|
3
|
+
return {
|
|
4
|
+
id: "4A",
|
|
5
|
+
name: "4A登录",
|
|
6
|
+
type: "oauth",
|
|
7
|
+
authorization: {
|
|
8
|
+
url: "http://134.108.76.137:7001/index",
|
|
9
|
+
params: {
|
|
10
|
+
response_type: "code",
|
|
11
|
+
client_id: r,
|
|
12
|
+
redirect_uri: t
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
callbackUrl: "/bs/loginBy4a",
|
|
16
|
+
...e
|
|
17
|
+
};
|
|
18
18
|
}
|
|
19
|
-
export {
|
|
19
|
+
export {
|
|
20
|
+
i as default
|
|
21
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
function a(t) {
|
|
2
|
+
const { authorize: e } = t;
|
|
3
|
+
return {
|
|
4
|
+
id: "credentials",
|
|
5
|
+
name: "凭证登录",
|
|
6
|
+
type: "custom",
|
|
7
|
+
authorization: e
|
|
8
|
+
};
|
|
9
9
|
}
|
|
10
|
-
export {
|
|
10
|
+
export {
|
|
11
|
+
a as default
|
|
12
|
+
};
|
|
@@ -1,45 +1,49 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
function m(e) {
|
|
2
|
+
const { clientId: i, redirectUri: n } = e, a = {
|
|
3
|
+
/** 跳转外部页面 */
|
|
4
|
+
redirect: {
|
|
5
|
+
url: "https://openplatform-pro.ding.zj.gov.cn/oauth2/auth.htm",
|
|
6
|
+
params: {
|
|
7
|
+
response_type: "code",
|
|
8
|
+
client_id: i,
|
|
9
|
+
redirect_uri: n,
|
|
10
|
+
scope: "get_user_info",
|
|
11
|
+
authType: "QRCODE"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
/** 内嵌二维码 */
|
|
15
|
+
embed: {
|
|
16
|
+
url: "https://login-pro.ding.zj.gov.cn/oauth2/auth.htm",
|
|
17
|
+
params: {
|
|
18
|
+
response_type: "code",
|
|
19
|
+
client_id: i,
|
|
20
|
+
redirect_uri: n,
|
|
21
|
+
scope: "get_user_info",
|
|
22
|
+
authType: "QRCODE",
|
|
23
|
+
embedMode: "true"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, o = (c, t) => {
|
|
27
|
+
if (!document.getElementById(t.id))
|
|
28
|
+
throw new Error(`未找到id为${t.id}的DOM元素`);
|
|
29
|
+
const r = document.createElement("iframe");
|
|
30
|
+
r.src = c, r.width = "200", r.height = "200", document.appendChild(r), window.addEventListener("message", (u) => {
|
|
31
|
+
if (t.redirectUri) {
|
|
32
|
+
const d = new URL(t.redirectUri);
|
|
33
|
+
d.search = new URLSearchParams(u.data).toString(), window.location.href = d.toString();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
id: "ding-zj",
|
|
39
|
+
name: "浙政钉登录",
|
|
40
|
+
type: "oauth",
|
|
41
|
+
authorization: a[e.mode],
|
|
42
|
+
callbackUrl: "/bs/loginByDingZJ",
|
|
43
|
+
initQRCode: e.mode === "embed" ? o : void 0,
|
|
44
|
+
...e
|
|
45
|
+
};
|
|
44
46
|
}
|
|
45
|
-
export {
|
|
47
|
+
export {
|
|
48
|
+
m as default
|
|
49
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/module-auth",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.9",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"node": "^20.19.0 || >=22.12.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"pubinfo": "2.0.
|
|
26
|
+
"pubinfo": "2.0.9"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"pubinfo": "2.0.
|
|
29
|
+
"pubinfo": "2.0.9"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"dev": "pubinfo build --watch",
|