@websanova/vue-auth
Advanced tools
Comparing version 4.1.3 to 4.1.4
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -114,5 +114,4 @@ * Released under the MIT License. | ||
function getProperty(obj, desc, res) { | ||
function getProperty(obj, desc) { | ||
var arr = desc.split('.'); | ||
res = res || []; | ||
@@ -576,3 +575,3 @@ while (arr.length) { | ||
cb.call(__auth, authRedirect); | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, __auth.$vm.state.data[rolesKey])) { | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, getProperty(__auth.$vm.state.data || {}, rolesKey))) { | ||
__auth.transitionRedirectType = 403; | ||
@@ -579,0 +578,0 @@ |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -112,5 +112,4 @@ * Released under the MIT License. | ||
function getProperty(obj, desc, res) { | ||
function getProperty(obj, desc) { | ||
var arr = desc.split('.'); | ||
res = res || []; | ||
@@ -574,3 +573,3 @@ while (arr.length) { | ||
cb.call(__auth, authRedirect); | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, __auth.$vm.state.data[rolesKey])) { | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, getProperty(__auth.$vm.state.data || {}, rolesKey))) { | ||
__auth.transitionRedirectType = 403; | ||
@@ -577,0 +576,0 @@ |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -118,5 +118,4 @@ * Released under the MIT License. | ||
function getProperty(obj, desc, res) { | ||
function getProperty(obj, desc) { | ||
var arr = desc.split('.'); | ||
res = res || []; | ||
@@ -580,3 +579,3 @@ while (arr.length) { | ||
cb.call(__auth, authRedirect); | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, __auth.$vm.state.data[rolesKey])) { | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, getProperty(__auth.$vm.state.data || {}, rolesKey))) { | ||
__auth.transitionRedirectType = 403; | ||
@@ -583,0 +582,0 @@ |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -7,2 +7,2 @@ * Released under the MIT License. | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueAuth=e()}(this,function(){"use strict";function s(t){return null!==t&&"object"==typeof t&&t.constructor!==Array}function c(t){return"string"==typeof t||"number"==typeof t?[t]:t}function u(t,e){var n,r,o,i={};for(o in e=e||{},t)s(t[o])&&"FormData"!==t[o].constructor.name?i[o]=u(t[o],{}):i[o]=t[o];for(n=0,r=(e=e.constructor!==Array?[e]:e).length;n<r;n++)for(o in e[n])s(e[n][o])&&"FormData"!==e[n][o].constructor.name?i[o]=u(t[o]||{},[e[n][o]]):i[o]=e[n][o];return i}function l(t,e){var n,r,o;if("[object Object]"===Object.prototype.toString.call(t)&&"[object Object]"===Object.prototype.toString.call(e)){for(o in t)if(l(t[o],e[o]))return!0;return!1}if(t=c(t),e=c(e),!t||!e||t.constructor!==Array||e.constructor!==Array)return!1;for(n=0,r=t.length;n<r;n++)if(0<=e.indexOf(t[n]))return!0;return!1}function o(t,e,n){var r,o=t+"="+e+";";for(r in n)!1!==n[r]&&void 0!==n[r]&&(null===n[r]?this.options["getCookie"+r]&&(o+=" "+r+"="+this.options["getCookie"+r]()+";"):!0===n[r]?o+=" "+r+";":o+=" "+r+"="+n[r]+";");document.cookie=o}function i(t){return"string"!=typeof t&&null!=t?new Date((new Date).getTime()+t).toUTCString():t}function e(t){var e=Object.assign({},this.options.cookie);e.Expires=i(-12096e5),o.call(this,t,"",e)}var p=Object.freeze({get:function(t){for(var e=document.cookie,n=0,r=(e=e.replace(/;\s+/g,";").split(";").map(function(t){return t.replace(/\s+=\s+/g,"=").split("=")})).length;n<r;n++)if(e[n][0]&&e[n][0]===t)return e[n][1];return null},set:function(t,e,n){var r=this.options.cookie;r.Expires=!0===n?"":i(r.Expires),o.call(this,t,e,r)},remove:e});var d=Object.freeze({get:function(t){return sessionStorage.getItem(t)||localStorage.getItem(t)},set:function(t,e,n){(n?sessionStorage:localStorage).setItem(t,e)},remove:function(t){localStorage.removeItem(t),sessionStorage.removeItem(t)}});function r(t,e,n,r){var o=0,i=this.options.stores,a=i.length,s=[function(t){return(t=t||this.currentToken)?t:this.impersonating()?this.options.tokenImpersonateKey:this.options.tokenDefaultKey}.call(this,e)];for("set"===t&&(s.push(n),s.push(!0===r));o<a;o++){if("function"==typeof i[o][t])return i[o][t].apply(this,s);if("storage"===i[o]&&function(){try{if(!window.localStorage)throw"exception";return localStorage.setItem("storage_test",1),localStorage.removeItem("storage_test"),1}catch(t){return}}()&&function(){try{if(!window.sessionStorage)throw"exception";return sessionStorage.setItem("storage_test",1),sessionStorage.removeItem("storage_test"),1}catch(t){return}}())return d[t].apply(this,s);if("cookie"===i[o])return p[t].apply(this,s)}}function f(t){return r.call(this,"get",t)}function h(t,e,n){return r.call(this,"set",t,e,n)}function a(t){return r.call(this,"remove",t)}var m=null,n={rolesKey:"roles",rememberKey:"auth_remember",staySignedInKey:"auth_stay_signed_in",tokenDefaultKey:"auth_token_default",tokenImpersonateKey:"auth_token_impersonate",stores:["storage","cookie"],cookie:{Path:"/",Domain:null,Secure:!0,Expires:12096e5,SameSite:"None"},authRedirect:{path:"/login"},forbiddenRedirect:{path:"/403"},notFoundRedirect:{path:"/404"},registerData:{url:"auth/register",method:"POST",redirect:"/login",autoLogin:!1},loginData:{url:"auth/login",method:"POST",redirect:"/",fetchUser:!0,staySignedIn:!0},logoutData:{url:"auth/logout",method:"POST",redirect:"/",makeRequest:!1},fetchData:{url:"auth/user",method:"GET",enabled:!0},refreshData:{url:"auth/refresh",method:"GET",enabled:!0,interval:30},impersonateData:{url:"auth/impersonate",method:"POST",redirect:"/",fetchUser:!0},unimpersonateData:{url:"auth/unimpersonate",method:"POST",redirect:"/admin",fetchUser:!0,makeRequest:!1},oauth2Data:{url:"auth/social",method:"POST",redirect:"/",fetchUser:!0},getUrl:g,getCookieDomain:function(){return window.location.hostname},parseUserData:function(t){return t.data||{}}};function t(t,e){return!0===m.$vm.state.authenticated&&(!t||l(t,function(t,e){var n=e.split(".");for(0;n.length;)t=t[n.shift()];return t}(m.$vm.state.data||{},e||m.options.rolesKey)))}function v(){return!f.call(m)}function y(t){var e;return t.to?e=t.to.auth:(t=t.matched.filter(function(t){return Object.prototype.hasOwnProperty.call(t.meta,"auth")})).length&&(e=t[t.length-1].meta.auth),e}function g(){var t=window.location.port;return window.location.protocol+"//"+window.location.hostname+(t?":"+t:"")}function b(t){m.$vm.state.loaded=!0,m.$vm.state.authenticated=t}function w(t){!0===t?h.call(m,m.options.staySignedInKey,"true",!1):a.call(m,m.options.staySignedInKey)}function k(t){t?(h.call(m,m.options.rememberKey,t,!1),m.$vm.state.remember=t):(a.call(m,m.options.rememberKey),m.$vm.state.remember=null)}function D(t){m.transitionPrev=m.transitionThis,m.transitionThis=t}function S(t){return m.options.parseUserData(m.drivers.http.httpData(t))}function I(t){var e;return t&&t.ignoreVueAuth||(!1===t.impersonating&&m.impersonating()&&(e=m.options.tokenDefaultKey),(e=f.call(m,e))&&m.drivers.auth.request.call(m,t,e)),t}function T(t,e){e&&e.ignoreVueAuth||(function(t,e){var n,r,o="",i=e&&e.path;if(i&&e.query){for(n in e.query)e.query[n]&&(o+="&"+n+"="+e.query[n]);i+="?"+o.substring(1)}m.drivers.http.invalidToken&&m.drivers.http.invalidToken.call(m,t)&&(e&&(r=y(e)),O({redirect:i=r?r.redirect||m.options.authRedirect:i}))}(t,m.transitionThis),(t=m.drivers.auth.response.call(m,t))&&h.call(m,null,t,!f.call(m,m.options.staySignedInKey)))}function $(t){var e=v();e&&m.$vm.state.authenticated&&O(),e||m.$vm.state.loaded||!m.options.refreshData.enabled?K(t):m.refresh().then(function(){K(t)})}function K(t){return null===m.$vm.state.authenticated&&f.call(m)?m.options.fetchData.enabled?void m.fetch().then(t,t):(P({}),t.call(m)):(m.$vm.state.loaded=!0,t.call(m))}function R(t,e,n){var r=(e||"").redirect||m.options.authRedirect,o=(e||"").forbiddenRedirect||(e||"").redirect||m.options.forbiddenRedirect,i=(e||"").notFoundRedirect||(e||"").redirect||m.options.notFoundRedirect,a=(e||"").rolesKey||m.options.rolesKey;if((e=c(void 0!==(e||"").roles?e.roles:e))&&(!0===e||e.constructor===Array||s(e)))if(m.check()){if(e.constructor!==Array&&!s(e)||l(e,m.$vm.state.data[a]))return m.$vm.state.redirect=m.transitionRedirectType?{type:m.transitionRedirectType,from:m.transitionPrev,to:m.transitionThis}:null,m.transitionRedirectType=null,n();m.transitionRedirectType=403,"function"==typeof o&&(o=o(t)),n.call(m,o)}else m.transitionRedirectType=401,"function"==typeof r&&(r=r(t)),n.call(m,r);else{if(!1!==e||!m.check())return m.$vm.state.redirect=m.transitionRedirectType?{type:m.transitionRedirectType,from:m.transitionPrev,to:m.transitionThis}:null,m.transitionRedirectType=null,n();m.transitionRedirectType=404,"function"==typeof i&&(i=i(t)),n.call(m,i)}}function P(t,e){m.$vm.state.data=t,b(!0),U(e)}function O(t){e.call(m,m.options.tokenImpersonateKey),e.call(m,m.options.tokenDefaultKey),a.call(m,m.options.tokenImpersonateKey),a.call(m,m.options.tokenDefaultKey),a.call(m,m.options.staySignedInKey),m.$vm.state.loaded=!0,m.$vm.state.authenticated=!1,m.$vm.state.data=null,U(t)}function U(t){t&&m.drivers.router.routerGo.call(m,t)}function _(t,e){(m=this).plugins=(e=e||{}).plugins,this.drivers=e.drivers,this.options=u(n,e.options),delete e.plugins,delete e.drivers,delete e.options,this.currentToken=null,this.transitionPrev=null,this.transitionThis=null,this.transitionRedirectType=null,function(){for(var t,e=["auth","http","router"],n=0,r=e.length;n<r;n++){if(!m.drivers[e[n]])return console.error('Error (@websanova/vue-auth): "'+e[n]+'" driver must be set.');if(m.drivers[e[n]].init&&(t=m.drivers[e[n]].init.call(m)))return console.error("Error (@websanova/vue-auth): "+t)}}(),m.$vm=new t({data:function(){return{state:{data:null,loaded:!1,redirect:null,authenticated:null,impersonating:void 0,remember:void 0}}}}),m.options.refreshData.enabled&&0<m.options.refreshData.interval&&setInterval(function(){m.options.refreshData.enabled&&!v()&&m.refresh()},1e3*m.options.refreshData.interval*60),m.drivers.http.interceptor.call(m,I,T),m.drivers.router.beforeEach.call(m,$,R,D,y)}function j(t,e){t.auth=new _(t,e),Object.defineProperties(t.prototype,{$auth:{get:function(){return t.auth}}})}return _.prototype.ready=function(){return m.$vm.state.loaded},_.prototype.load=function(){return new Promise(function(t){var e=null,e=setInterval(function(){m.$vm.state.loaded&&(clearInterval(e),t())},50)})},_.prototype.redirect=function(){return m.$vm.state.redirect},_.prototype.user=function(t){return void 0!==t&&P(t),m.$vm.state.data},_.prototype.check=t,_.prototype.impersonating=function(){var t=!!f.call(m,m.options.tokenImpersonateKey);return void 0===m.$vm.state.impersonating&&(m.$vm.state.impersonating=t),m.$vm.state.impersonating},_.prototype.token=function(t,e,n){return void 0!==e&&(null===e?a.call(m,t):(n=!0===n||!1===n?n:!f.call(m,m.options.staySignedInKey),h.call(m,t,e,n))),f.call(m,t)},_.prototype.fetch=function(n){return n=u(m.options.fetchData,n),new Promise(function(e,t){m.drivers.http.http.call(m,n).then(function(t){P(S(t),n.redirect),e(t)},t)})},_.prototype.refresh=function(t){return t=u(m.options.refreshData,t),m.drivers.http.http.call(m,t)},_.prototype.register=function(o){var i=u(m.options.registerData,o);return!0!==i.autoLogin&&(k(i.remember),w(i.staySignedIn)),new Promise(function(n,r){m.drivers.http.http.call(m,i).then(function(t){var e;i.autoLogin?(e=u(m.options.loginData,o),m.login(e).then(n,r)):(n(t),U(i.redirect))},r)})},_.prototype.login=function(r){return k((r=u(m.options.loginData,r)).remember),w(r.staySignedIn),new Promise(function(e,n){m.drivers.http.http.call(m,r).then(function(t){r.fetchUser||void 0===r.fetchUser&&m.options.fetchData.enabled?m.fetch({redirect:r.redirect}).then(e,n):(P(S(t),r.redirect),e(t))},function(t){b(!1),n(t)})})},_.prototype.remember=function(t){t&&k(t);t=f.call(m,m.options.rememberKey);return void 0===m.$vm.state.remember&&(m.$vm.state.remember=t),m.$vm.state.remember},_.prototype.unremember=function(){k(null)},_.prototype.logout=function(n){return n=u(m.options.logoutData,n),new Promise(function(e,t){n.makeRequest?m.drivers.http.http.call(m,n).then(function(t){O(n.redirect),e(t)},t):(O(n.redirect),e())})},_.prototype.impersonate=function(a){return a=u(m.options.impersonateData,a),new Promise(function(r,o){var i=m.token();m.drivers.http.http.call(m,a).then(function(t){var e,n;e=i,h.call(m,m.options.tokenImpersonateKey,m.token(),!f.call(m,m.options.staySignedInKey)),h.call(m,m.options.tokenDefaultKey,e,!f.call(m,m.options.staySignedInKey)),m.$vm.state.impersonating=!0,U(n),a.fetchUser||void 0===a.fetchUser&&m.options.fetchData.enabled?m.fetch({redirect:a.redirect}).then(r,o):(U(a.redirect),r(t))},o)})},_.prototype.unimpersonate=function(n){return n=u(m.options.unimpersonateData,n),new Promise(function(t,e){n.makeRequest?m.drivers.http.http.call(m,n).then(t,e):t()}).then(function(){return new Promise(function(t,e){a.call(m,m.options.tokenImpersonateKey),m.$vm.state.impersonating=!1,U(void 0),n.fetchUser||void 0===n.fetchUser&&m.options.fetchData.enabled?m.fetch({redirect:n.redirect}).then(t,e):(U(n.redirect),t())})})},_.prototype.oauth2=function(t,e){var n,r="";if(e.code){try{e.state&&(e.state=JSON.parse(decodeURIComponent(e.state)))}catch(t){console.error("vue-auth:error There was an issue retrieving the state data."),e.state=e.state||{}}return delete(e=u(m.options.oauth2Data,[e.state,e])).code,delete e.state,delete e.params,m.login(e)}for(n in(e=u(m.drivers.oauth2[t],e)).params.state=JSON.stringify(e.params.state||{}),e.params.redirect_uri=(t=e.params.redirect_uri,/^https?:\/\//.test(t=t||"")?t:g()+"/"+t.replace(/^\/|\/$/g,"")),e.params)r+="&"+n+"="+encodeURIComponent(e.params[n]);window.open(e.url+"?"+r.substring(),(e.window||{}).name||"_self",(e.window||{}).specs||{},!1!==(e.window||{}).replace)},_.prototype.enableImpersonate=function(){m.impersonating()&&(m.currentToken=null)},_.prototype.disableImpersonate=function(){m.impersonating()&&(m.currentToken=m.options.tokenDefaultKey)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(j),j}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueAuth=e()}(this,function(){"use strict";function s(t){return null!==t&&"object"==typeof t&&t.constructor!==Array}function c(t){return"string"==typeof t||"number"==typeof t?[t]:t}function u(t,e){var n,r,o,i={};for(o in e=e||{},t)s(t[o])&&"FormData"!==t[o].constructor.name?i[o]=u(t[o],{}):i[o]=t[o];for(n=0,r=(e=e.constructor!==Array?[e]:e).length;n<r;n++)for(o in e[n])s(e[n][o])&&"FormData"!==e[n][o].constructor.name?i[o]=u(t[o]||{},[e[n][o]]):i[o]=e[n][o];return i}function l(t,e){var n,r,o;if("[object Object]"===Object.prototype.toString.call(t)&&"[object Object]"===Object.prototype.toString.call(e)){for(o in t)if(l(t[o],e[o]))return!0;return!1}if(t=c(t),e=c(e),!t||!e||t.constructor!==Array||e.constructor!==Array)return!1;for(n=0,r=t.length;n<r;n++)if(0<=e.indexOf(t[n]))return!0;return!1}function p(t,e){for(var n=e.split(".");n.length;)t=t[n.shift()];return t}function o(t,e,n){var r,o=t+"="+e+";";for(r in n)!1!==n[r]&&void 0!==n[r]&&(null===n[r]?this.options["getCookie"+r]&&(o+=" "+r+"="+this.options["getCookie"+r]()+";"):!0===n[r]?o+=" "+r+";":o+=" "+r+"="+n[r]+";");document.cookie=o}function i(t){return"string"!=typeof t&&null!=t?new Date((new Date).getTime()+t).toUTCString():t}function e(t){var e=Object.assign({},this.options.cookie);e.Expires=i(-12096e5),o.call(this,t,"",e)}var d=Object.freeze({get:function(t){for(var e=document.cookie,n=0,r=(e=e.replace(/;\s+/g,";").split(";").map(function(t){return t.replace(/\s+=\s+/g,"=").split("=")})).length;n<r;n++)if(e[n][0]&&e[n][0]===t)return e[n][1];return null},set:function(t,e,n){var r=this.options.cookie;r.Expires=!0===n?"":i(r.Expires),o.call(this,t,e,r)},remove:e});var f=Object.freeze({get:function(t){return sessionStorage.getItem(t)||localStorage.getItem(t)},set:function(t,e,n){(n?sessionStorage:localStorage).setItem(t,e)},remove:function(t){localStorage.removeItem(t),sessionStorage.removeItem(t)}});function r(t,e,n,r){var o=0,i=this.options.stores,a=i.length,s=[function(t){return(t=t||this.currentToken)?t:this.impersonating()?this.options.tokenImpersonateKey:this.options.tokenDefaultKey}.call(this,e)];for("set"===t&&(s.push(n),s.push(!0===r));o<a;o++){if("function"==typeof i[o][t])return i[o][t].apply(this,s);if("storage"===i[o]&&function(){try{if(!window.localStorage)throw"exception";return localStorage.setItem("storage_test",1),localStorage.removeItem("storage_test"),1}catch(t){return}}()&&function(){try{if(!window.sessionStorage)throw"exception";return sessionStorage.setItem("storage_test",1),sessionStorage.removeItem("storage_test"),1}catch(t){return}}())return f[t].apply(this,s);if("cookie"===i[o])return d[t].apply(this,s)}}function h(t){return r.call(this,"get",t)}function m(t,e,n){return r.call(this,"set",t,e,n)}function a(t){return r.call(this,"remove",t)}var v=null,n={rolesKey:"roles",rememberKey:"auth_remember",staySignedInKey:"auth_stay_signed_in",tokenDefaultKey:"auth_token_default",tokenImpersonateKey:"auth_token_impersonate",stores:["storage","cookie"],cookie:{Path:"/",Domain:null,Secure:!0,Expires:12096e5,SameSite:"None"},authRedirect:{path:"/login"},forbiddenRedirect:{path:"/403"},notFoundRedirect:{path:"/404"},registerData:{url:"auth/register",method:"POST",redirect:"/login",autoLogin:!1},loginData:{url:"auth/login",method:"POST",redirect:"/",fetchUser:!0,staySignedIn:!0},logoutData:{url:"auth/logout",method:"POST",redirect:"/",makeRequest:!1},fetchData:{url:"auth/user",method:"GET",enabled:!0},refreshData:{url:"auth/refresh",method:"GET",enabled:!0,interval:30},impersonateData:{url:"auth/impersonate",method:"POST",redirect:"/",fetchUser:!0},unimpersonateData:{url:"auth/unimpersonate",method:"POST",redirect:"/admin",fetchUser:!0,makeRequest:!1},oauth2Data:{url:"auth/social",method:"POST",redirect:"/",fetchUser:!0},getUrl:b,getCookieDomain:function(){return window.location.hostname},parseUserData:function(t){return t.data||{}}};function y(){return!h.call(v)}function g(t){var e;return t.to?e=t.to.auth:(t=t.matched.filter(function(t){return Object.prototype.hasOwnProperty.call(t.meta,"auth")})).length&&(e=t[t.length-1].meta.auth),e}function b(){var t=window.location.port;return window.location.protocol+"//"+window.location.hostname+(t?":"+t:"")}function w(t){v.$vm.state.loaded=!0,v.$vm.state.authenticated=t}function t(t){!0===t?m.call(v,v.options.staySignedInKey,"true",!1):a.call(v,v.options.staySignedInKey)}function k(t){t?(m.call(v,v.options.rememberKey,t,!1),v.$vm.state.remember=t):(a.call(v,v.options.rememberKey),v.$vm.state.remember=null)}function D(t){v.transitionPrev=v.transitionThis,v.transitionThis=t}function S(t){return v.options.parseUserData(v.drivers.http.httpData(t))}function I(t){var e;return t&&t.ignoreVueAuth||(!1===t.impersonating&&v.impersonating()&&(e=v.options.tokenDefaultKey),(e=h.call(v,e))&&v.drivers.auth.request.call(v,t,e)),t}function T(t,e){e&&e.ignoreVueAuth||(function(t,e){var n,r,o="",i=e&&e.path;if(i&&e.query){for(n in e.query)e.query[n]&&(o+="&"+n+"="+e.query[n]);i+="?"+o.substring(1)}v.drivers.http.invalidToken&&v.drivers.http.invalidToken.call(v,t)&&(e&&(r=g(e)),O({redirect:i=r?r.redirect||v.options.authRedirect:i}))}(t,v.transitionThis),(t=v.drivers.auth.response.call(v,t))&&m.call(v,null,t,!h.call(v,v.options.staySignedInKey)))}function $(t){var e=y();e&&v.$vm.state.authenticated&&O(),e||v.$vm.state.loaded||!v.options.refreshData.enabled?K(t):v.refresh().then(function(){K(t)})}function K(t){return null===v.$vm.state.authenticated&&h.call(v)?v.options.fetchData.enabled?void v.fetch().then(t,t):(P({}),t.call(v)):(v.$vm.state.loaded=!0,t.call(v))}function R(t,e,n){var r=(e||"").redirect||v.options.authRedirect,o=(e||"").forbiddenRedirect||(e||"").redirect||v.options.forbiddenRedirect,i=(e||"").notFoundRedirect||(e||"").redirect||v.options.notFoundRedirect,a=(e||"").rolesKey||v.options.rolesKey;if((e=c(void 0!==(e||"").roles?e.roles:e))&&(!0===e||e.constructor===Array||s(e)))if(v.check()){if(e.constructor!==Array&&!s(e)||l(e,p(v.$vm.state.data||{},a)))return v.$vm.state.redirect=v.transitionRedirectType?{type:v.transitionRedirectType,from:v.transitionPrev,to:v.transitionThis}:null,v.transitionRedirectType=null,n();v.transitionRedirectType=403,"function"==typeof o&&(o=o(t)),n.call(v,o)}else v.transitionRedirectType=401,"function"==typeof r&&(r=r(t)),n.call(v,r);else{if(!1!==e||!v.check())return v.$vm.state.redirect=v.transitionRedirectType?{type:v.transitionRedirectType,from:v.transitionPrev,to:v.transitionThis}:null,v.transitionRedirectType=null,n();v.transitionRedirectType=404,"function"==typeof i&&(i=i(t)),n.call(v,i)}}function P(t,e){v.$vm.state.data=t,w(!0),U(e)}function O(t){e.call(v,v.options.tokenImpersonateKey),e.call(v,v.options.tokenDefaultKey),a.call(v,v.options.tokenImpersonateKey),a.call(v,v.options.tokenDefaultKey),a.call(v,v.options.staySignedInKey),v.$vm.state.loaded=!0,v.$vm.state.authenticated=!1,v.$vm.state.data=null,U(t)}function U(t){t&&v.drivers.router.routerGo.call(v,t)}function _(t,e){(v=this).plugins=(e=e||{}).plugins,this.drivers=e.drivers,this.options=u(n,e.options),delete e.plugins,delete e.drivers,delete e.options,this.currentToken=null,this.transitionPrev=null,this.transitionThis=null,this.transitionRedirectType=null,function(){for(var t,e=["auth","http","router"],n=0,r=e.length;n<r;n++){if(!v.drivers[e[n]])return console.error('Error (@websanova/vue-auth): "'+e[n]+'" driver must be set.');if(v.drivers[e[n]].init&&(t=v.drivers[e[n]].init.call(v)))return console.error("Error (@websanova/vue-auth): "+t)}}(),v.$vm=new t({data:function(){return{state:{data:null,loaded:!1,redirect:null,authenticated:null,impersonating:void 0,remember:void 0}}}}),v.options.refreshData.enabled&&0<v.options.refreshData.interval&&setInterval(function(){v.options.refreshData.enabled&&!y()&&v.refresh()},1e3*v.options.refreshData.interval*60),v.drivers.http.interceptor.call(v,I,T),v.drivers.router.beforeEach.call(v,$,R,D,g)}function j(t,e){t.auth=new _(t,e),Object.defineProperties(t.prototype,{$auth:{get:function(){return t.auth}}})}return _.prototype.ready=function(){return v.$vm.state.loaded},_.prototype.load=function(){return new Promise(function(t){var e=null,e=setInterval(function(){v.$vm.state.loaded&&(clearInterval(e),t())},50)})},_.prototype.redirect=function(){return v.$vm.state.redirect},_.prototype.user=function(t){return void 0!==t&&P(t),v.$vm.state.data},_.prototype.check=function(t,e){return t=t,e=e,!0===v.$vm.state.authenticated&&(!t||l(t,p(v.$vm.state.data||{},e||v.options.rolesKey)))},_.prototype.impersonating=function(){var t=!!h.call(v,v.options.tokenImpersonateKey);return void 0===v.$vm.state.impersonating&&(v.$vm.state.impersonating=t),v.$vm.state.impersonating},_.prototype.token=function(t,e,n){return void 0!==e&&(null===e?a.call(v,t):(n=!0===n||!1===n?n:!h.call(v,v.options.staySignedInKey),m.call(v,t,e,n))),h.call(v,t)},_.prototype.fetch=function(n){return n=u(v.options.fetchData,n),new Promise(function(e,t){v.drivers.http.http.call(v,n).then(function(t){P(S(t),n.redirect),e(t)},t)})},_.prototype.refresh=function(t){return t=u(v.options.refreshData,t),v.drivers.http.http.call(v,t)},_.prototype.register=function(o){var i=u(v.options.registerData,o);return!0!==i.autoLogin&&(k(i.remember),t(i.staySignedIn)),new Promise(function(n,r){v.drivers.http.http.call(v,i).then(function(t){var e;i.autoLogin?(e=u(v.options.loginData,o),v.login(e).then(n,r)):(n(t),U(i.redirect))},r)})},_.prototype.login=function(r){return k((r=u(v.options.loginData,r)).remember),t(r.staySignedIn),new Promise(function(e,n){v.drivers.http.http.call(v,r).then(function(t){r.fetchUser||void 0===r.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:r.redirect}).then(e,n):(P(S(t),r.redirect),e(t))},function(t){w(!1),n(t)})})},_.prototype.remember=function(t){t&&k(t);t=h.call(v,v.options.rememberKey);return void 0===v.$vm.state.remember&&(v.$vm.state.remember=t),v.$vm.state.remember},_.prototype.unremember=function(){k(null)},_.prototype.logout=function(n){return n=u(v.options.logoutData,n),new Promise(function(e,t){n.makeRequest?v.drivers.http.http.call(v,n).then(function(t){O(n.redirect),e(t)},t):(O(n.redirect),e())})},_.prototype.impersonate=function(a){return a=u(v.options.impersonateData,a),new Promise(function(r,o){var i=v.token();v.drivers.http.http.call(v,a).then(function(t){var e,n;e=i,m.call(v,v.options.tokenImpersonateKey,v.token(),!h.call(v,v.options.staySignedInKey)),m.call(v,v.options.tokenDefaultKey,e,!h.call(v,v.options.staySignedInKey)),v.$vm.state.impersonating=!0,U(n),a.fetchUser||void 0===a.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:a.redirect}).then(r,o):(U(a.redirect),r(t))},o)})},_.prototype.unimpersonate=function(n){return n=u(v.options.unimpersonateData,n),new Promise(function(t,e){n.makeRequest?v.drivers.http.http.call(v,n).then(t,e):t()}).then(function(){return new Promise(function(t,e){a.call(v,v.options.tokenImpersonateKey),v.$vm.state.impersonating=!1,U(void 0),n.fetchUser||void 0===n.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:n.redirect}).then(t,e):(U(n.redirect),t())})})},_.prototype.oauth2=function(t,e){var n,r="";if(e.code){try{e.state&&(e.state=JSON.parse(decodeURIComponent(e.state)))}catch(t){console.error("vue-auth:error There was an issue retrieving the state data."),e.state=e.state||{}}return delete(e=u(v.options.oauth2Data,[e.state,e])).code,delete e.state,delete e.params,v.login(e)}for(n in(e=u(v.drivers.oauth2[t],e)).params.state=JSON.stringify(e.params.state||{}),e.params.redirect_uri=(t=e.params.redirect_uri,/^https?:\/\//.test(t=t||"")?t:b()+"/"+t.replace(/^\/|\/$/g,"")),e.params)r+="&"+n+"="+encodeURIComponent(e.params[n]);window.open(e.url+"?"+r.substring(),(e.window||{}).name||"_self",(e.window||{}).specs||{},!1!==(e.window||{}).replace)},_.prototype.enableImpersonate=function(){v.impersonating()&&(v.currentToken=null)},_.prototype.disableImpersonate=function(){v.impersonating()&&(v.currentToken=v.options.tokenDefaultKey)},"undefined"!=typeof window&&window.Vue&&window.Vue.use(j),j}); |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -118,5 +118,4 @@ * Released under the MIT License. | ||
function getProperty(obj, desc, res) { | ||
function getProperty(obj, desc) { | ||
var arr = desc.split('.'); | ||
res = res || []; | ||
@@ -580,3 +579,3 @@ while (arr.length) { | ||
cb.call(__auth, authRedirect); | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, __auth.$vm.state.data[rolesKey])) { | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, getProperty(__auth.$vm.state.data || {}, rolesKey))) { | ||
__auth.transitionRedirectType = 403; | ||
@@ -583,0 +582,0 @@ |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -114,5 +114,4 @@ * Released under the MIT License. | ||
function getProperty(obj, desc, res) { | ||
function getProperty(obj, desc) { | ||
var arr = desc.split('.'); | ||
res = res || []; | ||
@@ -576,3 +575,3 @@ while (arr.length) { | ||
cb.call(__auth, authRedirect); | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, __auth.$vm.state.data[rolesKey])) { | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, getProperty(__auth.$vm.state.data || {}, rolesKey))) { | ||
__auth.transitionRedirectType = 403; | ||
@@ -579,0 +578,0 @@ |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -118,5 +118,4 @@ * Released under the MIT License. | ||
function getProperty(obj, desc, res) { | ||
function getProperty(obj, desc) { | ||
var arr = desc.split('.'); | ||
res = res || []; | ||
@@ -580,3 +579,3 @@ while (arr.length) { | ||
cb.call(__auth, authRedirect); | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, __auth.$vm.state.data[rolesKey])) { | ||
} else if ((routeAuth.constructor === Array || isObject(routeAuth)) && !compare(routeAuth, getProperty(__auth.$vm.state.data || {}, rolesKey))) { | ||
__auth.transitionRedirectType = 403; | ||
@@ -583,0 +582,0 @@ |
/*! | ||
* @websanova/vue-auth v4.1.3 | ||
* @websanova/vue-auth v4.1.4 | ||
* https://websanova.com/docs/vue-auth | ||
@@ -7,2 +7,2 @@ * Released under the MIT License. | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e(t.VueAuth={},t.vue)}(this,function(t,e){"use strict";function s(t){return null!==t&&"object"==typeof t&&t.constructor!==Array}function c(t){return"string"==typeof t||"number"==typeof t?[t]:t}function u(t,e){var n,r,o,i={};for(o in e=e||{},t)s(t[o])&&"FormData"!==t[o].constructor.name?i[o]=u(t[o],{}):i[o]=t[o];for(n=0,r=(e=e.constructor!==Array?[e]:e).length;n<r;n++)for(o in e[n])s(e[n][o])&&"FormData"!==e[n][o].constructor.name?i[o]=u(t[o]||{},[e[n][o]]):i[o]=e[n][o];return i}function l(t,e){var n,r,o;if("[object Object]"===Object.prototype.toString.call(t)&&"[object Object]"===Object.prototype.toString.call(e)){for(o in t)if(l(t[o],e[o]))return!0;return!1}if(t=c(t),e=c(e),!t||!e||t.constructor!==Array||e.constructor!==Array)return!1;for(n=0,r=t.length;n<r;n++)if(0<=e.indexOf(t[n]))return!0;return!1}function o(t,e,n){var r,o=t+"="+e+";";for(r in n)!1!==n[r]&&void 0!==n[r]&&(null===n[r]?this.options["getCookie"+r]&&(o+=" "+r+"="+this.options["getCookie"+r]()+";"):!0===n[r]?o+=" "+r+";":o+=" "+r+"="+n[r]+";");document.cookie=o}function i(t){return"string"!=typeof t&&null!=t?new Date((new Date).getTime()+t).toUTCString():t}function n(t){var e=Object.assign({},this.options.cookie);e.Expires=i(-12096e5),o.call(this,t,"",e)}var p=Object.freeze({get:function(t){for(var e=document.cookie,n=0,r=(e=e.replace(/;\s+/g,";").split(";").map(function(t){return t.replace(/\s+=\s+/g,"=").split("=")})).length;n<r;n++)if(e[n][0]&&e[n][0]===t)return e[n][1];return null},set:function(t,e,n){var r=this.options.cookie;r.Expires=!0===n?"":i(r.Expires),o.call(this,t,e,r)},remove:n});var d=Object.freeze({get:function(t){return sessionStorage.getItem(t)||localStorage.getItem(t)},set:function(t,e,n){(n?sessionStorage:localStorage).setItem(t,e)},remove:function(t){localStorage.removeItem(t),sessionStorage.removeItem(t)}});function r(t,e,n,r){var o=0,i=this.options.stores,a=i.length,s=[function(t){return(t=t||this.currentToken)?t:this.impersonating()?this.options.tokenImpersonateKey:this.options.tokenDefaultKey}.call(this,e)];for("set"===t&&(s.push(n),s.push(!0===r));o<a;o++){if("function"==typeof i[o][t])return i[o][t].apply(this,s);if("storage"===i[o]&&function(){try{if(!window.localStorage)throw"exception";return localStorage.setItem("storage_test",1),localStorage.removeItem("storage_test"),1}catch(t){return}}()&&function(){try{if(!window.sessionStorage)throw"exception";return sessionStorage.setItem("storage_test",1),sessionStorage.removeItem("storage_test"),1}catch(t){return}}())return d[t].apply(this,s);if("cookie"===i[o])return p[t].apply(this,s)}}function f(t){return r.call(this,"get",t)}function h(t,e,n){return r.call(this,"set",t,e,n)}function a(t){return r.call(this,"remove",t)}var m=null,v={rolesKey:"roles",rememberKey:"auth_remember",staySignedInKey:"auth_stay_signed_in",tokenDefaultKey:"auth_token_default",tokenImpersonateKey:"auth_token_impersonate",stores:["storage","cookie"],cookie:{Path:"/",Domain:null,Secure:!0,Expires:12096e5,SameSite:"None"},authRedirect:{path:"/login"},forbiddenRedirect:{path:"/403"},notFoundRedirect:{path:"/404"},registerData:{url:"auth/register",method:"POST",redirect:"/login",autoLogin:!1},loginData:{url:"auth/login",method:"POST",redirect:"/",fetchUser:!0,staySignedIn:!0},logoutData:{url:"auth/logout",method:"POST",redirect:"/",makeRequest:!1},fetchData:{url:"auth/user",method:"GET",enabled:!0},refreshData:{url:"auth/refresh",method:"GET",enabled:!0,interval:30},impersonateData:{url:"auth/impersonate",method:"POST",redirect:"/",fetchUser:!0},unimpersonateData:{url:"auth/unimpersonate",method:"POST",redirect:"/admin",fetchUser:!0,makeRequest:!1},oauth2Data:{url:"auth/social",method:"POST",redirect:"/",fetchUser:!0},getUrl:k,getCookieDomain:function(){return window.location.hostname},parseUserData:function(t){return t.data||{}}};function y(t,e){return!0===m.$vm.state.authenticated&&(!t||l(t,function(t,e){var n=e.split(".");for(0;n.length;)t=t[n.shift()];return t}(m.$vm.state.data||{},e||m.options.rolesKey)))}function g(){return!f.call(m)}function b(t){var e;return t.to?e=t.to.auth:(t=t.matched.filter(function(t){return Object.prototype.hasOwnProperty.call(t.meta,"auth")})).length&&(e=t[t.length-1].meta.auth),e}function k(){var t=window.location.port;return window.location.protocol+"//"+window.location.hostname+(t?":"+t:"")}function D(t){m.$vm.state.loaded=!0,m.$vm.state.authenticated=t}function w(t){!0===t?h.call(m,m.options.staySignedInKey,"true",!1):a.call(m,m.options.staySignedInKey)}function S(t){t?(h.call(m,m.options.rememberKey,t,!1),m.$vm.state.remember=t):(a.call(m,m.options.rememberKey),m.$vm.state.remember=null)}function I(t){m.transitionPrev=m.transitionThis,m.transitionThis=t}function T(t){return m.options.parseUserData(m.drivers.http.httpData(t))}function $(t){var e;return t&&t.ignoreVueAuth||(!1===t.impersonating&&m.impersonating()&&(e=m.options.tokenDefaultKey),(e=f.call(m,e))&&m.drivers.auth.request.call(m,t,e)),t}function K(t,e){e&&e.ignoreVueAuth||(function(t,e){var n,r,o="",i=e&&e.path;if(i&&e.query){for(n in e.query)e.query[n]&&(o+="&"+n+"="+e.query[n]);i+="?"+o.substring(1)}m.drivers.http.invalidToken&&m.drivers.http.invalidToken.call(m,t)&&(e&&(r=b(e)),U({redirect:i=r?r.redirect||m.options.authRedirect:i}))}(t,m.transitionThis),(t=m.drivers.auth.response.call(m,t))&&h.call(m,null,t,!f.call(m,m.options.staySignedInKey)))}function R(t){var e=g();e&&m.$vm.state.authenticated&&U(),e||m.$vm.state.loaded||!m.options.refreshData.enabled?P(t):m.refresh().then(function(){P(t)})}function P(t){return null===m.$vm.state.authenticated&&f.call(m)?m.options.fetchData.enabled?void m.fetch().then(t,t):(_({}),t.call(m)):(m.$vm.state.loaded=!0,t.call(m))}function O(t,e,n){var r=(e||"").redirect||m.options.authRedirect,o=(e||"").forbiddenRedirect||(e||"").redirect||m.options.forbiddenRedirect,i=(e||"").notFoundRedirect||(e||"").redirect||m.options.notFoundRedirect,a=(e||"").rolesKey||m.options.rolesKey;if((e=c(void 0!==(e||"").roles?e.roles:e))&&(!0===e||e.constructor===Array||s(e)))if(m.check()){if(e.constructor!==Array&&!s(e)||l(e,m.$vm.state.data[a]))return m.$vm.state.redirect=m.transitionRedirectType?{type:m.transitionRedirectType,from:m.transitionPrev,to:m.transitionThis}:null,m.transitionRedirectType=null,n();m.transitionRedirectType=403,"function"==typeof o&&(o=o(t)),n.call(m,o)}else m.transitionRedirectType=401,"function"==typeof r&&(r=r(t)),n.call(m,r);else{if(!1!==e||!m.check())return m.$vm.state.redirect=m.transitionRedirectType?{type:m.transitionRedirectType,from:m.transitionPrev,to:m.transitionThis}:null,m.transitionRedirectType=null,n();m.transitionRedirectType=404,"function"==typeof i&&(i=i(t)),n.call(m,i)}}function _(t,e){m.$vm.state.data=t,D(!0),j(e)}function U(t){n.call(m,m.options.tokenImpersonateKey),n.call(m,m.options.tokenDefaultKey),a.call(m,m.options.tokenImpersonateKey),a.call(m,m.options.tokenDefaultKey),a.call(m,m.options.staySignedInKey),m.$vm.state.loaded=!0,m.$vm.state.authenticated=!1,m.$vm.state.data=null,j(t)}function j(t){t&&m.drivers.router.routerGo.call(m,t)}function A(t,e){(m=this).plugins=(e=e||{}).plugins,this.drivers=e.drivers,this.options=u(v,e.options),delete e.plugins,delete e.drivers,delete e.options,this.currentToken=null,this.transitionPrev=null,this.transitionThis=null,this.transitionRedirectType=null,function(){for(var t,e=["auth","http","router"],n=0,r=e.length;n<r;n++){if(!m.drivers[e[n]])return console.error('Error (@websanova/vue-auth): "'+e[n]+'" driver must be set.');if(m.drivers[e[n]].init&&(t=m.drivers[e[n]].init.call(m)))return console.error("Error (@websanova/vue-auth): "+t)}}(),m.$vm=new t({data:function(){return{state:{data:null,loaded:!1,redirect:null,authenticated:null,impersonating:void 0,remember:void 0}}}}),m.options.refreshData.enabled&&0<m.options.refreshData.interval&&setInterval(function(){m.options.refreshData.enabled&&!g()&&m.refresh()},1e3*m.options.refreshData.interval*60),m.drivers.http.interceptor.call(m,$,K),m.drivers.router.beforeEach.call(m,R,O,I,b)}A.prototype.ready=function(){return m.$vm.state.loaded},A.prototype.load=function(){return new Promise(function(t){var e=null,e=setInterval(function(){m.$vm.state.loaded&&(clearInterval(e),t())},50)})},A.prototype.redirect=function(){return m.$vm.state.redirect},A.prototype.user=function(t){return void 0!==t&&_(t),m.$vm.state.data},A.prototype.check=y,A.prototype.impersonating=function(){var t=!!f.call(m,m.options.tokenImpersonateKey);return void 0===m.$vm.state.impersonating&&(m.$vm.state.impersonating=t),m.$vm.state.impersonating},A.prototype.token=function(t,e,n){return void 0!==e&&(null===e?a.call(m,t):(n=!0===n||!1===n?n:!f.call(m,m.options.staySignedInKey),h.call(m,t,e,n))),f.call(m,t)},A.prototype.fetch=function(n){return n=u(m.options.fetchData,n),new Promise(function(e,t){m.drivers.http.http.call(m,n).then(function(t){_(T(t),n.redirect),e(t)},t)})},A.prototype.refresh=function(t){return t=u(m.options.refreshData,t),m.drivers.http.http.call(m,t)},A.prototype.register=function(o){var i=u(m.options.registerData,o);return!0!==i.autoLogin&&(S(i.remember),w(i.staySignedIn)),new Promise(function(n,r){m.drivers.http.http.call(m,i).then(function(t){var e;i.autoLogin?(e=u(m.options.loginData,o),m.login(e).then(n,r)):(n(t),j(i.redirect))},r)})},A.prototype.login=function(r){return S((r=u(m.options.loginData,r)).remember),w(r.staySignedIn),new Promise(function(e,n){m.drivers.http.http.call(m,r).then(function(t){r.fetchUser||void 0===r.fetchUser&&m.options.fetchData.enabled?m.fetch({redirect:r.redirect}).then(e,n):(_(T(t),r.redirect),e(t))},function(t){D(!1),n(t)})})},A.prototype.remember=function(t){t&&S(t);t=f.call(m,m.options.rememberKey);return void 0===m.$vm.state.remember&&(m.$vm.state.remember=t),m.$vm.state.remember},A.prototype.unremember=function(){S(null)},A.prototype.logout=function(n){return n=u(m.options.logoutData,n),new Promise(function(e,t){n.makeRequest?m.drivers.http.http.call(m,n).then(function(t){U(n.redirect),e(t)},t):(U(n.redirect),e())})},A.prototype.impersonate=function(a){return a=u(m.options.impersonateData,a),new Promise(function(r,o){var i=m.token();m.drivers.http.http.call(m,a).then(function(t){var e,n;e=i,h.call(m,m.options.tokenImpersonateKey,m.token(),!f.call(m,m.options.staySignedInKey)),h.call(m,m.options.tokenDefaultKey,e,!f.call(m,m.options.staySignedInKey)),m.$vm.state.impersonating=!0,j(n),a.fetchUser||void 0===a.fetchUser&&m.options.fetchData.enabled?m.fetch({redirect:a.redirect}).then(r,o):(j(a.redirect),r(t))},o)})},A.prototype.unimpersonate=function(n){return n=u(m.options.unimpersonateData,n),new Promise(function(t,e){n.makeRequest?m.drivers.http.http.call(m,n).then(t,e):t()}).then(function(){return new Promise(function(t,e){a.call(m,m.options.tokenImpersonateKey),m.$vm.state.impersonating=!1,j(void 0),n.fetchUser||void 0===n.fetchUser&&m.options.fetchData.enabled?m.fetch({redirect:n.redirect}).then(t,e):(j(n.redirect),t())})})},A.prototype.oauth2=function(t,e){var n,r="";if(e.code){try{e.state&&(e.state=JSON.parse(decodeURIComponent(e.state)))}catch(t){console.error("vue-auth:error There was an issue retrieving the state data."),e.state=e.state||{}}return delete(e=u(m.options.oauth2Data,[e.state,e])).code,delete e.state,delete e.params,m.login(e)}for(n in(e=u(m.drivers.oauth2[t],e)).params.state=JSON.stringify(e.params.state||{}),e.params.redirect_uri=(t=e.params.redirect_uri,/^https?:\/\//.test(t=t||"")?t:k()+"/"+t.replace(/^\/|\/$/g,"")),e.params)r+="&"+n+"="+encodeURIComponent(e.params[n]);window.open(e.url+"?"+r.substring(),(e.window||{}).name||"_self",(e.window||{}).specs||{},!1!==(e.window||{}).replace)},A.prototype.enableImpersonate=function(){m.impersonating()&&(m.currentToken=null)},A.prototype.disableImpersonate=function(){m.impersonating()&&(m.currentToken=m.options.tokenDefaultKey)};function q(t){t=t.data();this.state=e.reactive(t.state)}A.prototype.install=function(t,e){t.provide(e||"auth",this),t.config.globalProperties.$auth=this},t.createAuth=function(t){return new A(q,t)},t.useAuth=function(t){return e.inject(t||"auth")},Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],e):e(t.VueAuth={},t.vue)}(this,function(t,e){"use strict";function s(t){return null!==t&&"object"==typeof t&&t.constructor!==Array}function c(t){return"string"==typeof t||"number"==typeof t?[t]:t}function u(t,e){var n,r,o,i={};for(o in e=e||{},t)s(t[o])&&"FormData"!==t[o].constructor.name?i[o]=u(t[o],{}):i[o]=t[o];for(n=0,r=(e=e.constructor!==Array?[e]:e).length;n<r;n++)for(o in e[n])s(e[n][o])&&"FormData"!==e[n][o].constructor.name?i[o]=u(t[o]||{},[e[n][o]]):i[o]=e[n][o];return i}function l(t,e){var n,r,o;if("[object Object]"===Object.prototype.toString.call(t)&&"[object Object]"===Object.prototype.toString.call(e)){for(o in t)if(l(t[o],e[o]))return!0;return!1}if(t=c(t),e=c(e),!t||!e||t.constructor!==Array||e.constructor!==Array)return!1;for(n=0,r=t.length;n<r;n++)if(0<=e.indexOf(t[n]))return!0;return!1}function p(t,e){for(var n=e.split(".");n.length;)t=t[n.shift()];return t}function o(t,e,n){var r,o=t+"="+e+";";for(r in n)!1!==n[r]&&void 0!==n[r]&&(null===n[r]?this.options["getCookie"+r]&&(o+=" "+r+"="+this.options["getCookie"+r]()+";"):!0===n[r]?o+=" "+r+";":o+=" "+r+"="+n[r]+";");document.cookie=o}function i(t){return"string"!=typeof t&&null!=t?new Date((new Date).getTime()+t).toUTCString():t}function n(t){var e=Object.assign({},this.options.cookie);e.Expires=i(-12096e5),o.call(this,t,"",e)}var d=Object.freeze({get:function(t){for(var e=document.cookie,n=0,r=(e=e.replace(/;\s+/g,";").split(";").map(function(t){return t.replace(/\s+=\s+/g,"=").split("=")})).length;n<r;n++)if(e[n][0]&&e[n][0]===t)return e[n][1];return null},set:function(t,e,n){var r=this.options.cookie;r.Expires=!0===n?"":i(r.Expires),o.call(this,t,e,r)},remove:n});var f=Object.freeze({get:function(t){return sessionStorage.getItem(t)||localStorage.getItem(t)},set:function(t,e,n){(n?sessionStorage:localStorage).setItem(t,e)},remove:function(t){localStorage.removeItem(t),sessionStorage.removeItem(t)}});function r(t,e,n,r){var o=0,i=this.options.stores,a=i.length,s=[function(t){return(t=t||this.currentToken)?t:this.impersonating()?this.options.tokenImpersonateKey:this.options.tokenDefaultKey}.call(this,e)];for("set"===t&&(s.push(n),s.push(!0===r));o<a;o++){if("function"==typeof i[o][t])return i[o][t].apply(this,s);if("storage"===i[o]&&function(){try{if(!window.localStorage)throw"exception";return localStorage.setItem("storage_test",1),localStorage.removeItem("storage_test"),1}catch(t){return}}()&&function(){try{if(!window.sessionStorage)throw"exception";return sessionStorage.setItem("storage_test",1),sessionStorage.removeItem("storage_test"),1}catch(t){return}}())return f[t].apply(this,s);if("cookie"===i[o])return d[t].apply(this,s)}}function h(t){return r.call(this,"get",t)}function m(t,e,n){return r.call(this,"set",t,e,n)}function a(t){return r.call(this,"remove",t)}var v=null,y={rolesKey:"roles",rememberKey:"auth_remember",staySignedInKey:"auth_stay_signed_in",tokenDefaultKey:"auth_token_default",tokenImpersonateKey:"auth_token_impersonate",stores:["storage","cookie"],cookie:{Path:"/",Domain:null,Secure:!0,Expires:12096e5,SameSite:"None"},authRedirect:{path:"/login"},forbiddenRedirect:{path:"/403"},notFoundRedirect:{path:"/404"},registerData:{url:"auth/register",method:"POST",redirect:"/login",autoLogin:!1},loginData:{url:"auth/login",method:"POST",redirect:"/",fetchUser:!0,staySignedIn:!0},logoutData:{url:"auth/logout",method:"POST",redirect:"/",makeRequest:!1},fetchData:{url:"auth/user",method:"GET",enabled:!0},refreshData:{url:"auth/refresh",method:"GET",enabled:!0,interval:30},impersonateData:{url:"auth/impersonate",method:"POST",redirect:"/",fetchUser:!0},unimpersonateData:{url:"auth/unimpersonate",method:"POST",redirect:"/admin",fetchUser:!0,makeRequest:!1},oauth2Data:{url:"auth/social",method:"POST",redirect:"/",fetchUser:!0},getUrl:k,getCookieDomain:function(){return window.location.hostname},parseUserData:function(t){return t.data||{}}};function g(){return!h.call(v)}function b(t){var e;return t.to?e=t.to.auth:(t=t.matched.filter(function(t){return Object.prototype.hasOwnProperty.call(t.meta,"auth")})).length&&(e=t[t.length-1].meta.auth),e}function k(){var t=window.location.port;return window.location.protocol+"//"+window.location.hostname+(t?":"+t:"")}function D(t){v.$vm.state.loaded=!0,v.$vm.state.authenticated=t}function w(t){!0===t?m.call(v,v.options.staySignedInKey,"true",!1):a.call(v,v.options.staySignedInKey)}function S(t){t?(m.call(v,v.options.rememberKey,t,!1),v.$vm.state.remember=t):(a.call(v,v.options.rememberKey),v.$vm.state.remember=null)}function I(t){v.transitionPrev=v.transitionThis,v.transitionThis=t}function T(t){return v.options.parseUserData(v.drivers.http.httpData(t))}function $(t){var e;return t&&t.ignoreVueAuth||(!1===t.impersonating&&v.impersonating()&&(e=v.options.tokenDefaultKey),(e=h.call(v,e))&&v.drivers.auth.request.call(v,t,e)),t}function K(t,e){e&&e.ignoreVueAuth||(function(t,e){var n,r,o="",i=e&&e.path;if(i&&e.query){for(n in e.query)e.query[n]&&(o+="&"+n+"="+e.query[n]);i+="?"+o.substring(1)}v.drivers.http.invalidToken&&v.drivers.http.invalidToken.call(v,t)&&(e&&(r=b(e)),U({redirect:i=r?r.redirect||v.options.authRedirect:i}))}(t,v.transitionThis),(t=v.drivers.auth.response.call(v,t))&&m.call(v,null,t,!h.call(v,v.options.staySignedInKey)))}function R(t){var e=g();e&&v.$vm.state.authenticated&&U(),e||v.$vm.state.loaded||!v.options.refreshData.enabled?P(t):v.refresh().then(function(){P(t)})}function P(t){return null===v.$vm.state.authenticated&&h.call(v)?v.options.fetchData.enabled?void v.fetch().then(t,t):(_({}),t.call(v)):(v.$vm.state.loaded=!0,t.call(v))}function O(t,e,n){var r=(e||"").redirect||v.options.authRedirect,o=(e||"").forbiddenRedirect||(e||"").redirect||v.options.forbiddenRedirect,i=(e||"").notFoundRedirect||(e||"").redirect||v.options.notFoundRedirect,a=(e||"").rolesKey||v.options.rolesKey;if((e=c(void 0!==(e||"").roles?e.roles:e))&&(!0===e||e.constructor===Array||s(e)))if(v.check()){if(e.constructor!==Array&&!s(e)||l(e,p(v.$vm.state.data||{},a)))return v.$vm.state.redirect=v.transitionRedirectType?{type:v.transitionRedirectType,from:v.transitionPrev,to:v.transitionThis}:null,v.transitionRedirectType=null,n();v.transitionRedirectType=403,"function"==typeof o&&(o=o(t)),n.call(v,o)}else v.transitionRedirectType=401,"function"==typeof r&&(r=r(t)),n.call(v,r);else{if(!1!==e||!v.check())return v.$vm.state.redirect=v.transitionRedirectType?{type:v.transitionRedirectType,from:v.transitionPrev,to:v.transitionThis}:null,v.transitionRedirectType=null,n();v.transitionRedirectType=404,"function"==typeof i&&(i=i(t)),n.call(v,i)}}function _(t,e){v.$vm.state.data=t,D(!0),j(e)}function U(t){n.call(v,v.options.tokenImpersonateKey),n.call(v,v.options.tokenDefaultKey),a.call(v,v.options.tokenImpersonateKey),a.call(v,v.options.tokenDefaultKey),a.call(v,v.options.staySignedInKey),v.$vm.state.loaded=!0,v.$vm.state.authenticated=!1,v.$vm.state.data=null,j(t)}function j(t){t&&v.drivers.router.routerGo.call(v,t)}function A(t,e){(v=this).plugins=(e=e||{}).plugins,this.drivers=e.drivers,this.options=u(y,e.options),delete e.plugins,delete e.drivers,delete e.options,this.currentToken=null,this.transitionPrev=null,this.transitionThis=null,this.transitionRedirectType=null,function(){for(var t,e=["auth","http","router"],n=0,r=e.length;n<r;n++){if(!v.drivers[e[n]])return console.error('Error (@websanova/vue-auth): "'+e[n]+'" driver must be set.');if(v.drivers[e[n]].init&&(t=v.drivers[e[n]].init.call(v)))return console.error("Error (@websanova/vue-auth): "+t)}}(),v.$vm=new t({data:function(){return{state:{data:null,loaded:!1,redirect:null,authenticated:null,impersonating:void 0,remember:void 0}}}}),v.options.refreshData.enabled&&0<v.options.refreshData.interval&&setInterval(function(){v.options.refreshData.enabled&&!g()&&v.refresh()},1e3*v.options.refreshData.interval*60),v.drivers.http.interceptor.call(v,$,K),v.drivers.router.beforeEach.call(v,R,O,I,b)}A.prototype.ready=function(){return v.$vm.state.loaded},A.prototype.load=function(){return new Promise(function(t){var e=null,e=setInterval(function(){v.$vm.state.loaded&&(clearInterval(e),t())},50)})},A.prototype.redirect=function(){return v.$vm.state.redirect},A.prototype.user=function(t){return void 0!==t&&_(t),v.$vm.state.data},A.prototype.check=function(t,e){return t=t,e=e,!0===v.$vm.state.authenticated&&(!t||l(t,p(v.$vm.state.data||{},e||v.options.rolesKey)))},A.prototype.impersonating=function(){var t=!!h.call(v,v.options.tokenImpersonateKey);return void 0===v.$vm.state.impersonating&&(v.$vm.state.impersonating=t),v.$vm.state.impersonating},A.prototype.token=function(t,e,n){return void 0!==e&&(null===e?a.call(v,t):(n=!0===n||!1===n?n:!h.call(v,v.options.staySignedInKey),m.call(v,t,e,n))),h.call(v,t)},A.prototype.fetch=function(n){return n=u(v.options.fetchData,n),new Promise(function(e,t){v.drivers.http.http.call(v,n).then(function(t){_(T(t),n.redirect),e(t)},t)})},A.prototype.refresh=function(t){return t=u(v.options.refreshData,t),v.drivers.http.http.call(v,t)},A.prototype.register=function(o){var i=u(v.options.registerData,o);return!0!==i.autoLogin&&(S(i.remember),w(i.staySignedIn)),new Promise(function(n,r){v.drivers.http.http.call(v,i).then(function(t){var e;i.autoLogin?(e=u(v.options.loginData,o),v.login(e).then(n,r)):(n(t),j(i.redirect))},r)})},A.prototype.login=function(r){return S((r=u(v.options.loginData,r)).remember),w(r.staySignedIn),new Promise(function(e,n){v.drivers.http.http.call(v,r).then(function(t){r.fetchUser||void 0===r.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:r.redirect}).then(e,n):(_(T(t),r.redirect),e(t))},function(t){D(!1),n(t)})})},A.prototype.remember=function(t){t&&S(t);t=h.call(v,v.options.rememberKey);return void 0===v.$vm.state.remember&&(v.$vm.state.remember=t),v.$vm.state.remember},A.prototype.unremember=function(){S(null)},A.prototype.logout=function(n){return n=u(v.options.logoutData,n),new Promise(function(e,t){n.makeRequest?v.drivers.http.http.call(v,n).then(function(t){U(n.redirect),e(t)},t):(U(n.redirect),e())})},A.prototype.impersonate=function(a){return a=u(v.options.impersonateData,a),new Promise(function(r,o){var i=v.token();v.drivers.http.http.call(v,a).then(function(t){var e,n;e=i,m.call(v,v.options.tokenImpersonateKey,v.token(),!h.call(v,v.options.staySignedInKey)),m.call(v,v.options.tokenDefaultKey,e,!h.call(v,v.options.staySignedInKey)),v.$vm.state.impersonating=!0,j(n),a.fetchUser||void 0===a.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:a.redirect}).then(r,o):(j(a.redirect),r(t))},o)})},A.prototype.unimpersonate=function(n){return n=u(v.options.unimpersonateData,n),new Promise(function(t,e){n.makeRequest?v.drivers.http.http.call(v,n).then(t,e):t()}).then(function(){return new Promise(function(t,e){a.call(v,v.options.tokenImpersonateKey),v.$vm.state.impersonating=!1,j(void 0),n.fetchUser||void 0===n.fetchUser&&v.options.fetchData.enabled?v.fetch({redirect:n.redirect}).then(t,e):(j(n.redirect),t())})})},A.prototype.oauth2=function(t,e){var n,r="";if(e.code){try{e.state&&(e.state=JSON.parse(decodeURIComponent(e.state)))}catch(t){console.error("vue-auth:error There was an issue retrieving the state data."),e.state=e.state||{}}return delete(e=u(v.options.oauth2Data,[e.state,e])).code,delete e.state,delete e.params,v.login(e)}for(n in(e=u(v.drivers.oauth2[t],e)).params.state=JSON.stringify(e.params.state||{}),e.params.redirect_uri=(t=e.params.redirect_uri,/^https?:\/\//.test(t=t||"")?t:k()+"/"+t.replace(/^\/|\/$/g,"")),e.params)r+="&"+n+"="+encodeURIComponent(e.params[n]);window.open(e.url+"?"+r.substring(),(e.window||{}).name||"_self",(e.window||{}).specs||{},!1!==(e.window||{}).replace)},A.prototype.enableImpersonate=function(){v.impersonating()&&(v.currentToken=null)},A.prototype.disableImpersonate=function(){v.impersonating()&&(v.currentToken=v.options.tokenDefaultKey)};function q(t){t=t.data();this.state=e.reactive(t.state)}A.prototype.install=function(t,e){t.provide(e||"auth",this),t.config.globalProperties.$auth=this},t.createAuth=function(t){return new A(q,t)},t.useAuth=function(t){return e.inject(t||"auth")},Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"name": "@websanova/vue-auth", | ||
"description": "A simple light-weight authentication library for Vue.js", | ||
"keywords": [ | ||
"vue", | ||
"vue.js", | ||
"vuejs", | ||
"plugin", | ||
"jwt", | ||
"auth", | ||
"authentication", | ||
"authorize", | ||
"authenticate", | ||
"bearer", | ||
"basic", | ||
"axios", | ||
"http", | ||
"api", | ||
"json", | ||
"web", | ||
"token" | ||
], | ||
"keywords": ["vue", "vue.js", "vuejs", "plugin", "jwt", "auth", "authentication", "authorize", "authenticate", "bearer", "basic", "axios", "http", "api", "json", "web", "token"], | ||
"homepage": "https://websanova.com/docs/vue-auth", | ||
@@ -35,2 +17,3 @@ "author": { | ||
"jsdelivr": "dist/v3/vue-auth.min.js", | ||
"types": "types/index.d.ts", | ||
@@ -57,2 +40,2 @@ "repository": { | ||
} | ||
} | ||
} |
@@ -297,3 +297,3 @@ import * as __utils from './lib/utils.js'; | ||
} | ||
else if ((routeAuth.constructor === Array || __utils.isObject(routeAuth)) && ! __utils.compare(routeAuth, __auth.$vm.state.data[rolesKey])) { | ||
else if ((routeAuth.constructor === Array || __utils.isObject(routeAuth)) && ! __utils.compare(routeAuth, __utils.getProperty((__auth.$vm.state.data || {}), rolesKey))) { | ||
__auth.transitionRedirectType = 403; | ||
@@ -300,0 +300,0 @@ |
@@ -108,7 +108,5 @@ function isObject(val) { | ||
function getProperty (obj, desc, res) { | ||
function getProperty (obj, desc) { | ||
var arr = desc.split('.'); | ||
res = res || []; | ||
while (arr.length) { | ||
@@ -115,0 +113,0 @@ obj = obj[arr.shift()]; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
477822
7938