dauth-md-node 0.1.67 → 0.1.69
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/dauth-md-node.cjs.development.js +1 -1
- package/dist/dauth-md-node.cjs.development.js.map +1 -1
- package/dist/dauth-md-node.cjs.production.min.js +1 -1
- package/dist/dauth-md-node.cjs.production.min.js.map +1 -1
- package/dist/dauth-md-node.esm.js +1 -1
- package/dist/dauth-md-node.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
|
@@ -402,7 +402,7 @@ var dauth = /*#__PURE__*/function () {
|
|
|
402
402
|
// console.log('getDauthUser error', error);
|
|
403
403
|
// return next();
|
|
404
404
|
// })
|
|
405
|
-
|
|
405
|
+
next();
|
|
406
406
|
} catch (error) {
|
|
407
407
|
if (error && (error == null ? void 0 : error.message) === 'jwt expired') {
|
|
408
408
|
return res.status(500).send({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dauth-md-node.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import {\n Request,\n NextFunction,\n Response as ExpressResponse,\n Handler,\n} from 'express';\nimport mongoose from 'mongoose';\nimport jwt from 'jsonwebtoken';\n// import fetch from 'node-fetch';\n// const fetch = require('node-fetch');\n\nexport interface IAccessToken {\n _id: string | mongoose.Types.ObjectId;\n sid: string;\n name: string;\n lastname: string;\n email: string;\n createToken?: number;\n exp?: number;\n iat?: number;\n}\n\ninterface IRequestUser extends Request {\n user: IAccessToken;\n files: {\n image: { path: string };\n avatar: { path: string };\n };\n headers: {\n authorization: string;\n };\n}\n\ninterface TCustomResponse extends ExpressResponse {\n status(code: number): any;\n send(body?: any): any;\n}\n\n// async function getUser(token: string) {\n// const params = {\n// method: \"GET\",\n// headers: {\n// Authorization: token,\n// \"Content-Type\": \"application/json\",\n// }\n// }\n// const response = await fetch(`http://localhost:4012/api/v1/get-tenant-user/easymediacloud`, params)\n// const data = await response.json()\n// return { response, data }\n// }\n\n// async function getDauthUser() {\n// const getUserFetch = await getUser()\n// if (getUserFetch.response.status === 404) {\n// return 404\n// // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n// }\n// if (getUserFetch.response.status === 500) {\n// return 500\n// // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n// }\n// if (getUserFetch.response.status === 200) {\n// // req.user = getUserFetch.data as any\n// // console.log('node-fetch', req.user);\n// // next()\n// return getUserFetch.data\n// }\n// return null\n// }\n\nexport const dauth = async ({ ssid }: { ssid: string }) => {\n // const getUser = await getDauthUser()\n return (\n req: IRequestUser,\n res: TCustomResponse,\n next: NextFunction\n ): Handler | void => {\n if (!req.headers.authorization) {\n return res\n .status(403)\n .send({ status: 'token-not-found', mdKey: 'ensure_auth' });\n }\n const token = req.headers.authorization.replace(/['\"]+/g, '');\n try {\n const payload = jwt.verify(token, ssid as string) as IAccessToken;\n req.user = payload;\n // getUser(token).then((getUserFetch: any) => {\n // if (getUserFetch.response.status === 404) {\n // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n // }\n // if (getUserFetch.response.status === 500) {\n // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n // }\n // if (getUserFetch.response.status === 200) {\n // req.user = getUserFetch.data\n // console.log('node-fetch npm', req.user);\n // }\n // return next();\n // }).catch((error: any) => {\n // console.log('getDauthUser error', error);\n // return next();\n // })\n
|
|
1
|
+
{"version":3,"file":"dauth-md-node.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["import {\n Request,\n NextFunction,\n Response as ExpressResponse,\n Handler,\n} from 'express';\nimport mongoose from 'mongoose';\nimport jwt from 'jsonwebtoken';\n// import fetch from 'node-fetch';\n// const fetch = require('node-fetch');\n\nexport interface IAccessToken {\n _id: string | mongoose.Types.ObjectId;\n sid: string;\n name: string;\n lastname: string;\n email: string;\n createToken?: number;\n exp?: number;\n iat?: number;\n}\n\ninterface IRequestUser extends Request {\n user: IAccessToken;\n files: {\n image: { path: string };\n avatar: { path: string };\n };\n headers: {\n authorization: string;\n };\n}\n\ninterface TCustomResponse extends ExpressResponse {\n status(code: number): any;\n send(body?: any): any;\n}\n\n// async function getUser(token: string) {\n// const params = {\n// method: \"GET\",\n// headers: {\n// Authorization: token,\n// \"Content-Type\": \"application/json\",\n// }\n// }\n// const response = await fetch(`http://localhost:4012/api/v1/get-tenant-user/easymediacloud`, params)\n// const data = await response.json()\n// return { response, data }\n// }\n\n// async function getDauthUser() {\n// const getUserFetch = await getUser()\n// if (getUserFetch.response.status === 404) {\n// return 404\n// // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n// }\n// if (getUserFetch.response.status === 500) {\n// return 500\n// // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n// }\n// if (getUserFetch.response.status === 200) {\n// // req.user = getUserFetch.data as any\n// // console.log('node-fetch', req.user);\n// // next()\n// return getUserFetch.data\n// }\n// return null\n// }\n\nexport const dauth = async ({ ssid }: { ssid: string }) => {\n // const getUser = await getDauthUser()\n return (\n req: IRequestUser,\n res: TCustomResponse,\n next: NextFunction\n ): Handler | void => {\n if (!req.headers.authorization) {\n return res\n .status(403)\n .send({ status: 'token-not-found', mdKey: 'ensure_auth' });\n }\n const token = req.headers.authorization.replace(/['\"]+/g, '');\n try {\n const payload = jwt.verify(token, ssid as string) as IAccessToken;\n req.user = payload;\n // getUser(token).then((getUserFetch: any) => {\n // if (getUserFetch.response.status === 404) {\n // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n // }\n // if (getUserFetch.response.status === 500) {\n // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n // }\n // if (getUserFetch.response.status === 200) {\n // req.user = getUserFetch.data\n // console.log('node-fetch npm', req.user);\n // }\n // return next();\n // }).catch((error: any) => {\n // console.log('getDauthUser error', error);\n // return next();\n // })\n next();\n } catch (error) {\n if (error && error?.message === 'jwt expired') {\n return res.status(500).send({\n status: 'token-expired',\n message: 'El token ha expirado',\n error: error,\n mdKey: 'ensure_auth',\n });\n }\n return res.status(500).send({\n status: 'token-invalid',\n message: 'El token no es válido',\n error: error,\n mdKey: 'ensure_auth',\n });\n }\n };\n};\n"],"names":["dauth","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","ssid","wrap","_callee$","_context","prev","next","abrupt","req","res","headers","authorization","status","send","mdKey","token","replace","payload","jwt","verify","user","error","message","stop","_x","apply","arguments"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAEaA,KAAK;EAAA,IAAAC,KAAA,gBAAAC,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAAG,SAAAC,QAAAC,IAAA;IAAA,IAAAC,IAAA;IAAA,OAAAJ,mBAAA,GAAAK,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAASL,IAAI,GAAAD,IAAA,CAAJC,IAAI;UAAA,OAAAG,QAAA,CAAAG,MAAA,WAEzB,UACLC,GAAiB,EACjBC,GAAoB,EACpBH,IAAkB;YAElB,IAAI,CAACE,GAAG,CAACE,OAAO,CAACC,aAAa,EAAE;cAC9B,OAAOF,GAAG,CACPG,MAAM,CAAC,GAAG,CAAC,CACXC,IAAI,CAAC;gBAAED,MAAM,EAAE,iBAAiB;gBAAEE,KAAK,EAAE;eAAe,CAAC;;YAE9D,IAAMC,KAAK,GAAGP,GAAG,CAACE,OAAO,CAACC,aAAa,CAACK,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC7D,IAAI;cACF,IAAMC,OAAO,GAAGC,GAAG,CAACC,MAAM,CAACJ,KAAK,EAAEd,IAAc,CAAiB;cACjEO,GAAG,CAACY,IAAI,GAAGH,OAAO;;;;;;;;;;;;;;;;;cAiBlBX,IAAI,EAAE;aACP,CAAC,OAAOe,KAAK,EAAE;cACd,IAAIA,KAAK,IAAI,CAAAA,KAAK,oBAALA,KAAK,CAAEC,OAAO,MAAK,aAAa,EAAE;gBAC7C,OAAOb,GAAG,CAACG,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC;kBAC1BD,MAAM,EAAE,eAAe;kBACvBU,OAAO,EAAE,sBAAsB;kBAC/BD,KAAK,EAAEA,KAAK;kBACZP,KAAK,EAAE;iBACR,CAAC;;cAEJ,OAAOL,GAAG,CAACG,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC;gBAC1BD,MAAM,EAAE,eAAe;gBACvBU,OAAO,EAAE,uBAAuB;gBAChCD,KAAK,EAAEA,KAAK;gBACZP,KAAK,EAAE;eACR,CAAC;;WAEL;QAAA;QAAA;UAAA,OAAAV,QAAA,CAAAmB,IAAA;;OAAAxB,OAAA;GACF;EAAA,gBAlDYL,KAAKA,CAAA8B,EAAA;IAAA,OAAA7B,KAAA,CAAA8B,KAAA,OAAAC,SAAA;;AAAA;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,r=(t=require("jsonwebtoken"))&&"object"==typeof t&&"default"in t?t.default:t;function e(){e=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function h(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{h({},"")}catch(t){h=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var o=Object.create((r&&r.prototype instanceof g?r:g).prototype),a=new N(n||[]);return i(o,"_invoke",{value:k(t,e,a)}),o}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var p="suspendedStart",y="executing",v="completed",d={};function g(){}function m(){}function w(){}var x={};h(x,u,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(S([])));L&&L!==n&&o.call(L,u)&&(x=L);var E=w.prototype=g.prototype=Object.create(x);function _(t){["next","throw","return"].forEach((function(r){h(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(n,i,a,u){var c=l(t[n],t,i);if("throw"!==c.type){var s=c.arg,h=s.value;return h&&"object"==typeof h&&o.call(h,"__await")?r.resolve(h.__await).then((function(t){e("next",t,a,u)}),(function(t){e("throw",t,a,u)})):r.resolve(h).then((function(t){s.value=t,a(s)}),(function(t){return e("throw",t,a,u)}))}u(c.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function k(r,e,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(r,e,n);if("normal"===s.type){if(o=n.done?v:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function O(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,O(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,d):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function G(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function S(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,i=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return m.prototype=w,i(E,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:m,configurable:!0}),m.displayName=h(w,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,h(t,s,"GeneratorFunction")),t.prototype=Object.create(E),t},r.awrap=function(t){return{__await:t}},_(j.prototype),h(j.prototype,c,(function(){return this})),r.AsyncIterator=j,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new j(f(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(E),h(E,s,"Generator"),h(E,u,(function(){return this})),h(E,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=S,N.prototype={constructor:N,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(G),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return u.type="throw",u.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),G(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;G(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:S(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),d}},r}function n(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}exports.dauth=function(){var t=o(e().mark((function t(n){var o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.ssid,t.abrupt("return",(function(t,e,n){if(!t.headers.authorization)return e.status(403).send({status:"token-not-found",mdKey:"ensure_auth"});var i=t.headers.authorization.replace(/['"]+/g,"");try{var a=r.verify(i,o);
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,r=(t=require("jsonwebtoken"))&&"object"==typeof t&&"default"in t?t.default:t;function e(){e=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function h(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{h({},"")}catch(t){h=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var o=Object.create((r&&r.prototype instanceof g?r:g).prototype),a=new N(n||[]);return i(o,"_invoke",{value:k(t,e,a)}),o}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var p="suspendedStart",y="executing",v="completed",d={};function g(){}function m(){}function w(){}var x={};h(x,u,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(S([])));L&&L!==n&&o.call(L,u)&&(x=L);var E=w.prototype=g.prototype=Object.create(x);function _(t){["next","throw","return"].forEach((function(r){h(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(n,i,a,u){var c=l(t[n],t,i);if("throw"!==c.type){var s=c.arg,h=s.value;return h&&"object"==typeof h&&o.call(h,"__await")?r.resolve(h.__await).then((function(t){e("next",t,a,u)}),(function(t){e("throw",t,a,u)})):r.resolve(h).then((function(t){s.value=t,a(s)}),(function(t){return e("throw",t,a,u)}))}u(c.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function k(r,e,n){var o=p;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(r,e,n);if("normal"===s.type){if(o=n.done?v:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function O(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,O(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,d):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function G(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function S(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,i=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return m.prototype=w,i(E,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:m,configurable:!0}),m.displayName=h(w,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,h(t,s,"GeneratorFunction")),t.prototype=Object.create(E),t},r.awrap=function(t){return{__await:t}},_(j.prototype),h(j.prototype,c,(function(){return this})),r.AsyncIterator=j,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new j(f(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},_(E),h(E,s,"Generator"),h(E,u,(function(){return this})),h(E,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=S,N.prototype={constructor:N,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(G),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return u.type="throw",u.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),G(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;G(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:S(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),d}},r}function n(t,r,e,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}exports.dauth=function(){var t=o(e().mark((function t(n){var o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.ssid,t.abrupt("return",(function(t,e,n){if(!t.headers.authorization)return e.status(403).send({status:"token-not-found",mdKey:"ensure_auth"});var i=t.headers.authorization.replace(/['"]+/g,"");try{var a=r.verify(i,o);t.user=a,n()}catch(t){return t&&"jwt expired"===(null==t?void 0:t.message)?e.status(500).send({status:"token-expired",message:"El token ha expirado",error:t,mdKey:"ensure_auth"}):e.status(500).send({status:"token-invalid",message:"El token no es válido",error:t,mdKey:"ensure_auth"})}}));case 2:case"end":return t.stop()}}),t)})));return function(r){return t.apply(this,arguments)}}();
|
|
2
2
|
//# sourceMappingURL=dauth-md-node.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dauth-md-node.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["import {\n Request,\n NextFunction,\n Response as ExpressResponse,\n Handler,\n} from 'express';\nimport mongoose from 'mongoose';\nimport jwt from 'jsonwebtoken';\n// import fetch from 'node-fetch';\n// const fetch = require('node-fetch');\n\nexport interface IAccessToken {\n _id: string | mongoose.Types.ObjectId;\n sid: string;\n name: string;\n lastname: string;\n email: string;\n createToken?: number;\n exp?: number;\n iat?: number;\n}\n\ninterface IRequestUser extends Request {\n user: IAccessToken;\n files: {\n image: { path: string };\n avatar: { path: string };\n };\n headers: {\n authorization: string;\n };\n}\n\ninterface TCustomResponse extends ExpressResponse {\n status(code: number): any;\n send(body?: any): any;\n}\n\n// async function getUser(token: string) {\n// const params = {\n// method: \"GET\",\n// headers: {\n// Authorization: token,\n// \"Content-Type\": \"application/json\",\n// }\n// }\n// const response = await fetch(`http://localhost:4012/api/v1/get-tenant-user/easymediacloud`, params)\n// const data = await response.json()\n// return { response, data }\n// }\n\n// async function getDauthUser() {\n// const getUserFetch = await getUser()\n// if (getUserFetch.response.status === 404) {\n// return 404\n// // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n// }\n// if (getUserFetch.response.status === 500) {\n// return 500\n// // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n// }\n// if (getUserFetch.response.status === 200) {\n// // req.user = getUserFetch.data as any\n// // console.log('node-fetch', req.user);\n// // next()\n// return getUserFetch.data\n// }\n// return null\n// }\n\nexport const dauth = async ({ ssid }: { ssid: string }) => {\n // const getUser = await getDauthUser()\n return (\n req: IRequestUser,\n res: TCustomResponse,\n next: NextFunction\n ): Handler | void => {\n if (!req.headers.authorization) {\n return res\n .status(403)\n .send({ status: 'token-not-found', mdKey: 'ensure_auth' });\n }\n const token = req.headers.authorization.replace(/['\"]+/g, '');\n try {\n const payload = jwt.verify(token, ssid as string) as IAccessToken;\n req.user = payload;\n // getUser(token).then((getUserFetch: any) => {\n // if (getUserFetch.response.status === 404) {\n // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n // }\n // if (getUserFetch.response.status === 500) {\n // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n // }\n // if (getUserFetch.response.status === 200) {\n // req.user = getUserFetch.data\n // console.log('node-fetch npm', req.user);\n // }\n // return next();\n // }).catch((error: any) => {\n // console.log('getDauthUser error', error);\n // return next();\n // })\n
|
|
1
|
+
{"version":3,"file":"dauth-md-node.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["import {\n Request,\n NextFunction,\n Response as ExpressResponse,\n Handler,\n} from 'express';\nimport mongoose from 'mongoose';\nimport jwt from 'jsonwebtoken';\n// import fetch from 'node-fetch';\n// const fetch = require('node-fetch');\n\nexport interface IAccessToken {\n _id: string | mongoose.Types.ObjectId;\n sid: string;\n name: string;\n lastname: string;\n email: string;\n createToken?: number;\n exp?: number;\n iat?: number;\n}\n\ninterface IRequestUser extends Request {\n user: IAccessToken;\n files: {\n image: { path: string };\n avatar: { path: string };\n };\n headers: {\n authorization: string;\n };\n}\n\ninterface TCustomResponse extends ExpressResponse {\n status(code: number): any;\n send(body?: any): any;\n}\n\n// async function getUser(token: string) {\n// const params = {\n// method: \"GET\",\n// headers: {\n// Authorization: token,\n// \"Content-Type\": \"application/json\",\n// }\n// }\n// const response = await fetch(`http://localhost:4012/api/v1/get-tenant-user/easymediacloud`, params)\n// const data = await response.json()\n// return { response, data }\n// }\n\n// async function getDauthUser() {\n// const getUserFetch = await getUser()\n// if (getUserFetch.response.status === 404) {\n// return 404\n// // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n// }\n// if (getUserFetch.response.status === 500) {\n// return 500\n// // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n// }\n// if (getUserFetch.response.status === 200) {\n// // req.user = getUserFetch.data as any\n// // console.log('node-fetch', req.user);\n// // next()\n// return getUserFetch.data\n// }\n// return null\n// }\n\nexport const dauth = async ({ ssid }: { ssid: string }) => {\n // const getUser = await getDauthUser()\n return (\n req: IRequestUser,\n res: TCustomResponse,\n next: NextFunction\n ): Handler | void => {\n if (!req.headers.authorization) {\n return res\n .status(403)\n .send({ status: 'token-not-found', mdKey: 'ensure_auth' });\n }\n const token = req.headers.authorization.replace(/['\"]+/g, '');\n try {\n const payload = jwt.verify(token, ssid as string) as IAccessToken;\n req.user = payload;\n // getUser(token).then((getUserFetch: any) => {\n // if (getUserFetch.response.status === 404) {\n // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n // }\n // if (getUserFetch.response.status === 500) {\n // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n // }\n // if (getUserFetch.response.status === 200) {\n // req.user = getUserFetch.data\n // console.log('node-fetch npm', req.user);\n // }\n // return next();\n // }).catch((error: any) => {\n // console.log('getDauthUser error', error);\n // return next();\n // })\n next();\n } catch (error) {\n if (error && error?.message === 'jwt expired') {\n return res.status(500).send({\n status: 'token-expired',\n message: 'El token ha expirado',\n error: error,\n mdKey: 'ensure_auth',\n });\n }\n return res.status(500).send({\n status: 'token-invalid',\n message: 'El token no es válido',\n error: error,\n mdKey: 'ensure_auth',\n });\n }\n };\n};\n"],"names":["_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","ssid","wrap","_context","prev","next","abrupt","req","res","headers","authorization","status","send","mdKey","token","replace","payload","jwt","verify","user","error","message","stop","_x","apply","arguments"],"mappings":"w1NAsEkB,IAAAA,EAAAC,EAAAC,IAAAC,MAAG,SAAAC,EAAAC,GAAA,IAAAC,EAAA,OAAAJ,IAAAK,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAAa,OAAJJ,EAAID,EAAJC,KAAIE,EAAAG,iBAEzB,SACLC,EACAC,EACAH,GAEA,IAAKE,EAAIE,QAAQC,cACf,OAAOF,EACJG,OAAO,KACPC,KAAK,CAAED,OAAQ,kBAAmBE,MAAO,gBAE9C,IAAMC,EAAQP,EAAIE,QAAQC,cAAcK,QAAQ,SAAU,IAC1D,IACE,IAAMC,EAAUC,EAAIC,OAAOJ,EAAOb,GAClCM,EAAIY,KAAOH,EAiBXX,IACA,MAAOe,GACP,OAAIA,GAA4B,uBAAnBA,SAAAA,EAAOC,SACXb,EAAIG,OAAO,KAAKC,KAAK,CAC1BD,OAAQ,gBACRU,QAAS,uBACTD,MAAOA,EACPP,MAAO,gBAGJL,EAAIG,OAAO,KAAKC,KAAK,CAC1BD,OAAQ,gBACRU,QAAS,wBACTD,MAAOA,EACPP,MAAO,oBAGZ,OAAA,UAAA,OAAAV,EAAAmB,UAAAvB,OACF,gBAlDiBwB,GAAA,OAAA5B,EAAA6B,WAAAC"}
|
|
@@ -396,7 +396,7 @@ var dauth = /*#__PURE__*/function () {
|
|
|
396
396
|
// console.log('getDauthUser error', error);
|
|
397
397
|
// return next();
|
|
398
398
|
// })
|
|
399
|
-
|
|
399
|
+
next();
|
|
400
400
|
} catch (error) {
|
|
401
401
|
if (error && (error == null ? void 0 : error.message) === 'jwt expired') {
|
|
402
402
|
return res.status(500).send({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dauth-md-node.esm.js","sources":["../src/index.ts"],"sourcesContent":["import {\n Request,\n NextFunction,\n Response as ExpressResponse,\n Handler,\n} from 'express';\nimport mongoose from 'mongoose';\nimport jwt from 'jsonwebtoken';\n// import fetch from 'node-fetch';\n// const fetch = require('node-fetch');\n\nexport interface IAccessToken {\n _id: string | mongoose.Types.ObjectId;\n sid: string;\n name: string;\n lastname: string;\n email: string;\n createToken?: number;\n exp?: number;\n iat?: number;\n}\n\ninterface IRequestUser extends Request {\n user: IAccessToken;\n files: {\n image: { path: string };\n avatar: { path: string };\n };\n headers: {\n authorization: string;\n };\n}\n\ninterface TCustomResponse extends ExpressResponse {\n status(code: number): any;\n send(body?: any): any;\n}\n\n// async function getUser(token: string) {\n// const params = {\n// method: \"GET\",\n// headers: {\n// Authorization: token,\n// \"Content-Type\": \"application/json\",\n// }\n// }\n// const response = await fetch(`http://localhost:4012/api/v1/get-tenant-user/easymediacloud`, params)\n// const data = await response.json()\n// return { response, data }\n// }\n\n// async function getDauthUser() {\n// const getUserFetch = await getUser()\n// if (getUserFetch.response.status === 404) {\n// return 404\n// // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n// }\n// if (getUserFetch.response.status === 500) {\n// return 500\n// // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n// }\n// if (getUserFetch.response.status === 200) {\n// // req.user = getUserFetch.data as any\n// // console.log('node-fetch', req.user);\n// // next()\n// return getUserFetch.data\n// }\n// return null\n// }\n\nexport const dauth = async ({ ssid }: { ssid: string }) => {\n // const getUser = await getDauthUser()\n return (\n req: IRequestUser,\n res: TCustomResponse,\n next: NextFunction\n ): Handler | void => {\n if (!req.headers.authorization) {\n return res\n .status(403)\n .send({ status: 'token-not-found', mdKey: 'ensure_auth' });\n }\n const token = req.headers.authorization.replace(/['\"]+/g, '');\n try {\n const payload = jwt.verify(token, ssid as string) as IAccessToken;\n req.user = payload;\n // getUser(token).then((getUserFetch: any) => {\n // if (getUserFetch.response.status === 404) {\n // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n // }\n // if (getUserFetch.response.status === 500) {\n // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n // }\n // if (getUserFetch.response.status === 200) {\n // req.user = getUserFetch.data\n // console.log('node-fetch npm', req.user);\n // }\n // return next();\n // }).catch((error: any) => {\n // console.log('getDauthUser error', error);\n // return next();\n // })\n
|
|
1
|
+
{"version":3,"file":"dauth-md-node.esm.js","sources":["../src/index.ts"],"sourcesContent":["import {\n Request,\n NextFunction,\n Response as ExpressResponse,\n Handler,\n} from 'express';\nimport mongoose from 'mongoose';\nimport jwt from 'jsonwebtoken';\n// import fetch from 'node-fetch';\n// const fetch = require('node-fetch');\n\nexport interface IAccessToken {\n _id: string | mongoose.Types.ObjectId;\n sid: string;\n name: string;\n lastname: string;\n email: string;\n createToken?: number;\n exp?: number;\n iat?: number;\n}\n\ninterface IRequestUser extends Request {\n user: IAccessToken;\n files: {\n image: { path: string };\n avatar: { path: string };\n };\n headers: {\n authorization: string;\n };\n}\n\ninterface TCustomResponse extends ExpressResponse {\n status(code: number): any;\n send(body?: any): any;\n}\n\n// async function getUser(token: string) {\n// const params = {\n// method: \"GET\",\n// headers: {\n// Authorization: token,\n// \"Content-Type\": \"application/json\",\n// }\n// }\n// const response = await fetch(`http://localhost:4012/api/v1/get-tenant-user/easymediacloud`, params)\n// const data = await response.json()\n// return { response, data }\n// }\n\n// async function getDauthUser() {\n// const getUserFetch = await getUser()\n// if (getUserFetch.response.status === 404) {\n// return 404\n// // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n// }\n// if (getUserFetch.response.status === 500) {\n// return 500\n// // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n// }\n// if (getUserFetch.response.status === 200) {\n// // req.user = getUserFetch.data as any\n// // console.log('node-fetch', req.user);\n// // next()\n// return getUserFetch.data\n// }\n// return null\n// }\n\nexport const dauth = async ({ ssid }: { ssid: string }) => {\n // const getUser = await getDauthUser()\n return (\n req: IRequestUser,\n res: TCustomResponse,\n next: NextFunction\n ): Handler | void => {\n if (!req.headers.authorization) {\n return res\n .status(403)\n .send({ status: 'token-not-found', mdKey: 'ensure_auth' });\n }\n const token = req.headers.authorization.replace(/['\"]+/g, '');\n try {\n const payload = jwt.verify(token, ssid as string) as IAccessToken;\n req.user = payload;\n // getUser(token).then((getUserFetch: any) => {\n // if (getUserFetch.response.status === 404) {\n // return res.status(404).send({ status: 'domain-not-found', message: 'Dauth domain does not exist' });\n // }\n // if (getUserFetch.response.status === 500) {\n // return res.status(500).send({ status: 'error', message: 'Dauth server error' });\n // }\n // if (getUserFetch.response.status === 200) {\n // req.user = getUserFetch.data\n // console.log('node-fetch npm', req.user);\n // }\n // return next();\n // }).catch((error: any) => {\n // console.log('getDauthUser error', error);\n // return next();\n // })\n next();\n } catch (error) {\n if (error && error?.message === 'jwt expired') {\n return res.status(500).send({\n status: 'token-expired',\n message: 'El token ha expirado',\n error: error,\n mdKey: 'ensure_auth',\n });\n }\n return res.status(500).send({\n status: 'token-invalid',\n message: 'El token no es válido',\n error: error,\n mdKey: 'ensure_auth',\n });\n }\n };\n};\n"],"names":["dauth","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_ref","ssid","wrap","_callee$","_context","prev","next","abrupt","req","res","headers","authorization","status","send","mdKey","token","replace","payload","jwt","verify","user","error","message","stop","_x","apply","arguments"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IAEaA,KAAK;EAAA,IAAAC,KAAA,gBAAAC,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAAG,SAAAC,QAAAC,IAAA;IAAA,IAAAC,IAAA;IAAA,OAAAJ,mBAAA,GAAAK,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAASL,IAAI,GAAAD,IAAA,CAAJC,IAAI;UAAA,OAAAG,QAAA,CAAAG,MAAA,WAEzB,UACLC,GAAiB,EACjBC,GAAoB,EACpBH,IAAkB;YAElB,IAAI,CAACE,GAAG,CAACE,OAAO,CAACC,aAAa,EAAE;cAC9B,OAAOF,GAAG,CACPG,MAAM,CAAC,GAAG,CAAC,CACXC,IAAI,CAAC;gBAAED,MAAM,EAAE,iBAAiB;gBAAEE,KAAK,EAAE;eAAe,CAAC;;YAE9D,IAAMC,KAAK,GAAGP,GAAG,CAACE,OAAO,CAACC,aAAa,CAACK,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC7D,IAAI;cACF,IAAMC,OAAO,GAAGC,GAAG,CAACC,MAAM,CAACJ,KAAK,EAAEd,IAAc,CAAiB;cACjEO,GAAG,CAACY,IAAI,GAAGH,OAAO;;;;;;;;;;;;;;;;;cAiBlBX,IAAI,EAAE;aACP,CAAC,OAAOe,KAAK,EAAE;cACd,IAAIA,KAAK,IAAI,CAAAA,KAAK,oBAALA,KAAK,CAAEC,OAAO,MAAK,aAAa,EAAE;gBAC7C,OAAOb,GAAG,CAACG,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC;kBAC1BD,MAAM,EAAE,eAAe;kBACvBU,OAAO,EAAE,sBAAsB;kBAC/BD,KAAK,EAAEA,KAAK;kBACZP,KAAK,EAAE;iBACR,CAAC;;cAEJ,OAAOL,GAAG,CAACG,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC;gBAC1BD,MAAM,EAAE,eAAe;gBACvBU,OAAO,EAAE,uBAAuB;gBAChCD,KAAK,EAAEA,KAAK;gBACZP,KAAK,EAAE;eACR,CAAC;;WAEL;QAAA;QAAA;UAAA,OAAAV,QAAA,CAAAmB,IAAA;;OAAAxB,OAAA;GACF;EAAA,gBAlDYL,KAAKA,CAAA8B,EAAA;IAAA,OAAA7B,KAAA,CAAA8B,KAAA,OAAAC,SAAA;;AAAA;;;;"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -100,7 +100,7 @@ export const dauth = async ({ ssid }: { ssid: string }) => {
|
|
|
100
100
|
// console.log('getDauthUser error', error);
|
|
101
101
|
// return next();
|
|
102
102
|
// })
|
|
103
|
-
|
|
103
|
+
next();
|
|
104
104
|
} catch (error) {
|
|
105
105
|
if (error && error?.message === 'jwt expired') {
|
|
106
106
|
return res.status(500).send({
|