@tachybase/plugin-auth-oidc 0.23.8
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/.turbo/turbo-build.log +12 -0
- package/README.md +11 -0
- package/README.zh-CN.md +38 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/OIDCButton.d.ts +9 -0
- package/dist/client/Options.d.ts +2 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +3 -0
- package/dist/client/locale/index.d.ts +3 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +34 -0
- package/dist/externalVersion.js +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +40 -0
- package/dist/locale/es-ES.json +25 -0
- package/dist/locale/fr-FR.json +21 -0
- package/dist/locale/ko_KR.json +28 -0
- package/dist/locale/pt-BR.json +21 -0
- package/dist/locale/zh-CN.json +28 -0
- package/dist/node_modules/nanoid/.devcontainer.json +23 -0
- package/dist/node_modules/nanoid/LICENSE +20 -0
- package/dist/node_modules/nanoid/async/index.browser.cjs +69 -0
- package/dist/node_modules/nanoid/async/index.browser.js +69 -0
- package/dist/node_modules/nanoid/async/index.cjs +71 -0
- package/dist/node_modules/nanoid/async/index.d.ts +56 -0
- package/dist/node_modules/nanoid/async/index.js +71 -0
- package/dist/node_modules/nanoid/async/index.native.js +57 -0
- package/dist/node_modules/nanoid/async/package.json +12 -0
- package/dist/node_modules/nanoid/bin/nanoid.cjs +55 -0
- package/dist/node_modules/nanoid/index.browser.cjs +72 -0
- package/dist/node_modules/nanoid/index.browser.js +72 -0
- package/dist/node_modules/nanoid/index.cjs +1 -0
- package/dist/node_modules/nanoid/index.d.cts +91 -0
- package/dist/node_modules/nanoid/index.d.ts +91 -0
- package/dist/node_modules/nanoid/index.js +85 -0
- package/dist/node_modules/nanoid/nanoid.js +1 -0
- package/dist/node_modules/nanoid/non-secure/index.cjs +34 -0
- package/dist/node_modules/nanoid/non-secure/index.d.ts +33 -0
- package/dist/node_modules/nanoid/non-secure/index.js +34 -0
- package/dist/node_modules/nanoid/non-secure/package.json +6 -0
- package/dist/node_modules/nanoid/package.json +1 -0
- package/dist/node_modules/nanoid/url-alphabet/index.cjs +7 -0
- package/dist/node_modules/nanoid/url-alphabet/index.js +7 -0
- package/dist/node_modules/nanoid/url-alphabet/package.json +6 -0
- package/dist/node_modules/openid-client/lib/client.js +1884 -0
- package/dist/node_modules/openid-client/lib/device_flow_handle.js +125 -0
- package/dist/node_modules/openid-client/lib/errors.js +55 -0
- package/dist/node_modules/openid-client/lib/helpers/assert.js +24 -0
- package/dist/node_modules/openid-client/lib/helpers/base64url.js +13 -0
- package/dist/node_modules/openid-client/lib/helpers/client.js +208 -0
- package/dist/node_modules/openid-client/lib/helpers/consts.js +7 -0
- package/dist/node_modules/openid-client/lib/helpers/decode_jwt.js +27 -0
- package/dist/node_modules/openid-client/lib/helpers/deep_clone.js +1 -0
- package/dist/node_modules/openid-client/lib/helpers/defaults.js +27 -0
- package/dist/node_modules/openid-client/lib/helpers/generators.js +14 -0
- package/dist/node_modules/openid-client/lib/helpers/is_key_object.js +4 -0
- package/dist/node_modules/openid-client/lib/helpers/is_plain_object.js +1 -0
- package/dist/node_modules/openid-client/lib/helpers/issuer.js +111 -0
- package/dist/node_modules/openid-client/lib/helpers/keystore.js +298 -0
- package/dist/node_modules/openid-client/lib/helpers/merge.js +24 -0
- package/dist/node_modules/openid-client/lib/helpers/pick.js +9 -0
- package/dist/node_modules/openid-client/lib/helpers/process_response.js +71 -0
- package/dist/node_modules/openid-client/lib/helpers/request.js +200 -0
- package/dist/node_modules/openid-client/lib/helpers/unix_timestamp.js +1 -0
- package/dist/node_modules/openid-client/lib/helpers/weak_cache.js +1 -0
- package/dist/node_modules/openid-client/lib/helpers/webfinger_normalize.js +71 -0
- package/dist/node_modules/openid-client/lib/helpers/www_authenticate_parser.js +14 -0
- package/dist/node_modules/openid-client/lib/index.js +1 -0
- package/dist/node_modules/openid-client/lib/issuer.js +192 -0
- package/dist/node_modules/openid-client/lib/issuer_registry.js +3 -0
- package/dist/node_modules/openid-client/lib/passport_strategy.js +205 -0
- package/dist/node_modules/openid-client/lib/token_set.js +35 -0
- package/dist/node_modules/openid-client/package.json +1 -0
- package/dist/node_modules/openid-client/types/index.d.ts +623 -0
- package/dist/server/actions/getAuthUrl.d.ts +2 -0
- package/dist/server/actions/getAuthUrl.js +47 -0
- package/dist/server/actions/redirect.d.ts +2 -0
- package/dist/server/actions/redirect.js +55 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/migrations/20231007124508-update-autosignup.d.ts +6 -0
- package/dist/server/migrations/20231007124508-update-autosignup.js +52 -0
- package/dist/server/oidc-auth.d.ts +15 -0
- package/dist/server/oidc-auth.js +154 -0
- package/dist/server/plugin.d.ts +11 -0
- package/dist/server/plugin.js +83 -0
- package/dist/swagger/index.d.ts +143 -0
- package/dist/swagger/index.js +178 -0
- package/package.json +37 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import crypto from 'crypto'
|
|
2
|
+
|
|
3
|
+
import { urlAlphabet } from './url-alphabet/index.js'
|
|
4
|
+
|
|
5
|
+
// It is best to make fewer, larger requests to the crypto module to
|
|
6
|
+
// avoid system call overhead. So, random numbers are generated in a
|
|
7
|
+
// pool. The pool is a Buffer that is larger than the initial random
|
|
8
|
+
// request size by this multiplier. The pool is enlarged if subsequent
|
|
9
|
+
// requests exceed the maximum buffer size.
|
|
10
|
+
const POOL_SIZE_MULTIPLIER = 128
|
|
11
|
+
let pool, poolOffset
|
|
12
|
+
|
|
13
|
+
let fillPool = bytes => {
|
|
14
|
+
if (!pool || pool.length < bytes) {
|
|
15
|
+
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER)
|
|
16
|
+
crypto.randomFillSync(pool)
|
|
17
|
+
poolOffset = 0
|
|
18
|
+
} else if (poolOffset + bytes > pool.length) {
|
|
19
|
+
crypto.randomFillSync(pool)
|
|
20
|
+
poolOffset = 0
|
|
21
|
+
}
|
|
22
|
+
poolOffset += bytes
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let random = bytes => {
|
|
26
|
+
// `|=` convert `bytes` to number to prevent `valueOf` abusing and pool pollution
|
|
27
|
+
fillPool((bytes |= 0))
|
|
28
|
+
return pool.subarray(poolOffset - bytes, poolOffset)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
let customRandom = (alphabet, defaultSize, getRandom) => {
|
|
32
|
+
// First, a bitmask is necessary to generate the ID. The bitmask makes bytes
|
|
33
|
+
// values closer to the alphabet size. The bitmask calculates the closest
|
|
34
|
+
// `2^31 - 1` number, which exceeds the alphabet size.
|
|
35
|
+
// For example, the bitmask for the alphabet size 30 is 31 (00011111).
|
|
36
|
+
let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1
|
|
37
|
+
// Though, the bitmask solution is not perfect since the bytes exceeding
|
|
38
|
+
// the alphabet size are refused. Therefore, to reliably generate the ID,
|
|
39
|
+
// the random bytes redundancy has to be satisfied.
|
|
40
|
+
|
|
41
|
+
// Note: every hardware random generator call is performance expensive,
|
|
42
|
+
// because the system call for entropy collection takes a lot of time.
|
|
43
|
+
// So, to avoid additional system calls, extra bytes are requested in advance.
|
|
44
|
+
|
|
45
|
+
// Next, a step determines how many random bytes to generate.
|
|
46
|
+
// The number of random bytes gets decided upon the ID size, mask,
|
|
47
|
+
// alphabet size, and magic number 1.6 (using 1.6 peaks at performance
|
|
48
|
+
// according to benchmarks).
|
|
49
|
+
let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length)
|
|
50
|
+
|
|
51
|
+
return (size = defaultSize) => {
|
|
52
|
+
let id = ''
|
|
53
|
+
while (true) {
|
|
54
|
+
let bytes = getRandom(step)
|
|
55
|
+
// A compact alternative for `for (let i = 0; i < step; i++)`.
|
|
56
|
+
let i = step
|
|
57
|
+
while (i--) {
|
|
58
|
+
// Adding `|| ''` refuses a random byte that exceeds the alphabet size.
|
|
59
|
+
id += alphabet[bytes[i] & mask] || ''
|
|
60
|
+
if (id.length === size) return id
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let customAlphabet = (alphabet, size = 21) =>
|
|
67
|
+
customRandom(alphabet, size, random)
|
|
68
|
+
|
|
69
|
+
let nanoid = (size = 21) => {
|
|
70
|
+
// `|=` convert `size` to number to prevent `valueOf` abusing and pool pollution
|
|
71
|
+
fillPool((size |= 0))
|
|
72
|
+
let id = ''
|
|
73
|
+
// We are reading directly from the random pool to avoid creating new array
|
|
74
|
+
for (let i = poolOffset - size; i < poolOffset; i++) {
|
|
75
|
+
// It is incorrect to use bytes exceeding the alphabet size.
|
|
76
|
+
// The following mask reduces the random byte in the 0-255 value
|
|
77
|
+
// range to the 0-63 value range. Therefore, adding hacks, such
|
|
78
|
+
// as empty string fallback or magic numbers, is unneccessary because
|
|
79
|
+
// the bitmask trims bytes down to the alphabet size.
|
|
80
|
+
id += urlAlphabet[pool[i] & 63]
|
|
81
|
+
}
|
|
82
|
+
return id
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { nanoid, customAlphabet, customRandom, urlAlphabet, random }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),"");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// This alphabet uses `A-Za-z0-9_-` symbols.
|
|
2
|
+
// The order of characters is optimized for better gzip and brotli compression.
|
|
3
|
+
// References to the same file (works both for gzip and brotli):
|
|
4
|
+
// `'use`, `andom`, and `rict'`
|
|
5
|
+
// References to the brotli default dictionary:
|
|
6
|
+
// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
|
|
7
|
+
let urlAlphabet =
|
|
8
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
|
9
|
+
|
|
10
|
+
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
11
|
+
return (size = defaultSize) => {
|
|
12
|
+
let id = ''
|
|
13
|
+
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
14
|
+
let i = size | 0
|
|
15
|
+
while (i--) {
|
|
16
|
+
// `| 0` is more compact and faster than `Math.floor()`.
|
|
17
|
+
id += alphabet[(Math.random() * alphabet.length) | 0]
|
|
18
|
+
}
|
|
19
|
+
return id
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let nanoid = (size = 21) => {
|
|
24
|
+
let id = ''
|
|
25
|
+
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
26
|
+
let i = size | 0
|
|
27
|
+
while (i--) {
|
|
28
|
+
// `| 0` is more compact and faster than `Math.floor()`.
|
|
29
|
+
id += urlAlphabet[(Math.random() * 64) | 0]
|
|
30
|
+
}
|
|
31
|
+
return id
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = { nanoid, customAlphabet }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate URL-friendly unique ID. This method uses the non-secure
|
|
3
|
+
* predictable random generator with bigger collision probability.
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* import { nanoid } from 'nanoid/non-secure'
|
|
7
|
+
* model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @param size Size of the ID. The default size is 21.
|
|
11
|
+
* @returns A random string.
|
|
12
|
+
*/
|
|
13
|
+
export function nanoid(size?: number): string
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Generate a unique ID based on a custom alphabet.
|
|
17
|
+
* This method uses the non-secure predictable random generator
|
|
18
|
+
* with bigger collision probability.
|
|
19
|
+
*
|
|
20
|
+
* @param alphabet Alphabet used to generate the ID.
|
|
21
|
+
* @param defaultSize Size of the ID. The default size is 21.
|
|
22
|
+
* @returns A random string generator.
|
|
23
|
+
*
|
|
24
|
+
* ```js
|
|
25
|
+
* import { customAlphabet } from 'nanoid/non-secure'
|
|
26
|
+
* const nanoid = customAlphabet('0123456789абвгдеё', 5)
|
|
27
|
+
* model.id = //=> "8ё56а"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export function customAlphabet(
|
|
31
|
+
alphabet: string,
|
|
32
|
+
defaultSize?: number
|
|
33
|
+
): (size?: number) => string
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// This alphabet uses `A-Za-z0-9_-` symbols.
|
|
2
|
+
// The order of characters is optimized for better gzip and brotli compression.
|
|
3
|
+
// References to the same file (works both for gzip and brotli):
|
|
4
|
+
// `'use`, `andom`, and `rict'`
|
|
5
|
+
// References to the brotli default dictionary:
|
|
6
|
+
// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
|
|
7
|
+
let urlAlphabet =
|
|
8
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
|
9
|
+
|
|
10
|
+
let customAlphabet = (alphabet, defaultSize = 21) => {
|
|
11
|
+
return (size = defaultSize) => {
|
|
12
|
+
let id = ''
|
|
13
|
+
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
14
|
+
let i = size | 0
|
|
15
|
+
while (i--) {
|
|
16
|
+
// `| 0` is more compact and faster than `Math.floor()`.
|
|
17
|
+
id += alphabet[(Math.random() * alphabet.length) | 0]
|
|
18
|
+
}
|
|
19
|
+
return id
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let nanoid = (size = 21) => {
|
|
24
|
+
let id = ''
|
|
25
|
+
// A compact alternative for `for (var i = 0; i < step; i++)`.
|
|
26
|
+
let i = size | 0
|
|
27
|
+
while (i--) {
|
|
28
|
+
// `| 0` is more compact and faster than `Math.floor()`.
|
|
29
|
+
id += urlAlphabet[(Math.random() * 64) | 0]
|
|
30
|
+
}
|
|
31
|
+
return id
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { nanoid, customAlphabet }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"nanoid","version":"3.3.8","description":"A tiny (116 bytes), secure URL-friendly unique string ID generator","keywords":["uuid","random","id","url"],"engines":{"node":"^10 || ^12 || ^13.7 || ^14 || >=15.0.1"},"funding":[{"type":"github","url":"https://github.com/sponsors/ai"}],"author":"Andrey Sitnik <andrey@sitnik.ru>","license":"MIT","repository":"ai/nanoid","browser":{"./index.js":"./index.browser.js","./async/index.js":"./async/index.browser.js","./async/index.cjs":"./async/index.browser.cjs","./index.cjs":"./index.browser.cjs"},"react-native":"index.js","bin":"./bin/nanoid.cjs","sideEffects":false,"types":"./index.d.ts","type":"module","main":"index.cjs","module":"index.js","exports":{".":{"browser":"./index.browser.js","require":{"types":"./index.d.cts","default":"./index.cjs"},"import":{"types":"./index.d.ts","default":"./index.js"},"default":"./index.js"},"./package.json":"./package.json","./async/package.json":"./async/package.json","./async":{"browser":"./async/index.browser.js","require":{"types":"./index.d.cts","default":"./async/index.cjs"},"import":{"types":"./index.d.ts","default":"./async/index.js"},"default":"./async/index.js"},"./non-secure/package.json":"./non-secure/package.json","./non-secure":{"require":{"types":"./index.d.cts","default":"./non-secure/index.cjs"},"import":{"types":"./index.d.ts","default":"./non-secure/index.js"},"default":"./non-secure/index.js"},"./url-alphabet/package.json":"./url-alphabet/package.json","./url-alphabet":{"require":{"types":"./index.d.cts","default":"./url-alphabet/index.cjs"},"import":{"types":"./index.d.ts","default":"./url-alphabet/index.js"},"default":"./url-alphabet/index.js"}},"_lastModified":"2024-12-22T16:05:42.525Z"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// This alphabet uses `A-Za-z0-9_-` symbols.
|
|
2
|
+
// The order of characters is optimized for better gzip and brotli compression.
|
|
3
|
+
// Same as in non-secure/index.js
|
|
4
|
+
let urlAlphabet =
|
|
5
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
|
6
|
+
|
|
7
|
+
module.exports = { urlAlphabet }
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// This alphabet uses `A-Za-z0-9_-` symbols.
|
|
2
|
+
// The order of characters is optimized for better gzip and brotli compression.
|
|
3
|
+
// Same as in non-secure/index.js
|
|
4
|
+
let urlAlphabet =
|
|
5
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
|
|
6
|
+
|
|
7
|
+
export { urlAlphabet }
|