w-web-sso 1.0.0

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.
Files changed (102) hide show
  1. package/.editorconfig +9 -0
  2. package/.eslintignore +3 -0
  3. package/.eslintrc.js +55 -0
  4. package/.github/workflows/ci-test.yml +24 -0
  5. package/.jsdoc +25 -0
  6. package/.vscode/launch.json +20 -0
  7. package/LICENSE +21 -0
  8. package/README.md +25 -0
  9. package/SECURITY.md +5 -0
  10. package/babel.config.js +15 -0
  11. package/dist/css/app.969ad1db.css +1 -0
  12. package/dist/index.tmp +3 -0
  13. package/dist/js/app-legacy.ff64be1c.js +2 -0
  14. package/dist/js/app-legacy.ff64be1c.js.map +1 -0
  15. package/dist/js/app.ff64be1c.js +2 -0
  16. package/dist/js/app.ff64be1c.js.map +1 -0
  17. package/dist/js/chunk-vendors-legacy.0bb7a31b.js +13 -0
  18. package/dist/js/chunk-vendors-legacy.0bb7a31b.js.map +1 -0
  19. package/dist/js/chunk-vendors.0bb7a31b.js +13 -0
  20. package/dist/js/chunk-vendors.0bb7a31b.js.map +1 -0
  21. package/dist/w-web-sso.umd.js +7 -0
  22. package/dist/w-web-sso.umd.js.map +1 -0
  23. package/docs/WWebSso.html +938 -0
  24. package/docs/WWebSso.mjs.html +721 -0
  25. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  26. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  27. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  28. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  29. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  30. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  31. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  32. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  33. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  34. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  35. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  36. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  37. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  38. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  39. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  40. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  41. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  42. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  43. package/docs/index.html +84 -0
  44. package/docs/scripts/collapse.js +39 -0
  45. package/docs/scripts/commonNav.js +28 -0
  46. package/docs/scripts/linenumber.js +25 -0
  47. package/docs/scripts/nav.js +12 -0
  48. package/docs/scripts/polyfill.js +4 -0
  49. package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
  50. package/docs/scripts/prettify/lang-css.js +2 -0
  51. package/docs/scripts/prettify/prettify.js +28 -0
  52. package/docs/scripts/search.js +99 -0
  53. package/docs/styles/jsdoc.css +776 -0
  54. package/docs/styles/prettify.css +80 -0
  55. package/g.backupDb.mjs +10 -0
  56. package/g.getSettings.mjs +17 -0
  57. package/g.initialData.mjs +94 -0
  58. package/g.initialTestData.mjs +21 -0
  59. package/g.mOrm.mjs +24 -0
  60. package/g.provideUsers.mjs +45 -0
  61. package/package.json +70 -0
  62. package/public/index.html +30 -0
  63. package/script.txt +22 -0
  64. package/server/WWebSso.mjs +649 -0
  65. package/server/hashPassword.mjs +27 -0
  66. package/server/proc.mjs +543 -0
  67. package/server/provideUsers.mjs +68 -0
  68. package/src/App.vue +123 -0
  69. package/src/components/Common/CheckYes.vue +85 -0
  70. package/src/components/Common/CheckYesNo.vue +91 -0
  71. package/src/components/Common/LabelItem.vue +106 -0
  72. package/src/components/Common/LoadingWinBar.vue +115 -0
  73. package/src/components/Layout.vue +160 -0
  74. package/src/components/LayoutContent.vue +193 -0
  75. package/src/components/LayoutContentUsers.vue +498 -0
  76. package/src/components/LayoutState.vue +91 -0
  77. package/src/components/PageLogin.vue +524 -0
  78. package/src/components/VeUser.vue +446 -0
  79. package/src/components/ruleGroup.vue +645 -0
  80. package/src/main.js +97 -0
  81. package/src/plugins/mDataSelectorSchema.mjs +30 -0
  82. package/src/plugins/mDataSupport.mjs +23 -0
  83. package/src/plugins/mShare.mjs +229 -0
  84. package/src/plugins/mUI.mjs +229 -0
  85. package/src/schema/gi.mjs +8 -0
  86. package/src/schema/index.mjs +18 -0
  87. package/src/schema/tables/tokens.mjs +70 -0
  88. package/src/schema/tables/users.mjs +110 -0
  89. package/src/store/actions.mjs +1 -0
  90. package/src/store/getters.mjs +1 -0
  91. package/src/store/index.mjs +25 -0
  92. package/src/store/mutations.mjs +333 -0
  93. package/src/store/types.mjs +15 -0
  94. package/srv.mjs +84 -0
  95. package/tableTags-web-sso.json +1 -0
  96. package/test/all.test.mjs +10 -0
  97. package/toolg/addVersion.mjs +4 -0
  98. package/toolg/cleanFolder.mjs +4 -0
  99. package/toolg/gDistRollup.mjs +36 -0
  100. package/toolg/genEntry.mjs +23 -0
  101. package/toolg/modifyReadme.mjs +4 -0
  102. package/vue.config.js +15 -0
