@nocobase/plugin-auth 1.6.0-beta.6 → 1.6.0-beta.7
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/client/index.js +1 -1
- package/dist/client/interceptors.d.ts +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +3 -0
- package/dist/externalVersion.js +9 -9
- package/dist/node_modules/cron/package.json +1 -1
- package/dist/node_modules/ms/package.json +1 -1
- package/dist/server/token-controller.js +6 -15
- package/package.json +2 -2
- /package/dist/client/{88ef1c520c08b674.js → f2122264b5758d8b.js} +0 -0
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/shared"),require("@formily/core"),require("@emotion/css"),require("antd"),require("react-router-dom")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["@nocobase/client","@ant-design/icons","@formily/react","@formily/antd-v5","react","react-i18next","@nocobase/utils/client","@formily/shared","@formily/core","@emotion/css","antd","react-router-dom"],e):"object"==typeof exports?exports["@nocobase/plugin-auth"]=e(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/shared"),require("@formily/core"),require("@emotion/css"),require("antd"),require("react-router-dom")):t["@nocobase/plugin-auth"]=e(t["@nocobase/client"],t["@ant-design/icons"],t["@formily/react"],t["@formily/antd-v5"],t.react,t["react-i18next"],t["@nocobase/utils/client"],t["@formily/shared"],t["@formily/core"],t["@emotion/css"],t.antd,t["react-router-dom"])}(self,function(t,e,n,r,o,i,u,a,c,f,l,s){return function(){var p,d,y,h,v,b,g={851:function(t,e,n){"use strict";n.r(e),n.d(e,{AuthLayout:function(){return I},useSignIn:function(){return R},PluginAuthClient:function(){return N},AuthenticatorsContextProvider:function(){return q},default:function(){return L},AuthenticatorsContext:function(){return l.H},useAuthenticator:function(){return l.u}});var r=n("772"),o=n("584"),i=n("741"),u=n.n(i),a={SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW"},c=u()(function(t){t()},3e3,{leading:!0,trailing:!1}),f=n("573"),l=n("308"),s=n(581);function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){n(t);return}a.done?e(c):Promise.resolve(c).then(r,o)}function y(t,e,n){return(y=m()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&b(o,n.prototype),o}).apply(null,arguments)}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function g(t){var e="function"==typeof Map?new Map:void 0;return(g=function(t){var n;if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return y(t,arguments,v(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),b(r,t)})(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}var x=(0,r.lazy)(function(){return s("imported_gs6osn_component",n.e("890").then(n.bind(n,387)))},"AuthProvider").AuthProvider,_=(0,r.lazy)(function(){return s("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"Options","SignInForm","SignUpForm"),S=_.Options,w=_.SignInForm,j=_.SignUpForm,A=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthLayout","SignInPage","SignUpPage"),O=A.AuthLayout,k=A.SignInPage,T=A.SignUpPage,P=(0,r.lazy)(function(){return s("imported_10vpsc8_component",n.e("851").then(n.bind(n,264)))},"Authenticator").Authenticator,E=(0,r.lazy)(function(){return s("imported_-1q5gcq5_component",n.e("104").then(n.bind(n,349)))},"TokenPolicySettings").TokenPolicySettings,C=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthenticatorsContextProvider","AuthLayout"),q=C.AuthenticatorsContextProvider,I=C.AuthLayout,N=function(t){var e,n,r;function i(){var t,e,n,r,u,a,c;return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,i),e=this,n=i,r=arguments,n=v(n),u=t=function(t,e){return e&&("object"===function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}(e)||"function"==typeof e)?e:function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(e,m()?Reflect.construct(n,r||[],v(e).constructor):n.apply(e,r)),a="authTypes",c=new o.Registry,a in u?Object.defineProperty(u,a,{value:c,enumerable:!0,configurable:!0,writable:!0}):u[a]=c,t}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e)}(i,t),e=i,n=[{key:"registerType",value:function(t,e){this.authTypes.register(t,e)}},{key:"load",value:function(){var t,e=this;return(t=function(){var t,n,r;return function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(o){var i,u,l;return e.app.pluginSettingsManager.add(f.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(f.A7,'" })}}'),Component:P,aclSnippet:"pm.auth.authenticators"}),e.router.add("auth",{Component:"AuthLayout"}),e.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),e.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),e.app.addComponents({AuthLayout:O,SignInPage:k,SignUpPage:T}),e.app.providers.unshift([x,{}]),e.registerType("Email/Password",{components:{SignInForm:w,SignUpForm:j,AdminSettingsForm:S}}),e.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(f.A7,'" })}}'),Component:E,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),u=((i=({app:e.app}).app).apiClient.axios,[function(t){var e=t.headers["x-new-token"];return e&&i.apiClient.auth.setToken(e),t},function(t){var e=t.response.headers["x-new-token"];if(e&&i.apiClient.auth.setToken(e),401===t.status&&!(null===(n=t.config)||void 0===n?void 0:n.skipAuth)){var n,r,o,u,f,l=null==t?void 0:null===(o=t.config)||void 0===o?void 0:null===(r=o.headers.Authorization)||void 0===r?void 0:r.replace(/^Bearer\s+/gi,""),s=i.apiClient.auth.getToken();if(s&&s!==l)return t.config.skipNotify=!0,i.apiClient.request(t.config);i.apiClient.auth.setToken("");var p=null==t?void 0:null===(f=t.response)||void 0===f?void 0:null===(u=f.data)||void 0===u?void 0:u.errors,d=Array.isArray(p)?p[0]:null;if(!d||(null==d?void 0:d.code)===a.SKIP_TOKEN_RENEW)throw t;if((null==d?void 0:d.code)==="USER_HAS_NO_ROLES_ERR")throw i.error=d,t;var y=i.router.state.location,h=y.pathname,v=y.search,b=i.router.basename;if(h!==i.getHref("signin")){var g,m,x,_=(g=h,m=b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),x=new RegExp("^".concat(m.replace(/\/?$/,""),"(\\/|$)")),g.replace(x,"/")||g);c(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(_).concat(v),{replace:!0})})}}throw t}]),l=2,n=(t=function(t){if(Array.isArray(t))return t}(u)||function(t,e){var n,r,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(t);!(u=(n=o.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,r=t}finally{try{!u&&null!=o.return&&o.return()}finally{if(a)throw r}}return i}}(u,2)||function(t,e){if(t){if("string"==typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(t,e)}}(u,l)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],r=t[1],e.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:n,rejected:r,synchronous:!1,runWhen:null}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){d(i,r,o,u,a,"next",t)}function a(t){d(i,r,o,u,a,"throw",t)}u(void 0)})})()}}],h(e.prototype,n),i}(g(r.Plugin)),R=function(t){return(0,r.useLazy)(function(){return s("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"useSignIn")(t)},L=N},308:function(t,e,n){"use strict";n.d(e,{H:function(){return o},u:function(){return i}});var r=n(156),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var i=function(t){return(0,r.useContext)(o).find(function(e){return e.name===t})}},573:function(t,e,n){"use strict";n.d(e,{A7:function(){return i},KQ:function(){return a},o$:function(){return u}});var r=n(238),o=n(772),i="auth";function u(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}function a(t){return o.i18n.t(t,{ns:[i,"client"],nsMode:"fallback"})}},869:function(t,e,n){var r=n(31).Symbol;t.exports=r},365:function(t,e,n){var r=n(869),o=n(43),i=n(283),u=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):i(t)}},527:function(t,e,n){var r=n(670),o=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t}},274:function(t,e,n){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;t.exports=r},43:function(t,e,n){var r=n(869),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(e?t[a]=n:delete t[a]),o}},283:function(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},31:function(t,e,n){var r=n(274),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},670:function(t){var e=/\s/;t.exports=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}},741:function(t,e,n){var r=n(917),o=n(860),i=n(640),u=Math.max,a=Math.min;t.exports=function(t,e,n){var c,f,l,s,p,d,y=0,h=!1,v=!1,b=!0;if("function"!=typeof t)throw TypeError("Expected a function");function g(e){var n=c,r=f;return c=f=void 0,y=e,s=t.apply(r,n)}e=i(e)||0,r(n)&&(h=!!n.leading,l=(v="maxWait"in n)?u(i(n.maxWait)||0,e):l,b="trailing"in n?!!n.trailing:b);function m(t){var n=t-d,r=t-y;return void 0===d||n>=e||n<0||v&&r>=l}function x(){var t,n,r,i,u=o();if(m(u))return _(u);p=setTimeout(x,(n=(t=u)-d,r=t-y,i=e-n,v?a(i,l-r):i))}function _(t){return(p=void 0,b&&c)?g(t):(c=f=void 0,s)}function S(){var t,n=o(),r=m(n);if(c=arguments,f=this,d=n,r){if(void 0===p){;return y=t=d,p=setTimeout(x,e),h?g(t):s}if(v)return clearTimeout(p),p=setTimeout(x,e),g(d)}return void 0===p&&(p=setTimeout(x,e)),s}return S.cancel=function(){void 0!==p&&clearTimeout(p),y=0,c=d=f=p=void 0},S.flush=function(){return void 0===p?s:_(o())},S}},917:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},620:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},528:function(t,e,n){var r=n(365),o=n(620);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},860:function(t,e,n){var r=n(31);t.exports=function(){return r.Date.now()}},640:function(t,e,n){var r=n(527),o=n(917),i=n(528),u=0/0,a=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,f=/^0o[0-7]+$/i,l=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return u;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var n=c.test(t);return n||f.test(t)?l(t.slice(2),n?2:8):a.test(t)?u:+t}},581:function(t){t.exports=function(t,e){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(t,e),e}},482:function(t){"use strict";t.exports=e},964:function(t){"use strict";t.exports=f},632:function(t){"use strict";t.exports=r},563:function(t){"use strict";t.exports=c},505:function(t){"use strict";t.exports=n},875:function(t){"use strict";t.exports=a},772:function(e){"use strict";e.exports=t},584:function(t){"use strict";t.exports=u},721:function(t){"use strict";t.exports=l},156:function(t){"use strict";t.exports=o},238:function(t){"use strict";t.exports=i},128:function(t){"use strict";t.exports=s}},m={};function x(t){var e=m[t];if(void 0!==e)return e.exports;var n=m[t]={exports:{}};return g[t](n,n.exports,x),n.exports}return x.m=g,x.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return x.d(e,{a:e}),e},x.d=function(t,e){for(var n in e)x.o(e,n)&&!x.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},x.f={},x.e=function(t){return Promise.all(Object.keys(x.f).reduce(function(e,n){return x.f[n](t,e),e},[]))},x.u=function(t){return""+({104:"88ef1c520c08b674",280:"9e603524b127e7b4",851:"974ac9de644a1d1f",890:"43e9587ca4936ffe",938:"0091d4359312cb07"})[t]+".js"},x.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),x.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},p={},d="@nocobase/plugin-auth:",x.l=function(t,e,n,r){if(p[t]){p[t].push(e);return}if(void 0!==n){for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var c=u[a];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==d+n){o=c;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,x.nc&&o.setAttribute("nonce",x.nc),o.setAttribute("data-webpack",d+n),o.src=t),p[t]=[e];var f=function(e,n){o.onerror=o.onload=null,clearTimeout(l);var r=p[t];if(delete p[t],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(t){return t(n)}),e)return e(n)},l=setTimeout(f.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=f.bind(null,o.onerror),o.onload=f.bind(null,o.onload),i&&document.head.appendChild(o)},x.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},x.p=(!(y=window.__nocobase_public_path__||"/").endsWith("/")&&(y+="/"),y+"static/plugins/@nocobase/plugin-auth/dist/client/"),h={909:0},x.f.j=function(t,e){var n=x.o(h,t)?h[t]:void 0;if(0!==n){if(n)e.push(n[2]);else{var r=new Promise(function(e,r){n=h[t]=[e,r]});e.push(n[2]=r);var o=x.p+x.u(t),i=Error();x.l(o,function(e){if(x.o(h,t)&&(0!==(n=h[t])&&(h[t]=void 0),n)){var r=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;i.message="Loading chunk "+t+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+t,t)}}},v=function(t,e){var n=e[0],r=e[1],o=e[2],i,u,a=0;if(n.some(function(t){return 0!==h[t]})){for(i in r)x.o(r,i)&&(x.m[i]=r[i]);o&&o(x)}for(t&&t(e);a<n.length;a++)u=n[a],x.o(h,u)&&h[u]&&h[u][0](),h[u]=0},(b=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(v.bind(null,0)),b.push=v.bind(null,b.push.bind(b)),x("851")}()});
|
|
10
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/shared"),require("@formily/core"),require("@emotion/css"),require("antd"),require("react-router-dom")):"function"==typeof define&&define.amd?define("@nocobase/plugin-auth",["@nocobase/client","@ant-design/icons","@formily/react","@formily/antd-v5","react","react-i18next","@nocobase/utils/client","@formily/shared","@formily/core","@emotion/css","antd","react-router-dom"],e):"object"==typeof exports?exports["@nocobase/plugin-auth"]=e(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("react"),require("react-i18next"),require("@nocobase/utils/client"),require("@formily/shared"),require("@formily/core"),require("@emotion/css"),require("antd"),require("react-router-dom")):t["@nocobase/plugin-auth"]=e(t["@nocobase/client"],t["@ant-design/icons"],t["@formily/react"],t["@formily/antd-v5"],t.react,t["react-i18next"],t["@nocobase/utils/client"],t["@formily/shared"],t["@formily/core"],t["@emotion/css"],t.antd,t["react-router-dom"])}(self,function(t,e,n,r,o,i,u,a,c,l,f,s){return function(){var p,d,y,h,v,b,g={851:function(t,e,n){"use strict";n.r(e),n.d(e,{AuthLayout:function(){return I},useSignIn:function(){return L},PluginAuthClient:function(){return R},AuthenticatorsContextProvider:function(){return q},default:function(){return M},AuthenticatorsContext:function(){return f.H},useAuthenticator:function(){return f.u}});var r=n("772"),o=n("584"),i=n("741"),u=n.n(i),a={SKIP_TOKEN_RENEW:"SKIP_TOKEN_RENEW"},c=u()(function(t){t()},3e3,{leading:!0,trailing:!1}),l=n("573"),f=n("308"),s=n(581);function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(t){n(t);return}a.done?e(c):Promise.resolve(c).then(r,o)}function y(t,e,n){return(y=m()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&b(o,n.prototype),o}).apply(null,arguments)}function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function g(t){var e="function"==typeof Map?new Map:void 0;return(g=function(t){var n;if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return y(t,arguments,v(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),b(r,t)})(t)}function m(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(m=function(){return!!t})()}var x=(0,r.lazy)(function(){return s("imported_gs6osn_component",n.e("890").then(n.bind(n,387)))},"AuthProvider").AuthProvider,_=(0,r.lazy)(function(){return s("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"Options","SignInForm","SignUpForm"),S=_.Options,w=_.SignInForm,j=_.SignUpForm,A=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthLayout","SignInPage","SignUpPage"),O=A.AuthLayout,k=A.SignInPage,T=A.SignUpPage,P=(0,r.lazy)(function(){return s("imported_10vpsc8_component",n.e("851").then(n.bind(n,264)))},"Authenticator").Authenticator,E=(0,r.lazy)(function(){return s("imported_-1q5gcq5_component",n.e("104").then(n.bind(n,349)))},"TokenPolicySettings").TokenPolicySettings,C=(0,r.lazy)(function(){return s("imported_-1ja1ffa_component",n.e("280").then(n.bind(n,492)))},"AuthenticatorsContextProvider","AuthLayout"),q=C.AuthenticatorsContextProvider,I=C.AuthLayout,R=function(t){var e,n,r;function i(){var t,e,n,r,u,a,c;return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,i),e=this,n=i,r=arguments,n=v(n),u=t=function(t,e){return e&&("object"===function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}(e)||"function"==typeof e)?e:function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(e,m()?Reflect.construct(n,r||[],v(e).constructor):n.apply(e,r)),a="authTypes",c=new o.Registry,a in u?Object.defineProperty(u,a,{value:c,enumerable:!0,configurable:!0,writable:!0}):u[a]=c,t}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e)}(i,t),e=i,n=[{key:"registerType",value:function(t,e){this.authTypes.register(t,e)}},{key:"load",value:function(){var t,e=this;return(t=function(){var t,n,r;return function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=(o=u.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}(this,function(o){var i,u,f;return e.app.pluginSettingsManager.add(l.A7,{icon:"LoginOutlined",title:'{{t("Authentication", { ns: "'.concat(l.A7,'" })}}'),Component:P,aclSnippet:"pm.auth.authenticators"}),e.router.add("auth",{Component:"AuthLayout"}),e.router.add("auth.signin",{path:"/signin",Component:"SignInPage"}),e.router.add("auth.signup",{path:"/signup",Component:"SignUpPage"}),e.app.addComponents({AuthLayout:O,SignInPage:k,SignUpPage:T}),e.app.providers.unshift([x,{}]),e.registerType("Email/Password",{components:{SignInForm:w,SignUpForm:j,AdminSettingsForm:S}}),e.app.pluginSettingsManager.add("security.token-policy",{title:'{{t("Token policy", { ns: "'.concat(l.A7,'" })}}'),Component:E,aclSnippet:"pm.security.token-policy",icon:"ApiOutlined",sort:0}),u=((i=({app:e.app}).app).apiClient.axios,[function(t){var e,n=null==t?void 0:null===(e=t.headers)||void 0===e?void 0:e["x-new-token"];return n&&i.apiClient.auth.setToken(n),t},function(t){var e=null==t?void 0:null===(r=t.response)||void 0===r?void 0:null===(n=r.headers)||void 0===n?void 0:n["x-new-token"];if(e&&i.apiClient.auth.setToken(e),401===t.status&&!(null===(o=t.config)||void 0===o?void 0:o.skipAuth)){null==t||null===(f=t.config)||void 0===f||null===(l=f.headers)||void 0===l||null===(u=l.Authorization)||void 0===u||u.replace(/^Bearer\s+/gi,""),i.apiClient.auth.getToken(),i.apiClient.auth.setToken("");var n,r,o,u,l,f,s,p,d=null==t?void 0:null===(p=t.response)||void 0===p?void 0:null===(s=p.data)||void 0===s?void 0:s.errors,y=Array.isArray(d)?d[0]:null;if(!y||(null==y?void 0:y.code)===a.SKIP_TOKEN_RENEW)throw t;if((null==y?void 0:y.code)==="USER_HAS_NO_ROLES_ERR")throw i.error=y,t;var h=i.router.state.location,v=h.pathname,b=h.search,g=i.router.basename;if(v!==i.getHref("signin")){var m,x,_,S=(m=v,x=g.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp("^".concat(x.replace(/\/?$/,""),"(\\/|$)")),m.replace(_,"/")||m);c(function(){i.apiClient.auth.setToken(null),i.router.navigate("/signin?redirect=".concat(S).concat(b),{replace:!0})})}}throw t}]),f=2,n=(t=function(t){if(Array.isArray(t))return t}(u)||function(t,e){var n,r,o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i=[],u=!0,a=!1;try{for(o=o.call(t);!(u=(n=o.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,r=t}finally{try{!u&&null!=o.return&&o.return()}finally{if(a)throw r}}return i}}(u,2)||function(t,e){if(t){if("string"==typeof t)return p(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(t,e)}}(u,f)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0],r=t[1],e.app.apiClient.axios.interceptors.response.handlers.unshift({fulfilled:n,rejected:r,synchronous:!1,runWhen:null}),[2]})},function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function u(t){d(i,r,o,u,a,"next",t)}function a(t){d(i,r,o,u,a,"throw",t)}u(void 0)})})()}}],h(e.prototype,n),i}(g(r.Plugin)),L=function(t){return(0,r.useLazy)(function(){return s("imported_kl5khg_component",n.e("938").then(n.bind(n,510)))},"useSignIn")(t)},M=R},308:function(t,e,n){"use strict";n.d(e,{H:function(){return o},u:function(){return i}});var r=n(156),o=(0,r.createContext)([]);o.displayName="AuthenticatorsContext";var i=function(t){return(0,r.useContext)(o).find(function(e){return e.name===t})}},573:function(t,e,n){"use strict";n.d(e,{A7:function(){return i},KQ:function(){return a},o$:function(){return u}});var r=n(238),o=n(772),i="auth";function u(){return(0,r.useTranslation)([i,"client"],{nsMode:"fallback"})}function a(t){return o.i18n.t(t,{ns:[i,"client"],nsMode:"fallback"})}},869:function(t,e,n){var r=n(31).Symbol;t.exports=r},365:function(t,e,n){var r=n(869),o=n(43),i=n(283),u=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":u&&u in Object(t)?o(t):i(t)}},527:function(t,e,n){var r=n(670),o=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t}},274:function(t,e,n){var r="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g;t.exports=r},43:function(t,e,n){var r=n(869),o=Object.prototype,i=o.hasOwnProperty,u=o.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var o=u.call(t);return r&&(e?t[a]=n:delete t[a]),o}},283:function(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},31:function(t,e,n){var r=n(274),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},670:function(t){var e=/\s/;t.exports=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}},741:function(t,e,n){var r=n(917),o=n(860),i=n(640),u=Math.max,a=Math.min;t.exports=function(t,e,n){var c,l,f,s,p,d,y=0,h=!1,v=!1,b=!0;if("function"!=typeof t)throw TypeError("Expected a function");function g(e){var n=c,r=l;return c=l=void 0,y=e,s=t.apply(r,n)}e=i(e)||0,r(n)&&(h=!!n.leading,f=(v="maxWait"in n)?u(i(n.maxWait)||0,e):f,b="trailing"in n?!!n.trailing:b);function m(t){var n=t-d,r=t-y;return void 0===d||n>=e||n<0||v&&r>=f}function x(){var t,n,r,i,u=o();if(m(u))return _(u);p=setTimeout(x,(n=(t=u)-d,r=t-y,i=e-n,v?a(i,f-r):i))}function _(t){return(p=void 0,b&&c)?g(t):(c=l=void 0,s)}function S(){var t,n=o(),r=m(n);if(c=arguments,l=this,d=n,r){if(void 0===p){;return y=t=d,p=setTimeout(x,e),h?g(t):s}if(v)return clearTimeout(p),p=setTimeout(x,e),g(d)}return void 0===p&&(p=setTimeout(x,e)),s}return S.cancel=function(){void 0!==p&&clearTimeout(p),y=0,c=d=l=p=void 0},S.flush=function(){return void 0===p?s:_(o())},S}},917:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},620:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},528:function(t,e,n){var r=n(365),o=n(620);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==r(t)}},860:function(t,e,n){var r=n(31);t.exports=function(){return r.Date.now()}},640:function(t,e,n){var r=n(527),o=n(917),i=n(528),u=0/0,a=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,l=/^0o[0-7]+$/i,f=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return u;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var n=c.test(t);return n||l.test(t)?f(t.slice(2),n?2:8):a.test(t)?u:+t}},581:function(t){t.exports=function(t,e){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(t,e),e}},482:function(t){"use strict";t.exports=e},964:function(t){"use strict";t.exports=l},632:function(t){"use strict";t.exports=r},563:function(t){"use strict";t.exports=c},505:function(t){"use strict";t.exports=n},875:function(t){"use strict";t.exports=a},772:function(e){"use strict";e.exports=t},584:function(t){"use strict";t.exports=u},721:function(t){"use strict";t.exports=f},156:function(t){"use strict";t.exports=o},238:function(t){"use strict";t.exports=i},128:function(t){"use strict";t.exports=s}},m={};function x(t){var e=m[t];if(void 0!==e)return e.exports;var n=m[t]={exports:{}};return g[t](n,n.exports,x),n.exports}return x.m=g,x.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return x.d(e,{a:e}),e},x.d=function(t,e){for(var n in e)x.o(e,n)&&!x.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},x.f={},x.e=function(t){return Promise.all(Object.keys(x.f).reduce(function(e,n){return x.f[n](t,e),e},[]))},x.u=function(t){return""+({104:"f2122264b5758d8b",280:"9e603524b127e7b4",851:"974ac9de644a1d1f",890:"43e9587ca4936ffe",938:"0091d4359312cb07"})[t]+".js"},x.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(t){if("object"==typeof window)return window}}(),x.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},p={},d="@nocobase/plugin-auth:",x.l=function(t,e,n,r){if(p[t]){p[t].push(e);return}if(void 0!==n){for(var o,i,u=document.getElementsByTagName("script"),a=0;a<u.length;a++){var c=u[a];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==d+n){o=c;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,x.nc&&o.setAttribute("nonce",x.nc),o.setAttribute("data-webpack",d+n),o.src=t),p[t]=[e];var l=function(e,n){o.onerror=o.onload=null,clearTimeout(f);var r=p[t];if(delete p[t],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(t){return t(n)}),e)return e(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},x.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},x.p=(!(y=window.__nocobase_public_path__||"/").endsWith("/")&&(y+="/"),y+"static/plugins/@nocobase/plugin-auth/dist/client/"),h={909:0},x.f.j=function(t,e){var n=x.o(h,t)?h[t]:void 0;if(0!==n){if(n)e.push(n[2]);else{var r=new Promise(function(e,r){n=h[t]=[e,r]});e.push(n[2]=r);var o=x.p+x.u(t),i=Error();x.l(o,function(e){if(x.o(h,t)&&(0!==(n=h[t])&&(h[t]=void 0),n)){var r=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src;i.message="Loading chunk "+t+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+t,t)}}},v=function(t,e){var n=e[0],r=e[1],o=e[2],i,u,a=0;if(n.some(function(t){return 0!==h[t]})){for(i in r)x.o(r,i)&&(x.m[i]=r[i]);o&&o(x)}for(t&&t(e);a<n.length;a++)u=n[a],x.o(h,u)&&h[u]&&h[u][0](),h[u]=0},(b=self.webpackChunk_nocobase_plugin_auth=self.webpackChunk_nocobase_plugin_auth||[]).forEach(v.bind(null,0)),b.push=v.bind(null,b.push.bind(b)),x("851")}()});
|
|
@@ -10,4 +10,4 @@ import { Application } from '@nocobase/client';
|
|
|
10
10
|
import type { AxiosResponse } from 'axios';
|
|
11
11
|
export declare function authCheckMiddleware({ app }: {
|
|
12
12
|
app: Application;
|
|
13
|
-
}): ((
|
|
13
|
+
}): ((res: AxiosResponse) => AxiosResponse<any, any>)[];
|
package/dist/constants.d.ts
CHANGED
|
@@ -10,3 +10,4 @@ export declare const tokenPolicyRecordKey = "token-policy-config";
|
|
|
10
10
|
export declare const tokenPolicyCacheKey: string;
|
|
11
11
|
export declare const tokenPolicyCollectionName = "tokenControlConfig";
|
|
12
12
|
export declare const issuedTokensCollectionName = "issuedTokens";
|
|
13
|
+
export declare const RENEWED_JTI_CACHE_MS = 10000;
|
package/dist/constants.js
CHANGED
|
@@ -26,6 +26,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
26
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
27
|
var constants_exports = {};
|
|
28
28
|
__export(constants_exports, {
|
|
29
|
+
RENEWED_JTI_CACHE_MS: () => RENEWED_JTI_CACHE_MS,
|
|
29
30
|
issuedTokensCollectionName: () => issuedTokensCollectionName,
|
|
30
31
|
tokenPolicyCacheKey: () => tokenPolicyCacheKey,
|
|
31
32
|
tokenPolicyCollectionName: () => tokenPolicyCollectionName,
|
|
@@ -36,8 +37,10 @@ const tokenPolicyRecordKey = "token-policy-config";
|
|
|
36
37
|
const tokenPolicyCacheKey = "auth:" + tokenPolicyRecordKey;
|
|
37
38
|
const tokenPolicyCollectionName = "tokenControlConfig";
|
|
38
39
|
const issuedTokensCollectionName = "issuedTokens";
|
|
40
|
+
const RENEWED_JTI_CACHE_MS = 1e4;
|
|
39
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
42
|
0 && (module.exports = {
|
|
43
|
+
RENEWED_JTI_CACHE_MS,
|
|
41
44
|
issuedTokensCollectionName,
|
|
42
45
|
tokenPolicyCacheKey,
|
|
43
46
|
tokenPolicyCollectionName,
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,17 +8,17 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "1.6.0-beta.
|
|
11
|
+
"@nocobase/client": "1.6.0-beta.7",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/utils": "1.6.0-beta.
|
|
13
|
+
"@nocobase/utils": "1.6.0-beta.7",
|
|
14
14
|
"axios": "1.7.7",
|
|
15
15
|
"lodash": "4.17.21",
|
|
16
|
-
"@nocobase/auth": "1.6.0-beta.
|
|
17
|
-
"@nocobase/database": "1.6.0-beta.
|
|
18
|
-
"@nocobase/cache": "1.6.0-beta.
|
|
19
|
-
"@nocobase/server": "1.6.0-beta.
|
|
20
|
-
"@nocobase/logger": "1.6.0-beta.
|
|
21
|
-
"@nocobase/test": "1.6.0-beta.
|
|
16
|
+
"@nocobase/auth": "1.6.0-beta.7",
|
|
17
|
+
"@nocobase/database": "1.6.0-beta.7",
|
|
18
|
+
"@nocobase/cache": "1.6.0-beta.7",
|
|
19
|
+
"@nocobase/server": "1.6.0-beta.7",
|
|
20
|
+
"@nocobase/logger": "1.6.0-beta.7",
|
|
21
|
+
"@nocobase/test": "1.6.0-beta.7",
|
|
22
22
|
"@formily/antd-v5": "1.1.9",
|
|
23
23
|
"antd": "5.12.8",
|
|
24
24
|
"@formily/shared": "2.3.2",
|
|
@@ -27,6 +27,6 @@ module.exports = {
|
|
|
27
27
|
"react-i18next": "11.18.6",
|
|
28
28
|
"@emotion/css": "11.13.0",
|
|
29
29
|
"@ant-design/icons": "5.2.6",
|
|
30
|
-
"@nocobase/actions": "1.6.0-beta.
|
|
30
|
+
"@nocobase/actions": "1.6.0-beta.7",
|
|
31
31
|
"@formily/core": "2.3.0"
|
|
32
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2025-02-
|
|
1
|
+
{"name":"cron","description":"Cron jobs for your node","version":"2.4.4","author":"Nick Campbell <nicholas.j.campbell@gmail.com> (https://github.com/ncb000gt)","bugs":{"url":"https://github.com/kelektiv/node-cron/issues"},"repository":{"type":"git","url":"https://github.com/kelektiv/node-cron.git"},"main":"lib/cron","scripts":{"lint":"eslint {lib,tests}/*.js","test":"jest --coverage","test:watch":"jest --watch --coverage","test:types":"tsd","prepare":"husky install","release":"semantic-release"},"types":"types/index.d.ts","dependencies":{"@types/luxon":"~3.3.0","luxon":"~3.3.0"},"devDependencies":{"@commitlint/cli":"~17.6.6","@insurgentlab/commitlint-config":"^18.1.0","@insurgentlab/conventional-changelog-preset":"~6.0.3","@semantic-release/changelog":"~6.0.x","@semantic-release/commit-analyzer":"~9.0.x","@semantic-release/git":"~10.0.x","@semantic-release/github":"~8.1.x","@semantic-release/npm":"~10.0.x","@semantic-release/release-notes-generator":"~11.0.x","chai":"~4.2.x","eslint":"~8.36.x","eslint-config-prettier":"^8.7.x","eslint-config-standard":"~17.0.x","eslint-plugin-import":"~2.27.x","eslint-plugin-jest":"~27.2.x","eslint-plugin-n":"~15.6.x","eslint-plugin-prettier":"~4.2.x","eslint-plugin-promise":"~6.1.x","husky":"^8.0.3","jest":"~29.5.x","prettier":"~2.8.x","semantic-release":"~21.0.x","sinon":"^15.0.x","tsd":"^0.28.1"},"keywords":["cron","node cron","node-cron","schedule","scheduler","cronjob","cron job"],"license":"MIT","contributors":["Brandon der Blätter <https://interlucid.com/contact/> (https://github.com/intcreator)","Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)","James Padolsey <> (https://github.com/jamespadolsey)","Finn Herpich <fh@three-heads.de> (https://github.com/ErrorProne)","Clifton Cunningham <clifton.cunningham@gmail.com> (https://github.com/cliftonc)","Eric Abouaf <eric.abouaf@gmail.com> (https://github.com/neyric)","humanchimp <morphcham@gmail.com> (https://github.com/humanchimp)","Craig Condon <craig@spiceapps.com> (https://github.com/spiceapps)","Dan Bear <daniel@hulu.com> (https://github.com/danhbear)","Vadim Baryshev <vadimbaryshev@gmail.com> (https://github.com/baryshev)","Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)","Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)","Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)","Masakazu Matsushita <matsukaz@gmail.com> (matsukaz)","Christopher Lunt <me@kirisu.co.uk> (https://github.com/kirisu)"],"jest":{"collectCoverage":true,"collectCoverageFrom":["lib/*.js"],"coverageThreshold":{"global":{"statements":80,"branches":80,"functions":70,"lines":80}}},"files":["lib","types","CHANGELOG.md","LICENSE","README.md"],"_lastModified":"2025-02-14T05:38:24.017Z"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-02-
|
|
1
|
+
{"name":"ms","version":"2.1.3","description":"Tiny millisecond conversion utility","repository":"vercel/ms","main":"./index","files":["index.js"],"scripts":{"precommit":"lint-staged","lint":"eslint lib/* bin/*","test":"mocha tests.js"},"eslintConfig":{"extends":"eslint:recommended","env":{"node":true,"es6":true}},"lint-staged":{"*.js":["npm run lint","prettier --single-quote --write","git add"]},"license":"MIT","devDependencies":{"eslint":"4.18.2","expect.js":"0.3.1","husky":"0.14.3","lint-staged":"5.0.0","mocha":"4.0.1","prettier":"2.0.5"},"_lastModified":"2025-02-14T05:38:24.118Z"}
|
|
@@ -57,7 +57,6 @@ class TokenController {
|
|
|
57
57
|
async setTokenInfo(id, value) {
|
|
58
58
|
const repo = this.app.db.getRepository(import_constants.issuedTokensCollectionName);
|
|
59
59
|
await repo.updateOrCreate({ filterKeys: ["id"], values: value });
|
|
60
|
-
await this.cache.set(`${JTICACHEKEY}:${id}`, value);
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
62
|
getConfig() {
|
|
@@ -118,20 +117,6 @@ class TokenController {
|
|
|
118
117
|
renew = async (jti) => {
|
|
119
118
|
const repo = this.app.db.getRepository(import_constants.issuedTokensCollectionName);
|
|
120
119
|
const model = this.app.db.getModel(import_constants.issuedTokensCollectionName);
|
|
121
|
-
const exists = await repo.findOne({ filter: { jti } });
|
|
122
|
-
if (!exists) {
|
|
123
|
-
this.logger.error("jti not found", {
|
|
124
|
-
module: "auth",
|
|
125
|
-
submodule: "token-controller",
|
|
126
|
-
method: "renew",
|
|
127
|
-
jti,
|
|
128
|
-
code: import_auth.AuthErrorCode.TOKEN_RENEW_FAILED
|
|
129
|
-
});
|
|
130
|
-
throw new import_auth.AuthError({
|
|
131
|
-
message: "Your session has expired. Please sign in again.",
|
|
132
|
-
code: import_auth.AuthErrorCode.TOKEN_RENEW_FAILED
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
120
|
const newId = (0, import_crypto.randomUUID)();
|
|
136
121
|
const issuedTime = Date.now();
|
|
137
122
|
const [count] = await model.update(
|
|
@@ -139,8 +124,14 @@ class TokenController {
|
|
|
139
124
|
{ where: { jti } }
|
|
140
125
|
);
|
|
141
126
|
if (count === 1) {
|
|
127
|
+
await this.cache.set(`jti-renewed-cahce:${jti}`, { jti: newId, issuedTime }, import_constants.RENEWED_JTI_CACHE_MS);
|
|
128
|
+
this.logger.info("jti renewed", { oldJti: jti, newJti: newId, issuedTime });
|
|
142
129
|
return { jti: newId, issuedTime };
|
|
143
130
|
} else {
|
|
131
|
+
const cachedJtiData = await this.cache.get(`jti-renewed-cahce:${jti}`);
|
|
132
|
+
if (cachedJtiData) {
|
|
133
|
+
return cachedJtiData;
|
|
134
|
+
}
|
|
144
135
|
this.logger.error("jti renew failed", {
|
|
145
136
|
module: "auth",
|
|
146
137
|
submodule: "token-controller",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-auth",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.7",
|
|
4
4
|
"main": "./dist/server/index.js",
|
|
5
5
|
"homepage": "https://docs.nocobase.com/handbook/auth",
|
|
6
6
|
"homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"displayName.zh-CN": "用户认证",
|
|
28
28
|
"description": "User authentication management, including password, SMS, and support for Single Sign-On (SSO) protocols, with extensibility.",
|
|
29
29
|
"description.zh-CN": "用户认证管理,包括基础的密码认证、短信认证、SSO 协议的认证等,可扩展。",
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "c20f453b3b105a5c1f9cacd71e5a246a4fc7bd81",
|
|
31
31
|
"keywords": [
|
|
32
32
|
"Authentication",
|
|
33
33
|
"Security"
|
|
File without changes
|