@pubinfo-pr/module-auth 0.188.1 → 0.189.2
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 +156 -177
- package/dist/providers/4A.js +18 -20
- package/dist/providers/credentials.js +8 -10
- package/dist/providers/ding-zj.js +43 -48
- package/dist/providers/sso.js +17 -22
- package/package.json +3 -3
package/dist/providers/4A.js
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
function FourA(e) {
|
|
2
|
+
let { clientId: t, redirectUri: n } = e;
|
|
3
|
+
return {
|
|
4
|
+
id: "4A",
|
|
5
|
+
name: "4A登录",
|
|
6
|
+
type: "oauth",
|
|
7
|
+
signIn: {
|
|
8
|
+
url: "http://134.108.76.137:7001/index",
|
|
9
|
+
params: {
|
|
10
|
+
response_type: "code",
|
|
11
|
+
client_id: t,
|
|
12
|
+
redirect_uri: n
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
authenticate: "/bs/loginBy4a",
|
|
16
|
+
...e
|
|
17
|
+
};
|
|
18
18
|
}
|
|
19
|
-
export {
|
|
20
|
-
i as default
|
|
21
|
-
};
|
|
19
|
+
export { FourA as default };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
function Credentials(e) {
|
|
2
|
+
return {
|
|
3
|
+
id: "credentials",
|
|
4
|
+
name: "凭证登录",
|
|
5
|
+
type: "custom",
|
|
6
|
+
...e
|
|
7
|
+
};
|
|
8
8
|
}
|
|
9
|
-
export {
|
|
10
|
-
t as default
|
|
11
|
-
};
|
|
9
|
+
export { Credentials as default };
|
|
@@ -1,49 +1,44 @@
|
|
|
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
|
-
initQRCode: e.mode === "embed" ? o : void 0,
|
|
44
|
-
...e
|
|
45
|
-
};
|
|
1
|
+
function DingZJ(e) {
|
|
2
|
+
let { clientId: t, redirectUri: n } = e;
|
|
3
|
+
return {
|
|
4
|
+
id: "ding-zj",
|
|
5
|
+
name: "浙政钉登录",
|
|
6
|
+
type: "oauth",
|
|
7
|
+
signIn: {
|
|
8
|
+
redirect: {
|
|
9
|
+
url: "https://openplatform-pro.ding.zj.gov.cn/oauth2/auth.htm",
|
|
10
|
+
params: {
|
|
11
|
+
response_type: "code",
|
|
12
|
+
client_id: t,
|
|
13
|
+
redirect_uri: n,
|
|
14
|
+
scope: "get_user_info",
|
|
15
|
+
authType: "QRCODE"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
embed: {
|
|
19
|
+
url: "https://login-pro.ding.zj.gov.cn/oauth2/auth.htm",
|
|
20
|
+
params: {
|
|
21
|
+
response_type: "code",
|
|
22
|
+
client_id: t,
|
|
23
|
+
redirect_uri: n,
|
|
24
|
+
scope: "get_user_info",
|
|
25
|
+
authType: "QRCODE",
|
|
26
|
+
embedMode: "true"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}[e.mode],
|
|
30
|
+
authenticate: "/bs/loginByDingZJ",
|
|
31
|
+
initQRCode: e.mode === "embed" ? (e, t) => {
|
|
32
|
+
if (!document.getElementById(t.id)) throw Error(`未找到id为${t.id}的DOM元素`);
|
|
33
|
+
let n = document.createElement("iframe");
|
|
34
|
+
n.src = e, n.width = "200", n.height = "200", document.appendChild(n), window.addEventListener("message", (e) => {
|
|
35
|
+
if (t.redirectUri) {
|
|
36
|
+
let n = new URL(t.redirectUri);
|
|
37
|
+
n.search = new URLSearchParams(e.data).toString(), window.location.href = n.toString();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
} : void 0,
|
|
41
|
+
...e
|
|
42
|
+
};
|
|
46
43
|
}
|
|
47
|
-
export {
|
|
48
|
-
g as default
|
|
49
|
-
};
|
|
44
|
+
export { DingZJ as default };
|
package/dist/providers/sso.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
)).json(),
|
|
18
|
-
...t
|
|
19
|
-
};
|
|
1
|
+
function Sso(e = {}) {
|
|
2
|
+
let { loginType: t = "defaultOauth2" } = e;
|
|
3
|
+
return {
|
|
4
|
+
id: "sso",
|
|
5
|
+
name: "SSO统一账号登录",
|
|
6
|
+
type: "custom",
|
|
7
|
+
authenticate: async (e, n) => await (await fetch(`${n}/auth/ssoLogin`, {
|
|
8
|
+
headers: { "Content-Type": "application/json" },
|
|
9
|
+
method: "POST",
|
|
10
|
+
body: JSON.stringify({
|
|
11
|
+
...e,
|
|
12
|
+
loginType: t
|
|
13
|
+
})
|
|
14
|
+
})).json(),
|
|
15
|
+
...e
|
|
16
|
+
};
|
|
20
17
|
}
|
|
21
|
-
export {
|
|
22
|
-
o as default
|
|
23
|
-
};
|
|
18
|
+
export { Sso as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo-pr/module-auth",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.189.2",
|
|
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-pr": "0.
|
|
26
|
+
"pubinfo-pr": "0.189.2"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"pubinfo-pr": "0.
|
|
29
|
+
"pubinfo-pr": "0.189.2"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"dev": "pubinfo build --watch",
|