@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.
Files changed (93) hide show
  1. package/.turbo/turbo-build.log +12 -0
  2. package/README.md +11 -0
  3. package/README.zh-CN.md +38 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/OIDCButton.d.ts +9 -0
  7. package/dist/client/Options.d.ts +2 -0
  8. package/dist/client/index.d.ts +5 -0
  9. package/dist/client/index.js +3 -0
  10. package/dist/client/locale/index.d.ts +3 -0
  11. package/dist/constants.d.ts +3 -0
  12. package/dist/constants.js +34 -0
  13. package/dist/externalVersion.js +14 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.js +39 -0
  16. package/dist/locale/en-US.json +40 -0
  17. package/dist/locale/es-ES.json +25 -0
  18. package/dist/locale/fr-FR.json +21 -0
  19. package/dist/locale/ko_KR.json +28 -0
  20. package/dist/locale/pt-BR.json +21 -0
  21. package/dist/locale/zh-CN.json +28 -0
  22. package/dist/node_modules/nanoid/.devcontainer.json +23 -0
  23. package/dist/node_modules/nanoid/LICENSE +20 -0
  24. package/dist/node_modules/nanoid/async/index.browser.cjs +69 -0
  25. package/dist/node_modules/nanoid/async/index.browser.js +69 -0
  26. package/dist/node_modules/nanoid/async/index.cjs +71 -0
  27. package/dist/node_modules/nanoid/async/index.d.ts +56 -0
  28. package/dist/node_modules/nanoid/async/index.js +71 -0
  29. package/dist/node_modules/nanoid/async/index.native.js +57 -0
  30. package/dist/node_modules/nanoid/async/package.json +12 -0
  31. package/dist/node_modules/nanoid/bin/nanoid.cjs +55 -0
  32. package/dist/node_modules/nanoid/index.browser.cjs +72 -0
  33. package/dist/node_modules/nanoid/index.browser.js +72 -0
  34. package/dist/node_modules/nanoid/index.cjs +1 -0
  35. package/dist/node_modules/nanoid/index.d.cts +91 -0
  36. package/dist/node_modules/nanoid/index.d.ts +91 -0
  37. package/dist/node_modules/nanoid/index.js +85 -0
  38. package/dist/node_modules/nanoid/nanoid.js +1 -0
  39. package/dist/node_modules/nanoid/non-secure/index.cjs +34 -0
  40. package/dist/node_modules/nanoid/non-secure/index.d.ts +33 -0
  41. package/dist/node_modules/nanoid/non-secure/index.js +34 -0
  42. package/dist/node_modules/nanoid/non-secure/package.json +6 -0
  43. package/dist/node_modules/nanoid/package.json +1 -0
  44. package/dist/node_modules/nanoid/url-alphabet/index.cjs +7 -0
  45. package/dist/node_modules/nanoid/url-alphabet/index.js +7 -0
  46. package/dist/node_modules/nanoid/url-alphabet/package.json +6 -0
  47. package/dist/node_modules/openid-client/lib/client.js +1884 -0
  48. package/dist/node_modules/openid-client/lib/device_flow_handle.js +125 -0
  49. package/dist/node_modules/openid-client/lib/errors.js +55 -0
  50. package/dist/node_modules/openid-client/lib/helpers/assert.js +24 -0
  51. package/dist/node_modules/openid-client/lib/helpers/base64url.js +13 -0
  52. package/dist/node_modules/openid-client/lib/helpers/client.js +208 -0
  53. package/dist/node_modules/openid-client/lib/helpers/consts.js +7 -0
  54. package/dist/node_modules/openid-client/lib/helpers/decode_jwt.js +27 -0
  55. package/dist/node_modules/openid-client/lib/helpers/deep_clone.js +1 -0
  56. package/dist/node_modules/openid-client/lib/helpers/defaults.js +27 -0
  57. package/dist/node_modules/openid-client/lib/helpers/generators.js +14 -0
  58. package/dist/node_modules/openid-client/lib/helpers/is_key_object.js +4 -0
  59. package/dist/node_modules/openid-client/lib/helpers/is_plain_object.js +1 -0
  60. package/dist/node_modules/openid-client/lib/helpers/issuer.js +111 -0
  61. package/dist/node_modules/openid-client/lib/helpers/keystore.js +298 -0
  62. package/dist/node_modules/openid-client/lib/helpers/merge.js +24 -0
  63. package/dist/node_modules/openid-client/lib/helpers/pick.js +9 -0
  64. package/dist/node_modules/openid-client/lib/helpers/process_response.js +71 -0
  65. package/dist/node_modules/openid-client/lib/helpers/request.js +200 -0
  66. package/dist/node_modules/openid-client/lib/helpers/unix_timestamp.js +1 -0
  67. package/dist/node_modules/openid-client/lib/helpers/weak_cache.js +1 -0
  68. package/dist/node_modules/openid-client/lib/helpers/webfinger_normalize.js +71 -0
  69. package/dist/node_modules/openid-client/lib/helpers/www_authenticate_parser.js +14 -0
  70. package/dist/node_modules/openid-client/lib/index.js +1 -0
  71. package/dist/node_modules/openid-client/lib/issuer.js +192 -0
  72. package/dist/node_modules/openid-client/lib/issuer_registry.js +3 -0
  73. package/dist/node_modules/openid-client/lib/passport_strategy.js +205 -0
  74. package/dist/node_modules/openid-client/lib/token_set.js +35 -0
  75. package/dist/node_modules/openid-client/package.json +1 -0
  76. package/dist/node_modules/openid-client/types/index.d.ts +623 -0
  77. package/dist/server/actions/getAuthUrl.d.ts +2 -0
  78. package/dist/server/actions/getAuthUrl.js +47 -0
  79. package/dist/server/actions/redirect.d.ts +2 -0
  80. package/dist/server/actions/redirect.js +55 -0
  81. package/dist/server/index.d.ts +1 -0
  82. package/dist/server/index.js +33 -0
  83. package/dist/server/migrations/20231007124508-update-autosignup.d.ts +6 -0
  84. package/dist/server/migrations/20231007124508-update-autosignup.js +52 -0
  85. package/dist/server/oidc-auth.d.ts +15 -0
  86. package/dist/server/oidc-auth.js +154 -0
  87. package/dist/server/plugin.d.ts +11 -0
  88. package/dist/server/plugin.js +83 -0
  89. package/dist/swagger/index.d.ts +143 -0
  90. package/dist/swagger/index.js +178 -0
  91. package/package.json +37 -0
  92. package/server.d.ts +2 -0
  93. package/server.js +1 -0