@@ -0,0 +1,80 @@
1
+ .pln {
2
+ color: #ddd;
3
+ }
4
+
5
+ /* string content */
6
+ .str {
7
+ color: #61ce3c;
8
+ }
9
+
10
+ /* a keyword */
11
+ .kwd {
12
+ color: #fbde2d;
13
+ }
14
+
15
+ /* a comment */
16
+ .com {
17
+ color: #aeaeae;
18
+ }
19
+
20
+ /* a type name */
21
+ .typ {
22
+ color: #8da6ce;
23
+ }
24
+
25
+ /* a literal value */
26
+ .lit {
27
+ color: #fbde2d;
28
+ }
29
+
30
+ /* punctuation */
31
+ .pun {
32
+ color: #ddd;
33
+ }
34
+
35
+ /* lisp open bracket */
36
+ .opn {
37
+ color: #000000;
38
+ }
39
+
40
+ /* lisp close bracket */
41
+ .clo {
42
+ color: #000000;
43
+ }
44
+
45
+ /* a markup tag name */
46
+ .tag {
47
+ color: #8da6ce;
48
+ }
49
+
50
+ /* a markup attribute name */
51
+ .atn {
52
+ color: #fbde2d;
53
+ }
54
+
55
+ /* a markup attribute value */
56
+ .atv {
57
+ color: #ddd;
58
+ }
59
+
60
+ /* a declaration */
61
+ .dec {
62
+ color: #EF5050;
63
+ }
64
+
65
+ /* a variable name */
66
+ .var {
67
+ color: #c82829;
68
+ }
69
+
70
+ /* a function name */
71
+ .fun {
72
+ color: #4271ae;
73
+ }
74
+
75
+ /* Specify class=linenums on a pre to get line numbering */
76
+ ol.linenums {
77
+ margin-top: 0;
78
+ margin-bottom: 0;
79
+ padding-bottom: 2px;
80
+ }
package/g.backupDb.mjs ADDED
@@ -0,0 +1,10 @@
1
+ import { woItems } from './g.mOrm.mjs'
2
+ import getDb from 'w-serv-orm/src/getDb.mjs'
3
+
4
+
5
+ getDb.backup(woItems)
6
+ // getDb.recover(woItems, './ooo.json')
7
+
8
+
9
+ //備份資料重與由備份資料重建資料庫
10
+ //node --experimental-modules g.backupDb.mjs
@@ -0,0 +1,17 @@
1
+ // import path from 'path'
2
+ // import fs from 'fs'
3
+ // import JSON5 from 'json5'
4
+
5
+
6
+ function getSettings() {
7
+ return {
8
+ 'dbUsername': 'username',
9
+ 'dbPassword': 'password',
10
+ 'dbName': 'wsso',
11
+ 'dbIP': '127.0.0.1',
12
+ 'dbPort': 27017,
13
+ }
14
+ }
15
+
16
+
17
+ export default getSettings
@@ -0,0 +1,94 @@
1
+ import map from 'lodash-es/map.js'
2
+ import ds from './src/schema/index.mjs'
3
+ import hashPassword from './server/hashPassword.mjs'
4
+ import { woItems } from './g.mOrm.mjs'
5
+
6
+
7
+ async function initialData() {
8
+
9
+ let rs = [
10
+ {
11
+ id: 'id-for-Surra',
12
+ account: 'acSurra',
13
+ password: hashPassword('pwSurra', '{salt}'),
14
+ name: 'Surra',
15
+ email: 'Surra@mail.com',
16
+ description: '',
17
+ from: '',
18
+ ruleGroupsIds: 'id-for-viewer',
19
+ redir: 'https://github.com/?token={token}', //給予{token}使前端自動取代成真實token
20
+ isAdmin: 'n',
21
+ },
22
+ {
23
+ id: 'id-for-Irene',
24
+ account: 'acIrene',
25
+ password: hashPassword('pwIrene', '{salt}'),
26
+ name: 'Irene',
27
+ email: 'Irene@mail.com',
28
+ description: '',
29
+ from: '',
30
+ ruleGroupsIds: 'id-for-basic',
31
+ redir: 'https://github.com/?token={token}', //給予{token}使前端自動取代成真實token
32
+ isAdmin: 'n',
33
+ },
34
+ {
35
+ id: 'id-for-Kirk',
36
+ account: 'acKirk',
37
+ password: hashPassword('pwKirk', '{salt}'),
38
+ name: 'Kirk',
39
+ email: 'Kirk@mail.com',
40
+ description: '',
41
+ from: '',
42
+ ruleGroupsIds: 'id-for-admin',
43
+ redir: 'https://github.com/?token={token}', //給予{token}使前端自動取代成真實token
44
+ isAdmin: 'n',
45
+ },
46
+ ]
47
+ rs = map(rs, (u, k) => {
48
+ let v = ds.users.funNew({
49
+ order: k,
50
+ ...u,
51
+ })
52
+ v.id = u.id
53
+ return v
54
+ })
55
+ await woItems.users.delAll()
56
+ await woItems.users.insert(rs)
57
+
58
+ let ts = [
59
+ {
60
+ token: 'token-for-Surra',
61
+ userId: 'id-for-Surra',
62
+ },
63
+ {
64
+ token: 'token-for-Irene',
65
+ userId: 'id-for-Irene',
66
+ },
67
+ {
68
+ token: 'token-for-Kirk',
69
+ userId: 'id-for-Kirk',
70
+ },
71
+ ]
72
+ ts = map(ts, (t, k) => {
73
+ let token = t.token
74
+ let v = ds.tokens.funNew({
75
+ ...t,
76
+ })
77
+ v.id = `id-for-${token}`
78
+ v.token = token
79
+ return v
80
+ })
81
+ await woItems.tokens.delAll()
82
+ await woItems.tokens.insert(ts)
83
+
84
+ console.log('finish.')
85
+ }
86
+
87
+ initialData()
88
+ .catch((err) => {
89
+ console.log('initialData catch', err)
90
+ })
91
+
92
+
93
+ //重建資料庫
94
+ //node --experimental-modules g.initialData.mjs
@@ -0,0 +1,21 @@
1
+ import ds from './src/schema/index.mjs'
2
+ import { woItems } from './g.mOrm.mjs'
3
+ import genTestData from 'w-serv-orm/src/genTestData.mjs'
4
+
5
+
6
+ async function initialTestData() {
7
+
8
+ //genTestData
9
+ await genTestData(ds, woItems)
10
+
11
+ console.log('finish.')
12
+ }
13
+
14
+ initialTestData()
15
+ .catch((err) => {
16
+ console.log('initialTestData catch', err)
17
+ })
18
+
19
+
20
+ //刪除舊檔與重建測試資料庫
21
+ //node --experimental-modules g.initialTestData.mjs
package/g.mOrm.mjs ADDED
@@ -0,0 +1,24 @@
1
+ import WOrm from 'w-orm-mongodb/src/WOrmMongodb.mjs'
2
+ import WServOrm from 'w-serv-orm/src/WServOrm.mjs'
3
+ import ds from './src/schema/index.mjs'
4
+ import getSettings from './g.getSettings.mjs'
5
+
6
+
7
+ //getSettings
8
+ let st = getSettings()
9
+
10
+ //url, db
11
+ let url = `mongodb://${st.dbUsername}:${st.dbPassword}@${st.dbIP}:${st.dbPort}`
12
+ let db = st.dbName
13
+
14
+ //WServOrm
15
+ let opt = {
16
+ getUserById: null,
17
+ bCheckUser: false,
18
+ bExcludeWhenNotAdmin: false,
19
+ }
20
+ let r = WServOrm(ds, WOrm, url, db, opt)
21
+ let { woItems, procOrm } = r
22
+
23
+
24
+ export { woItems, procOrm }
@@ -0,0 +1,45 @@
1
+ import map from 'lodash-es/map.js'
2
+ import ds from './src/schema/index.mjs'
3
+ import provideUsers from './server/provideUsers.mjs'
4
+
5
+
6
+ async function provide() {
7
+
8
+ let url = `http://localhost:11007/syncAndReplaceUsers?token=sys`
9
+
10
+ let from = `pd`
11
+
12
+ let rs = [
13
+ ['pd-viewer', 'pd-普通瀏覽者', 'id-for-pd-權限群組1'],
14
+ ['pd-basic', 'pd-一般使用者', 'id-for-pd-權限群組2'],
15
+ ['pd-admin', 'pd-系統管理者', 'id-for-pd-權限群組3'],
16
+ ]
17
+ rs = map(rs, ([key, name, ruleGroupsIds], k) => {
18
+ let v = ds.users.funNew({
19
+ order: 1000 + k,
20
+ name,
21
+ email: `${key}@example.com`,
22
+ ruleGroupsIds,
23
+ userId: 'id-for-admin',
24
+ from,
25
+ })
26
+ v.id = `id-for-${key}`
27
+ if (key === 'pd-admin') {
28
+ v.isAdmin = 'y'
29
+ }
30
+ return v
31
+ })
32
+ console.log('rs', rs)
33
+
34
+ let r = await provideUsers(url, from, rs)
35
+ console.log('r.msg', r.msg)
36
+
37
+ }
38
+
39
+ provide()
40
+ .catch((err) => {
41
+ console.log('provide catch', err)
42
+ })
43
+
44
+
45
+ //node --experimental-modules g.provideUsers.mjs
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "w-web-sso",
3
+ "version": "1.0.0",
4
+ "main": "dist/w-web-sso.umd.js",
5
+ "dependencies": {
6
+ "@mdi/js": "^7.4.47",
7
+ "axios": "^1.6.8",
8
+ "json5": "^2.2.3",
9
+ "lodash": "^4.17.21",
10
+ "w-component-vue": "^2.3.87",
11
+ "w-data-collector": "^1.0.22",
12
+ "w-serv-hapi": "^1.0.13",
13
+ "w-serv-orm": "^1.0.10",
14
+ "w-ui-loginout": "^1.0.8",
15
+ "wsemi": "^1.7.49"
16
+ },
17
+ "devDependencies": {
18
+ "@vue/cli-plugin-babel": "^5.0.8",
19
+ "@vue/cli-plugin-eslint": "^5.0.8",
20
+ "@vue/cli-service": "^5.0.8",
21
+ "eslint": "^8.37.0",
22
+ "eslint-config-standard": "^17.0.0",
23
+ "eslint-friendly-formatter": "^4.0.1",
24
+ "eslint-plugin-import": "^2.27.5",
25
+ "eslint-plugin-node": "^11.1.0",
26
+ "eslint-plugin-promise": "^6.1.1",
27
+ "eslint-plugin-standard": "^4.1.0",
28
+ "eslint-plugin-vue": "^9.10.0",
29
+ "vue": "^2.6.14",
30
+ "vuex": "^3.6.2",
31
+ "w-orm-mongodb": "^1.1.32",
32
+ "w-package-tools": "^1.0.75"
33
+ },
34
+ "scripts": {
35
+ "serve": "vue-cli-service serve",
36
+ "build": "vue-cli-service build",
37
+ "test": "mocha --parallel --timeout 60000 --experimental-modules",
38
+ "lint": "vue-cli-service lint",
39
+ "deploy": "gh-pages -d docs"
40
+ },
41
+ "eslintConfig": {
42
+ "root": true,
43
+ "env": {
44
+ "node": true
45
+ },
46
+ "extends": [
47
+ "plugin:vue/essential",
48
+ "eslint:recommended"
49
+ ],
50
+ "rules": {},
51
+ "parserOptions": {
52
+ "parser": "babel-eslint"
53
+ }
54
+ },
55
+ "browserslist": [
56
+ "> 1%",
57
+ "last 2 versions"
58
+ ],
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "https://github.com/yuda-lyu/w-web-sso"
62
+ },
63
+ "keywords": [
64
+ "web",
65
+ "service",
66
+ "sso"
67
+ ],
68
+ "author": "yuda-lyu(semisphere)",
69
+ "license": "MIT"
70
+ }
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-tw">
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
7
+ <title></title>
8
+
9
+ <!-- mdi font -->
10
+ <link href="https://cdn.jsdelivr.net/npm/@mdi/font/css/materialdesignicons.min.css" rel="stylesheet">
11
+
12
+ <!-- fontawesome -->
13
+ <link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.2/css/all.min.css" rel="stylesheet">
14
+
15
+ <!-- ___pmwsso___ -->
16
+ <script>
17
+ window.___pmwsso___={
18
+ urlRedirect: '{urlRedirect}',
19
+ }
20
+ </script>
21
+
22
+ </head>
23
+ <body style="font-family:'Microsoft JhengHei','Avenir','Helvetica', 'Arial', 'sans-serif'; padding:0px; margin:0px;">
24
+ <noscript>
25
+ <strong>We're sorry but w-component-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
26
+ </noscript>
27
+ <div id="app"></div>
28
+ <!-- built files will be auto injected -->
29
+ </body>
30
+ </html>
package/script.txt ADDED
@@ -0,0 +1,22 @@
1
+ #node --experimental-modules toolg/addVersion.mjs
2
+ node --experimental-modules toolg/modifyReadme.mjs
3
+
4
+ node --experimental-modules toolg/cleanFolder.mjs
5
+ ./node_modules/.bin/jsdoc -c .jsdoc
6
+
7
+ npm run build
8
+
9
+ node --experimental-modules toolg/genEntry.mjs
10
+
11
+ node --experimental-modules toolg/gDistRollup.mjs
12
+
13
+ git add . -A
14
+ git commit -m 'modify: '
15
+ git push origin master:master
16
+
17
+ npm run deploy
18
+
19
+ #npm test
20
+
21
+ #npm publish
22
+