@@ -0,0 +1,12 @@
1
+
2
+ 
3
+ > @tachybase/plugin-auth-oidc@0.23.2 build /Users/seal/Documents/projects/tachybase/packages/plugin-auth-oidc
4
+ > tachybase-build --no-dts @tachybase/plugin-auth-oidc
5
+
6
+ The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
7
+ @tachybase/plugin-auth-oidc: plugin-auth-oidc build start
8
+ @tachybase/plugin-auth-oidc: build plugin client
9
+ @tachybase/plugin-auth-oidc: build plugin server source
10
+ @tachybase/plugin-auth-oidc: delete server files
11
+ @tachybase/plugin-auth-oidc: build plugin server dependencies
12
+ @tachybase/plugin-auth-oidc: These packages openid-client, nanoid will be bundled to dist/node_modules. These packages @tachybase/auth, @tachybase/module-auth, @tachybase/server, @tachybase/actions will be exclude.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # oidc
2
+
3
+ English | [中文](./README.zh-CN.md)
4
+
5
+ ## 安装激活
6
+
7
+ ```bash
8
+ yarn pm enable oidc
9
+ ```
10
+
11
+ ## 使用方法
@@ -0,0 +1,38 @@
1
+ # OIDC
2
+ 提供标准Open ConnectID接入登录功能。
3
+ 本插件登录流程使用**授权码模式 (Authorization Code Flow)**.
4
+
5
+ ## 依赖
6
+ - `@tachybase/module-auth` 提供表,模型函数复用等
7
+
8
+ ## 使用方法
9
+ > 以Sign in with Google为例
10
+ > https://developers.google.com/identity/openid-connect/openid-connect
11
+
12
+ ### 获取Google OAuth 2.0凭据
13
+ [Google Cloud控制台](https://console.cloud.google.com/apis/credentials) - 创建凭据 - OAuth客户端ID
14
+
15
+ <img src="https://s2.loli.net/2023/06/19/8KPGut6noqgBlDL.png"/>
16
+
17
+ 进入到配置界面,填写**授权重定向URL**. 重定向URL可以在Tachybase,新增认证器时获取,通常情况下为`http(s)://host:port/api/oidc:redirect`.
18
+
19
+ <img src="https://s2.loli.net/2023/06/19/cB1Mv3SAOa7H6Vb.png"/>
20
+
21
+ 完成后复制**客户端ID**和**客户端密钥**。
22
+
23
+ ### 在TachyBase上新增认证器
24
+ 插件设置 - 认证 - 新增 - OIDC
25
+
26
+ <img src="https://s2.loli.net/2023/06/19/sBMURatC372GyEd.png"/>
27
+ 依次填写
28
+
29
+ - Issuer - issuer由IdP提供,通常以`/.well-known/openid-configuration`结尾,Google的为[https://accounts.google.com/.well-known/openid-configuration](https://accounts.google.com/.well-known/openid-configuration)
30
+ - Client ID - 客户端ID
31
+ - Client Secret - 客户端密钥
32
+ - scope - 选填,默认为openid email profile
33
+ - id_token signed response algorithm - id_token的签名方法,默认为RS256
34
+ - HTTP - 回调地址是否为http协议,默认https
35
+ - Port - 回调地址端口,默认为443/80
36
+ - Field Map - 如果需要将用户相关字段映射,可以在这里配置,默认昵称为openid.
37
+
38
+ 在有email的情况下,登录时将尝试匹配已有用户,否则创建新用户。
package/client.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client';
2
+ export { default } from './dist/client';
package/client.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client/index.js');
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Authenticator } from '@tachybase/module-auth/client';
3
+ export interface OIDCProvider {
4
+ clientId: string;
5
+ title: string;
6
+ }
7
+ export declare const OIDCButton: ({ authenticator }: {
8
+ authenticator: Authenticator;
9
+ }) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Options: () => React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@tachybase/client';
2
+ export declare class OidcPlugin extends Plugin {
3
+ load(): Promise<void>;
4
+ }
5
+ export default OidcPlugin;
@@ -0,0 +1,3 @@
1
+ (function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("@tachybase/client"),require("@tachybase/module-auth/client"),require("react/jsx-runtime"),require("react"),require("@ant-design/icons"),require("antd"),require("react-router-dom"),require("react-i18next"),require("@tachybase/components"),require("@tachybase/schema")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","@tachybase/module-auth/client","react/jsx-runtime","react","@ant-design/icons","antd","react-router-dom","react-i18next","@tachybase/components","@tachybase/schema"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e["@tachybase/plugin-auth-oidc"]={},e["@tachybase/client"],e["@tachybase/module-auth"],e.jsxRuntime,e.react,e["@ant-design/icons"],e.antd,e["react-router-dom"],e["react-i18next"],e["@tachybase/components"],e["@tachybase/schema"]))})(this,function(e,o,l,a,u,x,c,h,n,m,P){"use strict";var v=(e,o,l)=>new Promise((a,u)=>{var x=n=>{try{h(l.next(n))}catch(m){u(m)}},c=n=>{try{h(l.throw(n))}catch(m){u(m)}},h=n=>n.done?a(n.value):Promise.resolve(n.value).then(x,c);h((l=l.apply(e,o)).next())});const k="OIDC",f="oidc";function t(r){return o.i18n.t(r,{ns:f})}function S(){return n.useTranslation(f)}const C=({authenticator:r})=>{const{t:d}=S(),b=o.useAPIClient(),I=h.useLocation(),i=new URLSearchParams(I.search),y=i.get("redirect"),g=()=>v(this,null,function*(){var F;const s=yield b.request({method:"post",url:"oidc:getAuthUrl",headers:{"X-Authenticator":r.name},data:{redirect:y}}),p=(F=s==null?void 0:s.data)==null?void 0:F.data;window.location.replace(p)});return u.useEffect(()=>{const s=i.get("authenticator"),p=i.get("error");if(s===r.name&&p){c.message.error(d(p));return}}),a.jsx(c.Space,{direction:"vertical",className:o.css`
2
+ display: flex;
3
+ `,children:a.jsx(c.Button,{shape:"round",block:!0,icon:a.jsx(x.LoginOutlined,{}),onClick:g,children:d(r.title)})})},A={type:"object",properties:{public:{type:"object",properties:{autoSignup:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Sign up automatically when the user does not exist")}}',"x-component":"Checkbox",default:!0}}},oidc:{type:"object",properties:{collapse:{type:"void","x-component":"FormTab",properties:{basic:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:t("Basic configuration")},properties:{issuer:{type:"string",title:'{{t("Issuer")}}',"x-component":"Input","x-decorator":"FormItem",required:!0},clientId:{type:"string",title:'{{t("Client ID")}}',"x-component":"Input","x-decorator":"FormItem",required:!0},clientSecret:{type:"string",title:'{{t("Client Secret")}}',"x-component":"Input","x-decorator":"FormItem",required:!0},scope:{type:"string",title:'{{t("scope")}}',"x-component":"Input","x-decorator":"FormItem","x-decorator-props":{tooltip:'{{t("Default: openid profile email")}}'}},idTokenSignedResponseAlg:{type:"string",title:'{{t("id_token signed response algorithm")}}',"x-component":"Select","x-decorator":"FormItem",enum:[{label:"HS256",value:"HS256"},{label:"HS384",value:"HS384"},{label:"HS512",value:"HS512"},{label:"RS256",value:"RS256"},{label:"RS384",value:"RS384"},{label:"RS512",value:"RS512"},{label:"ES256",value:"ES256"},{label:"ES384",value:"ES384"},{label:"ES512",value:"ES512"},{label:"PS256",value:"PS256"},{label:"PS384",value:"PS384"},{label:"PS512",value:"PS512"}]}}},mapping:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:t("Field mapping")},properties:{fieldMap:{title:'{{t("Field Map")}}',type:"array","x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object","x-decorator":"ArrayItems.Item",properties:{space:{type:"void","x-component":"Space",properties:{source:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("source")}}'}},target:{type:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{placeholder:'{{t("target")}}'},enum:[{label:t("Nickname"),value:"nickname"},{label:t("Email"),value:"email"},{label:t("Phone"),value:"phone"},{label:t("Username"),value:"username"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:"Add","x-component":"ArrayItems.Addition"}}},userBindField:{type:"string",title:'{{t("Use this field to bind the user")}}',"x-component":"Select","x-decorator":"FormItem",default:"email",enum:[{label:t("Email"),value:"email"},{label:t("Username"),value:"username"}],required:!0}}},advanced:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:t("Advanced configuration")},properties:{http:{type:"boolean",title:'{{t("HTTP")}}',"x-component":"Checkbox","x-decorator":"FormItem","x-decorator-props":{tooltip:'{{t("Check if TachyBase is running on HTTP protocol")}}'}},port:{type:"number",title:'{{t("Port")}}',"x-component":"InputNumber","x-decorator":"FormItem","x-decorator-props":{tooltip:'{{t("The port number of the TachyBase service if it is not 80 or 443")}}'},"x-component-props":{style:{width:"15%",minWidth:"100px"}}},stateToken:{type:"string",title:'{{t("State token")}}',"x-component":"Input","x-decorator":"FormItem",description:t("The state token helps prevent CSRF attacks. It's recommended to leave it blank for automatic random generation.")},exchangeBodyKeys:{type:"array",title:'{{t("Pass parameters in the authorization code grant exchange")}}',"x-decorator":"FormItem","x-component":"ArrayItems",default:[{paramName:"",optionsKey:"clientId"},{paramName:"",optionsKey:"clientSecret"}],items:{type:"object","x-decorator":"ArrayItems.Item",properties:{space:{type:"void","x-component":"Space",properties:{enabled:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox"},optionsKey:{type:"string","x-decorator":"FormItem","x-decorator-props":{style:{width:"100px"}},"x-component":"Select","x-read-pretty":!0,enum:[{label:t("Client ID"),value:"clientId"},{label:t("Client Secret"),value:"clientSecret"}]},paramName:{type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:'{{t("Parameter name")}}'}}}}}}},userInfoMethod:{type:"string",title:'{{t("Method to call the user info endpoint")}}',"x- decorator":"FormItem","x-component":"Radio.Group",default:"GET",enum:[{label:"GET",value:"GET"},{label:"POST",value:"POST"}],"x-reactions":[{dependencies:[".accessTokenVia"],when:'{{$deps[0] === "query"}}',fulfill:{state:{value:"GET"}}},{dependencies:[".accessTokenVia"],when:'{{$deps[0] === "body"}}',fulfill:{state:{value:"POST"}}}]},accessTokenVia:{type:"string",title:'{{t("Where to put the access token when calling the user info endpoint")}}',"x- decorator":"FormItem","x-component":"Radio.Group",default:"header",enum:[{label:t("Header"),value:"header"},{label:t("Body (Use with POST method)"),value:"body"},{label:t("Query parameters (Use with GET method)"),value:"query"}]}}}}}}},usage:{type:"void","x-component":"Usage"}}},q=P.observer(()=>{const{t:r}=S(),d=o.useApp(),b=u.useMemo(()=>{var p;const i=d.getOptions(),y=(p=i==null?void 0:i.apiClient)==null?void 0:p.baseURL,{protocol:g,host:s}=window.location;return y.startsWith("http")?`${y}oidc:redirect`:`${g}//${s}${y}oidc:redirect`},[d]),I=i=>{navigator.clipboard.writeText(i),c.message.success(r("Copied"))};return a.jsx(c.Card,{title:r("Usage"),type:"inner",children:a.jsx(o.FormItem,{label:r("Redirect URL"),children:a.jsx(o.Input,{value:b,disabled:!0,addonBefore:a.jsx(x.CopyOutlined,{onClick:()=>I(b)})})})})},{displayName:"Usage"}),E=()=>{const{t:r}=S();return a.jsx(o.SchemaComponent,{scope:{t:r},components:{Usage:q,ArrayItems:m.ArrayItems,Space:c.Space,FormTab:m.FormTab},schema:A})};class T extends o.Plugin{load(){return v(this,null,function*(){this.app.pm.get(l).registerType(k,{components:{SignInButton:C,AdminSettingsForm:E}})})}}e.OidcPlugin=T,e.default=T,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,3 @@
1
+ export declare const NAMESPACE = "oidc";
2
+ export declare function lang(key: string): string;
3
+ export declare function useOidcTranslation(): import("react-i18next").UseTranslationResponse<"oidc", undefined>;
@@ -0,0 +1,3 @@
1
+ export declare const authType = "OIDC";
2
+ export declare const cookieName = "tachybase_oidc";
3
+ export declare const namespace: string;
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name2 in all)
7
+ __defProp(target, name2, { get: all[name2], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var constants_exports = {};
19
+ __export(constants_exports, {
20
+ authType: () => authType,
21
+ cookieName: () => cookieName,
22
+ namespace: () => namespace
23
+ });
24
+ module.exports = __toCommonJS(constants_exports);
25
+ var import_package = require("../package.json");
26
+ const authType = "OIDC";
27
+ const cookieName = "tachybase_oidc";
28
+ const namespace = import_package.name;
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ authType,
32
+ cookieName,
33
+ namespace
34
+ });
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ "react": "18.3.1",
3
+ "@tachybase/client": "0.23.8",
4
+ "@tachybase/module-auth": "0.23.8",
5
+ "@ant-design/icons": "5.3.7",
6
+ "antd": "5.22.5",
7
+ "react-router-dom": "6.28.1",
8
+ "@tachybase/components": "0.23.8",
9
+ "@tachybase/schema": "0.23.8",
10
+ "@tachybase/auth": "0.23.8",
11
+ "@tachybase/server": "0.23.8",
12
+ "react-i18next": "15.2.0",
13
+ "@tachybase/actions": "0.23.8"
14
+ };
@@ -0,0 +1,2 @@
1
+ export * from './server';
2
+ export { default } from './server';
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var src_exports = {};
30
+ __export(src_exports, {
31
+ default: () => import_server.default
32
+ });
33
+ module.exports = __toCommonJS(src_exports);
34
+ __reExport(src_exports, require("./server"), module.exports);
35
+ var import_server = __toESM(require("./server"));
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ ...require("./server")
39
+ });
@@ -0,0 +1,40 @@
1
+ {
2
+ "Access token endpoint": "Access token endpoint",
3
+ "Add provider": "Add",
4
+ "Advanced configuration": "Advanced configuration",
5
+ "Authorization endpoint": "Authorization endpoint",
6
+ "Basic configuration": "Basic configuration",
7
+ "Body (Use with POST method)": "Body (Use with POST method)",
8
+ "Check if TachyBase is running on HTTP protocol": "Check if TachyBase is running on HTTP protocol",
9
+ "Client id": "Client id",
10
+ "Client secret": "Client secret",
11
+ "Delete provider": "Delete",
12
+ "Edit provider": "Edit",
13
+ "Enable": "Enable",
14
+ "Field mapping": "Field mapping",
15
+ "Header": "Header",
16
+ "Id token sign alg": "Id token sign alg",
17
+ "Issuer": "Issuer",
18
+ "JWKS endpoint": "JWKS endpoint",
19
+ "Logout endpoint": "Logout endpoint",
20
+ "Method to call the user info endpoint": "Method to call the user info endpoint",
21
+ "OIDC Providers": "OIDC Providers",
22
+ "OIDC manager": "OIDC manager",
23
+ "Openid configuration": "Openid configuration",
24
+ "Parameter name": "Parameter name",
25
+ "Pass parameters in the authorization code grant exchange": "Pass parameters in the authorization code grant exchange",
26
+ "Provider name": "Name",
27
+ "Query parameters (Use with GET method)": "Query parameters (Use with GET method)",
28
+ "Redirect URL": "Redirect URL",
29
+ "Redirect url": "Redirect url",
30
+ "Sign in button name, which will be displayed on the sign in page": "Sign in button name, which will be displayed on the sign in page",
31
+ "Sign up automatically when the user does not exist": "Sign up automatically when the user does not exist",
32
+ "The port number of the TachyBase service if it is not 80 or 443": "The port number of the TachyBase service if it is not 80 or 443",
33
+ "The state token helps prevent CSRF attacks. It's recommended to leave it blank for automatic random generation.": "The state token helps prevent CSRF attacks. It's recommended to leave it blank for automatic random generation.",
34
+ "Usage": "Usage",
35
+ "Use this field to bind the user": "Use this field to bind the user",
36
+ "User not found": "User not found",
37
+ "Userinfo endpoint": "Userinfo endpoint",
38
+ "Username must be 2-16 characters in length (excluding @.<>\"'/)": "Username must be 2-16 characters in length (excluding @.<>\"'/)",
39
+ "Where to put the access token when calling the user info endpoint": "Where to put the access token when calling the user info endpoint"
40
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "Access token endpoint": "Endpoint de token de acceso",
3
+ "Actions": "Acciones",
4
+ "Add provider": "Añadir Proveedor",
5
+ "Authorization endpoint": "Endpoint de autorización ",
6
+ "Button title": "Título del botón",
7
+ "Client id": "Id de cliente",
8
+ "Client secret": "Secreto del cliente",
9
+ "Delete": "Borrar",
10
+ "Delete provider": "Borrar Proveedor",
11
+ "Edit": "Editar",
12
+ "Edit provider": "Editar Proveedor",
13
+ "Enable": "Activar",
14
+ "Id token sign alg": "Id token sign alg",
15
+ "Issuer": "Emisor",
16
+ "JWKS endpoint": "Endpoint de JWKS",
17
+ "Logout endpoint": "Endpoint de cierre de sesión",
18
+ "OIDC Providers": "Proveedores OIDC",
19
+ "OIDC manager": "Gestor OIDC",
20
+ "Openid configuration": "Configuración Openid",
21
+ "Provider name": "Nombre",
22
+ "Redirect url": "Redirect url",
23
+ "Sign in button name, which will be displayed on the sign in page": "Nombre del botón de inicio de sesión, que se mostrará en la página de inicio de sesión",
24
+ "Userinfo endpoint": "Userinfo endpoint"
25
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "Access token endpoint": "Access token endpoint",
3
+ "Add provider": "Ajouter",
4
+ "Authorization endpoint": "Authorization endpoint",
5
+ "Client id": "Client id",
6
+ "Client secret": "Client secret",
7
+ "Delete provider": "Supprimer",
8
+ "Edit provider": "Modifier",
9
+ "Enable": "Activer",
10
+ "Id token sign alg": "Id token sign alg",
11
+ "Issuer": "Issuer",
12
+ "JWKS endpoint": "JWKS endpoint",
13
+ "Logout endpoint": "Logout endpoint",
14
+ "OIDC Providers": "OIDC Providers",
15
+ "OIDC manager": "OIDC manager",
16
+ "Openid configuration": "Openid configuration",
17
+ "Provider name": "Nom",
18
+ "Redirect url": "Redirect url",
19
+ "Sign in button name, which will be displayed on the sign in page": "Nom du bouton de connexion, qui sera affiché sur la page de connexion",
20
+ "Userinfo endpoint": "Userinfo endpoint"
21
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "Actions": "작업",
3
+ "Advanced configuration": "고급 설정",
4
+ "Basic configuration": "기본 설정",
5
+ "Body (Use with POST method)": "바디 (POST 방식과 함께 사용)",
6
+ "Check if TachyBase is running on HTTP protocol": "TachyBase가 HTTP 프로토콜에서 실행 중인지 확인",
7
+ "Copied": "복사됨",
8
+ "Delete": "삭제",
9
+ "Edit": "편집",
10
+ "Enable": "활성화",
11
+ "Field Map": "필드 매핑",
12
+ "Field mapping": "필드 매핑",
13
+ "Header": "헤더 (기본값)",
14
+ "Method to call the user info endpoint": "사용자 정보 엔드포인트를 호출하는 방법",
15
+ "Parameter name": "매개 변수 이름",
16
+ "Pass parameters in the authorization code grant exchange": "권한 부여 코드 교환 중에 매개 변수를 전달",
17
+ "Query parameters (Use with GET method)": "쿼리 매개 변수 (GET 방식과 함께 사용)",
18
+ "Redirect URL": "리디렉션 URL",
19
+ "Sign up automatically when the user does not exist": "사용자가 존재하지 않을 때 자동으로 가입",
20
+ "The port number of the TachyBase service if it is not 80 or 443": "TachyBase 서비스의 포트 번호, 기본값은 443/80",
21
+ "The state token helps prevent CSRF attacks. It's recommended to leave it blank for automatic random generation.": "상태 토큰은 CSRF 공격을 방지하는 데 도움이 됩니다. 자동으로 무작위로 생성하려면 비워 두는 것이 좋습니다.",
22
+ "Usage": "사용 방법",
23
+ "Use this field to bind the user": "이 필드를 사용하여 사용자를 바인딩합니다",
24
+ "User not found": "사용자를 찾을 수 없음",
25
+ "Username must be 2-16 characters in length (excluding @.<>\"'/)": "사용자 이름은 2-16 자여야합니다 (@.<>\"'/ 제외)",
26
+ "Where to put the access token when calling the user info endpoint": "사용자 정보 엔드포인트를 호출할 때 access_token을 어디에 두어야 하는지",
27
+ "id_token signed response algorithm": "id_token 서명 응답 알고리즘"
28
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "Access token endpoint": "Endpoint de token de acesso",
3
+ "Add provider": "Adicionar",
4
+ "Authorization endpoint": "Endpoint de autorização",
5
+ "Client id": "ID do cliente",
6
+ "Client secret": "Segredo do cliente",
7
+ "Delete provider": "Excluir",
8
+ "Edit provider": "Editar",
9
+ "Enable": "Habilitar",
10
+ "Id token sign alg": "Algoritmo de assinatura do token de ID",
11
+ "Issuer": "Emissor",
12
+ "JWKS endpoint": "Endpoint JWKS",
13
+ "Logout endpoint": "Endpoint de logout",
14
+ "OIDC Providers": "Provedores OIDC",
15
+ "OIDC manager": "Gerenciador OIDC",
16
+ "Openid configuration": "Configuração OpenID",
17
+ "Provider name": "Nome do provedor",
18
+ "Redirect url": "URL de redirecionamento",
19
+ "Sign in button name, which will be displayed on the sign in page": "Nome do botão de login, que será exibido na página de login",
20
+ "Userinfo endpoint": "Endpoint de informações do usuário"
21
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "Actions": "操作",
3
+ "Advanced configuration": "高级配置",
4
+ "Basic configuration": "基础配置",
5
+ "Body (Use with POST method)": "请求体(Body, 配合 POST 方法使用)",
6
+ "Check if TachyBase is running on HTTP protocol": "TachyBase 应用为HTTP协议时勾选",
7
+ "Copied": "已复制",
8
+ "Delete": "删除",
9
+ "Edit": "编辑",
10
+ "Enable": "启用",
11
+ "Field Map": "字段映射",
12
+ "Field mapping": "字段映射",
13
+ "Header": "请求头 (Header, 默认)",
14
+ "Method to call the user info endpoint": "访问获取用户信息的 API 的 HTTP 方法",
15
+ "Parameter name": "参数名",
16
+ "Pass parameters in the authorization code grant exchange": "使用 code 交换 token 时需要传递的参数",
17
+ "Query parameters (Use with GET method)": "请求 URL 参数(Query, 配合 GET 方法使用)",
18
+ "Redirect URL": "回调 URL",
19
+ "Sign up automatically when the user does not exist": "用户不存在时自动注册",
20
+ "The port number of the TachyBase service if it is not 80 or 443": "TachyBase 应用端口,默认 443/80",
21
+ "The state token helps prevent CSRF attacks. It's recommended to leave it blank for automatic random generation.": "state token 用于防止 CSRF 攻击,建议留空使用自动生成的随机值。",
22
+ "Usage": "使用",
23
+ "Use this field to bind the user": "使用此字段绑定用户",
24
+ "User not found": "用户不存在",
25
+ "Username must be 2-16 characters in length (excluding @.<>\"'/)": "用户名必须为2-16个字符并且不包含@.<>\"'/)",
26
+ "Where to put the access token when calling the user info endpoint": "访问获取用户信息的 API 时 access_token 的传递方式",
27
+ "id_token signed response algorithm": "id_token签名算法"
28
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "image": "localhost/ai-opensource:latest",
3
+ "forwardPorts": [],
4
+ "mounts": [
5
+ {
6
+ "source": "pnpm-store",
7
+ "target": "/home/ai/.local/share/pnpm/store",
8
+ "type": "volume"
9
+ },
10
+ {
11
+ "source": "shell-history",
12
+ "target": "/home/ai/.local/share/history/",
13
+ "type": "volume"
14
+ }
15
+ ],
16
+ "workspaceMount": "",
17
+ "runArgs": [
18
+ "--userns=keep-id:uid=1000,gid=1000",
19
+ "--volume=${localWorkspaceFolder}:/workspaces/${localWorkspaceFolderBasename}:Z",
20
+ "--network=host",
21
+ "--ulimit=host"
22
+ ]
23
+ }
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright 2017 Andrey Sitnik <andrey@sitnik.ru>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,69 @@
1
+ let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
2
+
3
+ let customAlphabet = (alphabet, defaultSize = 21) => {
4
+ // First, a bitmask is necessary to generate the ID. The bitmask makes bytes
5
+ // values closer to the alphabet size. The bitmask calculates the closest
6
+ // `2^31 - 1` number, which exceeds the alphabet size.
7
+ // For example, the bitmask for the alphabet size 30 is 31 (00011111).
8
+ // `Math.clz32` is not used, because it is not available in browsers.
9
+ let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
10
+ // Though, the bitmask solution is not perfect since the bytes exceeding
11
+ // the alphabet size are refused. Therefore, to reliably generate the ID,
12
+ // the random bytes redundancy has to be satisfied.
13
+
14
+ // Note: every hardware random generator call is performance expensive,
15
+ // because the system call for entropy collection takes a lot of time.
16
+ // So, to avoid additional system calls, extra bytes are requested in advance.
17
+
18
+ // Next, a step determines how many random bytes to generate.
19
+ // The number of random bytes gets decided upon the ID size, mask,
20
+ // alphabet size, and magic number 1.6 (using 1.6 peaks at performance
21
+ // according to benchmarks).
22
+
23
+ // `-~f => Math.ceil(f)` if f is a float
24
+ // `-~i => i + 1` if i is an integer
25
+ let step = -~((1.6 * mask * defaultSize) / alphabet.length)
26
+
27
+ return async (size = defaultSize) => {
28
+ let id = ''
29
+ while (true) {
30
+ let bytes = crypto.getRandomValues(new Uint8Array(step))
31
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
32
+ let i = step | 0
33
+ while (i--) {
34
+ // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
35
+ id += alphabet[bytes[i] & mask] || ''
36
+ if (id.length === size) return id
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ let nanoid = async (size = 21) => {
43
+ let id = ''
44
+ let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))
45
+
46
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
47
+ while (size--) {
48
+ // It is incorrect to use bytes exceeding the alphabet size.
49
+ // The following mask reduces the random byte in the 0-255 value
50
+ // range to the 0-63 value range. Therefore, adding hacks, such
51
+ // as empty string fallback or magic numbers, is unneccessary because
52
+ // the bitmask trims bytes down to the alphabet size.
53
+ let byte = bytes[size] & 63
54
+ if (byte < 36) {
55
+ // `0-9a-z`
56
+ id += byte.toString(36)
57
+ } else if (byte < 62) {
58
+ // `A-Z`
59
+ id += (byte - 26).toString(36).toUpperCase()
60
+ } else if (byte < 63) {
61
+ id += '_'
62
+ } else {
63
+ id += '-'
64
+ }
65
+ }
66
+ return id
67
+ }
68
+
69
+ module.exports = { nanoid, customAlphabet, random }
@@ -0,0 +1,69 @@
1
+ let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes))
2
+
3
+ let customAlphabet = (alphabet, defaultSize = 21) => {
4
+ // First, a bitmask is necessary to generate the ID. The bitmask makes bytes
5
+ // values closer to the alphabet size. The bitmask calculates the closest
6
+ // `2^31 - 1` number, which exceeds the alphabet size.
7
+ // For example, the bitmask for the alphabet size 30 is 31 (00011111).
8
+ // `Math.clz32` is not used, because it is not available in browsers.
9
+ let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1
10
+ // Though, the bitmask solution is not perfect since the bytes exceeding
11
+ // the alphabet size are refused. Therefore, to reliably generate the ID,
12
+ // the random bytes redundancy has to be satisfied.
13
+
14
+ // Note: every hardware random generator call is performance expensive,
15
+ // because the system call for entropy collection takes a lot of time.
16
+ // So, to avoid additional system calls, extra bytes are requested in advance.
17
+
18
+ // Next, a step determines how many random bytes to generate.
19
+ // The number of random bytes gets decided upon the ID size, mask,
20
+ // alphabet size, and magic number 1.6 (using 1.6 peaks at performance
21
+ // according to benchmarks).
22
+
23
+ // `-~f => Math.ceil(f)` if f is a float
24
+ // `-~i => i + 1` if i is an integer
25
+ let step = -~((1.6 * mask * defaultSize) / alphabet.length)
26
+
27
+ return async (size = defaultSize) => {
28
+ let id = ''
29
+ while (true) {
30
+ let bytes = crypto.getRandomValues(new Uint8Array(step))
31
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
32
+ let i = step | 0
33
+ while (i--) {
34
+ // Adding `|| ''` refuses a random byte that exceeds the alphabet size.
35
+ id += alphabet[bytes[i] & mask] || ''
36
+ if (id.length === size) return id
37
+ }
38
+ }
39
+ }
40
+ }
41
+
42
+ let nanoid = async (size = 21) => {
43
+ let id = ''
44
+ let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))
45
+
46
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
47
+ while (size--) {
48
+ // It is incorrect to use bytes exceeding the alphabet size.
49
+ // The following mask reduces the random byte in the 0-255 value
50
+ // range to the 0-63 value range. Therefore, adding hacks, such
51
+ // as empty string fallback or magic numbers, is unneccessary because
52
+ // the bitmask trims bytes down to the alphabet size.
53
+ let byte = bytes[size] & 63
54
+ if (byte < 36) {
55
+ // `0-9a-z`
56
+ id += byte.toString(36)
57
+ } else if (byte < 62) {
58
+ // `A-Z`
59
+ id += (byte - 26).toString(36).toUpperCase()
60
+ } else if (byte < 63) {
61
+ id += '_'
62
+ } else {
63
+ id += '-'
64
+ }
65
+ }
66
+ return id
67
+ }
68
+
69
+ export { nanoid, customAlphabet, random }