Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

auth0-angular

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auth0-angular - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

2

build/auth0-angular.js

@@ -799,3 +799,3 @@ /**

}];
}]);t
}]);

@@ -802,0 +802,0 @@ angular.module('auth0.directives', ['auth0.service']);

@@ -1,1 +0,1 @@

angular.module("auth0",["auth0.service","auth0.utils","auth0.directives"]).run(["auth",function(a){a.hookEvents()}]),angular.module("auth0.utils",[]).provider("authUtils",function(){var a={capitalize:function(a){return a?a.charAt(0).toUpperCase()+a.substring(1).toLowerCase():null},fnName:function(a){var b=a.toString();return b=b.substr("function ".length),b=b.substr(0,b.indexOf("(")),b?b.trim():b}};angular.extend(this,a),this.$get=["$rootScope","$q",function(b,c){var d={};return angular.extend(d,a),d.safeApply=function(a){var c=b.$root.$$phase;"$apply"===c||"$digest"===c?a&&"function"==typeof a&&a():b.$apply(a)},d.callbackify=function(a,b,c,e){return angular.isFunction(a)?function(f){f=Array.prototype.slice.call(arguments);var g=function(a,d,e){return a?void(c&&c(a)):(e=Array.prototype.slice.call(arguments,1),void(b&&b.apply(null,e)))};(b||c)&&f.push(d.applied(g)),a.apply(e,f)}:void 0},d.promisify=function(a,b){return angular.isFunction(a)?function(e){e=Array.prototype.slice.call(arguments);var f=c.defer(),g=function(a,b,c){return a?void f.reject(a):(c=Array.prototype.slice.call(arguments,1),void f.resolve(c.length>1?c:b))};return e.push(d.applied(g)),a.apply(b,e),f.promise.spread=f.promise.spread||function(a,b){return f.promise.then(function(b){return Array.isArray(b)?a.apply(null,b):a(b)},b)},f.promise}:void 0},d.applied=function(a){return function(b,c){b=b,c=c;var e=arguments;d.safeApply(function(){a.apply(null,e)})}},d}]}),angular.module("auth0.service",["auth0.utils"]).provider("auth",["authUtilsProvider",function(a){function b(a,b){b=b||f.lib;var c=g[b].library();return c[g[b][a]]}function c(a,b){return b=b||f.lib,g[b][a]}function d(b){if(b)return{lib:a.fnName(b),constructor:b};if(null!=window.Auth0Lock)return{lib:"Auth0Lock",constructor:window.Auth0Lock};if(null!=window.Auth0)return{lib:"Auth0",constructor:window.Auth0};if("undefined"!=typeof Auth0Widget)throw new Error("Auth0Widget is not supported with this version of auth0-angularanymore. Please try with an older one");throw new Error("Cannot initialize Auth0Angular. Auth0Lock or Auth0 must be available")}var e={callbackOnLocationHash:!0},f=this,g={Auth0:{signin:"login",signup:"signup",reset:"changePassword",validateUser:"validateUser",library:function(){return f.auth0js},parseOptions:function(a){var b=angular.copy(a);return b.authParams&&(angular.extend(b,b.authParams),delete b.authParams),b}},Auth0Lock:{signin:"show",signup:"showSignup",reset:"showReset",library:function(){return f.auth0lib},parseOptions:function(a){return angular.copy(a)}}};this.init=function(a,b){if(!a)throw new Error("You must set options when calling init");this.loginUrl=a.loginUrl,this.loginState=a.loginState,this.clientID=a.clientID||a.clientId;var c=a.domain;this.domain=c,this.sso=a.sso;var f=d(b);this.lib=f.lib,"Auth0Lock"===f.lib?(this.auth0lib=new f.constructor(this.clientID,c,angular.extend(e,a)),this.auth0js=this.auth0lib.getClient(),this.isLock=!0):(this.auth0lib=new f.constructor(angular.extend(e,a)),this.auth0js=this.auth0lib,this.isLock=!1),this.initialized=!0},this.eventHandlers={},this.on=function(a,b){this.eventHandlers[a]||(this.eventHandlers[a]=[]),this.eventHandlers[a].push(b)};var h=["loginSuccess","loginFailure","logout","forbidden","authenticated"];angular.forEach(h,function(b){f["add"+a.capitalize(b)+"Handler"]=function(a){f.on(b,a)}}),this.$get=["$rootScope","$q","$injector","$window","$location","authUtils","$http",function(a,d,e,h,i,j,k){function l(){f.loginUrl?i.path(f.loginUrl):f.loginState?e.get("$state").go(f.loginState):p("forbidden")}function m(a,b,c,d){n.isAuthenticated||n.refreshTokenPromise||(f.sso?(a&&b.preventDefault(),f.auth0js.getSSOData(j.applied(function(e,f){if(f.sso){var g={popup:!1,callbackOnLocationHash:!0,connection:f.lastUsedConnection.name,authParams:{state:c()}};p("ssoLogin",{loginOptions:g}),n.signin(g,null,null,"Auth0")}else a&&(b.preventDefault(),d())}))):a&&(b.preventDefault(),d()))}var n={isAuthenticated:!1};a.isAuthenticated=!1;var o=function(a){return f.eventHandlers[a]},p=function(b,c){a.$broadcast("auth0."+b,c),angular.forEach(o(b)||[],function(a){e.invoke(a,n,c)})},q=function(b,c,d,e,f,g){var h=n.getProfile(b),i={idToken:b,accessToken:c,state:d,refreshToken:e,profile:f,isAuthenticated:!0};return a.isAuthenticated=!0,angular.extend(n,i),p(g?"authenticated":"loginSuccess",angular.extend({profilePromise:h},i)),h};a.$on("$locationChangeStart",function(){if(f.initialized){var a=f.auth0lib.parseHash(h.location.hash);return!n.isAuthenticated&&a&&(a.idToken||a.id_token)?void q(a.idToken||a.id_token,a.accessToken||a.access_token,a.state,a.refreshToken||a.refresh_token):void 0}}),a.$on("auth0.forbiddenRequest",function(){l()}),f.loginUrl&&a.$on("$routeChangeStart",function(a,b){f.initialized&&m(b.$$route&&b.$$route.requiresLogin,a,function(){return JSON.stringify({redirect_to:{path:i.path()}})},function(){i.path(f.loginUrl)})}),f.loginState&&a.$on("$stateChangeStart",function(a,b,c){f.initialized&&m(b.data&&b.data.requiresLogin,a,function(){return JSON.stringify({redirect_to:{state:b.name,params:c}})},function(){e.get("$state").go(f.loginState)})}),n.config=f;var r=function(a,b){var c=o("loginSuccess");if(!(b||a.username||a.email||c&&0!==c.length))throw new Error("You must define a loginSuccess handler if not using popup mode or not doing ro call because that means you are doing a redirect")},s=function(a,b,c){var d=c.user_id;return k({method:"POST",url:"https://"+f.domain+"/api/v2/users/"+d+"/identities",headers:{Authorization:"Bearer "+a},data:{link_with:b}})},t=function(a,b,c,d){return k({method:"DELETE",url:"https://"+f.domain+"/api/v2/users/"+b+"/identities/"+c+"/"+d,headers:{Authorization:"Bearer "+a}})};return n.hookEvents=function(){},n.init=angular.bind(f,f.init),n.getToken=function(a){a=a||{scope:"openid"},a.id_token||a.refresh_token||(a.id_token=n.idToken);var b=j.promisify(f.auth0js.getDelegationToken,f.auth0js);return b(a)},n.refreshIdToken=function(a){var b=j.promisify(f.auth0js.refreshToken,f.auth0js);return n.refreshTokenPromise=b(a||n.refreshToken).then(function(a){return a.id_token})["finally"](function(){n.refreshTokenPromise=null}),n.refreshTokenPromise},n.renewIdToken=function(a){var b=j.promisify(f.auth0js.renewIdToken,f.auth0js);return b(a||n.idToken).then(function(a){return a.id_token})},n.signin=function(a,d,e,h){a=a||{},r(a,d,e),a=c("parseOptions",h)(a);var i=b("signin",h),k=d?function(b,c,e,f,g){c||angular.isUndefined(a.loginAfterSignup)||a.loginAfterSignup?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,l=e?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,m=j.callbackify(i,k,l,g[h||f.lib].library());m(a)},n.signup=function(a,d,e){a=a||{},r(a,d,e),a=c("parseOptions")(a);var g=d?function(b,c,e,f,g){angular.isUndefined(a.auto_login)||a.auto_login?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,h=e?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,i=f.auth0lib,k=j.callbackify(b("signup"),g,h,i);k(a)},n.linkAccount=function(a,d,e,h,i,k){var l={popup:!0};if(!a||!d)throw new Error("Available token and profile is needed to link to another");if(!e.connection)throw new Error("Connection type (eg: facebook, github) is required to link account");e=e||{},r(e,h,i),angular.extend(e,l),e=c("parseOptions",k)(e);var m=b("signin",k),n=function(b,c){s(a,c,d).then(function(a){h(a)},function(a){i(a)})},o=function(a){i&&i(a)},p=j.callbackify(m,n,o,g[k||f.lib].library());p(e)},n.unLinkAccount=function(a,b,c,d){if(!(a&&b&&c&&d))throw new Error("All the arguments are required to unlink. Please refer to documentation for the arguments");return t(a,b,c,d)},n.reset=function(a,d,e){a=a||{},a=c("parseOptions")(a);var g=f.auth0lib,h=j.callbackify(b("reset"),d,e,g);h(a)},n.validateUser=function(a,d,e){a=a||{},a=c("parseOptions")(a);var g=f.auth0lib,h=j.callbackify(b("validateUser"),d,e,g);h(a)},n.signout=function(){n.isAuthenticated=!1,n.profile=null,n.profilePromise=null,n.idToken=null,n.state=null,n.accessToken=null,n.tokenPayload=null,a.isAuthenticated=!1,p("logout")},n.authenticate=function(a,b,c,d,e){return q(b,c,d,e,a,!0)},n.getProfile=function(a){var b=j.promisify(f.auth0lib.getProfile,f.auth0lib);return n.profilePromise=b(a||n.idToken),n.profilePromise.then(function(a){return n.profile=a,a})},n.hide=function(a){f.auth0lib.hide(a)},n}]}]),t,angular.module("auth0.directives",["auth0.service"]),angular.module("auth0.directives").directive("ifUser",["$rootScope",function(a){return{link:function(b,c){a.$watch("isAuthenticated",function(a){a?c.removeClass("ng-hide"):c.addClass("ng-hide")})}}}]);
angular.module("auth0",["auth0.service","auth0.utils","auth0.directives"]).run(["auth",function(a){a.hookEvents()}]),angular.module("auth0.utils",[]).provider("authUtils",function(){var a={capitalize:function(a){return a?a.charAt(0).toUpperCase()+a.substring(1).toLowerCase():null},fnName:function(a){var b=a.toString();return b=b.substr("function ".length),b=b.substr(0,b.indexOf("(")),b?b.trim():b}};angular.extend(this,a),this.$get=["$rootScope","$q",function(b,c){var d={};return angular.extend(d,a),d.safeApply=function(a){var c=b.$root.$$phase;"$apply"===c||"$digest"===c?a&&"function"==typeof a&&a():b.$apply(a)},d.callbackify=function(a,b,c,e){return angular.isFunction(a)?function(f){f=Array.prototype.slice.call(arguments);var g=function(a,d,e){return a?void(c&&c(a)):(e=Array.prototype.slice.call(arguments,1),void(b&&b.apply(null,e)))};(b||c)&&f.push(d.applied(g)),a.apply(e,f)}:void 0},d.promisify=function(a,b){return angular.isFunction(a)?function(e){e=Array.prototype.slice.call(arguments);var f=c.defer(),g=function(a,b,c){return a?void f.reject(a):(c=Array.prototype.slice.call(arguments,1),void f.resolve(c.length>1?c:b))};return e.push(d.applied(g)),a.apply(b,e),f.promise.spread=f.promise.spread||function(a,b){return f.promise.then(function(b){return Array.isArray(b)?a.apply(null,b):a(b)},b)},f.promise}:void 0},d.applied=function(a){return function(b,c){b=b,c=c;var e=arguments;d.safeApply(function(){a.apply(null,e)})}},d}]}),angular.module("auth0.service",["auth0.utils"]).provider("auth",["authUtilsProvider",function(a){function b(a,b){b=b||f.lib;var c=g[b].library();return c[g[b][a]]}function c(a,b){return b=b||f.lib,g[b][a]}function d(b){if(b)return{lib:a.fnName(b),constructor:b};if(null!=window.Auth0Lock)return{lib:"Auth0Lock",constructor:window.Auth0Lock};if(null!=window.Auth0)return{lib:"Auth0",constructor:window.Auth0};if("undefined"!=typeof Auth0Widget)throw new Error("Auth0Widget is not supported with this version of auth0-angularanymore. Please try with an older one");throw new Error("Cannot initialize Auth0Angular. Auth0Lock or Auth0 must be available")}var e={callbackOnLocationHash:!0},f=this,g={Auth0:{signin:"login",signup:"signup",reset:"changePassword",validateUser:"validateUser",library:function(){return f.auth0js},parseOptions:function(a){var b=angular.copy(a);return b.authParams&&(angular.extend(b,b.authParams),delete b.authParams),b}},Auth0Lock:{signin:"show",signup:"showSignup",reset:"showReset",library:function(){return f.auth0lib},parseOptions:function(a){return angular.copy(a)}}};this.init=function(a,b){if(!a)throw new Error("You must set options when calling init");this.loginUrl=a.loginUrl,this.loginState=a.loginState,this.clientID=a.clientID||a.clientId;var c=a.domain;this.domain=c,this.sso=a.sso;var f=d(b);this.lib=f.lib,"Auth0Lock"===f.lib?(this.auth0lib=new f.constructor(this.clientID,c,angular.extend(e,a)),this.auth0js=this.auth0lib.getClient(),this.isLock=!0):(this.auth0lib=new f.constructor(angular.extend(e,a)),this.auth0js=this.auth0lib,this.isLock=!1),this.initialized=!0},this.eventHandlers={},this.on=function(a,b){this.eventHandlers[a]||(this.eventHandlers[a]=[]),this.eventHandlers[a].push(b)};var h=["loginSuccess","loginFailure","logout","forbidden","authenticated"];angular.forEach(h,function(b){f["add"+a.capitalize(b)+"Handler"]=function(a){f.on(b,a)}}),this.$get=["$rootScope","$q","$injector","$window","$location","authUtils","$http",function(a,d,e,h,i,j,k){function l(){f.loginUrl?i.path(f.loginUrl):f.loginState?e.get("$state").go(f.loginState):p("forbidden")}function m(a,b,c,d){n.isAuthenticated||n.refreshTokenPromise||(f.sso?(a&&b.preventDefault(),f.auth0js.getSSOData(j.applied(function(e,f){if(f.sso){var g={popup:!1,callbackOnLocationHash:!0,connection:f.lastUsedConnection.name,authParams:{state:c()}};p("ssoLogin",{loginOptions:g}),n.signin(g,null,null,"Auth0")}else a&&(b.preventDefault(),d())}))):a&&(b.preventDefault(),d()))}var n={isAuthenticated:!1};a.isAuthenticated=!1;var o=function(a){return f.eventHandlers[a]},p=function(b,c){a.$broadcast("auth0."+b,c),angular.forEach(o(b)||[],function(a){e.invoke(a,n,c)})},q=function(b,c,d,e,f,g){var h=n.getProfile(b),i={idToken:b,accessToken:c,state:d,refreshToken:e,profile:f,isAuthenticated:!0};return a.isAuthenticated=!0,angular.extend(n,i),p(g?"authenticated":"loginSuccess",angular.extend({profilePromise:h},i)),h};a.$on("$locationChangeStart",function(){if(f.initialized){var a=f.auth0lib.parseHash(h.location.hash);return!n.isAuthenticated&&a&&(a.idToken||a.id_token)?void q(a.idToken||a.id_token,a.accessToken||a.access_token,a.state,a.refreshToken||a.refresh_token):void 0}}),a.$on("auth0.forbiddenRequest",function(){l()}),f.loginUrl&&a.$on("$routeChangeStart",function(a,b){f.initialized&&m(b.$$route&&b.$$route.requiresLogin,a,function(){return JSON.stringify({redirect_to:{path:i.path()}})},function(){i.path(f.loginUrl)})}),f.loginState&&a.$on("$stateChangeStart",function(a,b,c){f.initialized&&m(b.data&&b.data.requiresLogin,a,function(){return JSON.stringify({redirect_to:{state:b.name,params:c}})},function(){e.get("$state").go(f.loginState)})}),n.config=f;var r=function(a,b){var c=o("loginSuccess");if(!(b||a.username||a.email||c&&0!==c.length))throw new Error("You must define a loginSuccess handler if not using popup mode or not doing ro call because that means you are doing a redirect")},s=function(a,b,c){var d=c.user_id;return k({method:"POST",url:"https://"+f.domain+"/api/v2/users/"+d+"/identities",headers:{Authorization:"Bearer "+a},data:{link_with:b}})},t=function(a,b,c,d){return k({method:"DELETE",url:"https://"+f.domain+"/api/v2/users/"+b+"/identities/"+c+"/"+d,headers:{Authorization:"Bearer "+a}})};return n.hookEvents=function(){},n.init=angular.bind(f,f.init),n.getToken=function(a){a=a||{scope:"openid"},a.id_token||a.refresh_token||(a.id_token=n.idToken);var b=j.promisify(f.auth0js.getDelegationToken,f.auth0js);return b(a)},n.refreshIdToken=function(a){var b=j.promisify(f.auth0js.refreshToken,f.auth0js);return n.refreshTokenPromise=b(a||n.refreshToken).then(function(a){return a.id_token})["finally"](function(){n.refreshTokenPromise=null}),n.refreshTokenPromise},n.renewIdToken=function(a){var b=j.promisify(f.auth0js.renewIdToken,f.auth0js);return b(a||n.idToken).then(function(a){return a.id_token})},n.signin=function(a,d,e,h){a=a||{},r(a,d,e),a=c("parseOptions",h)(a);var i=b("signin",h),k=d?function(b,c,e,f,g){c||angular.isUndefined(a.loginAfterSignup)||a.loginAfterSignup?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,l=e?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,m=j.callbackify(i,k,l,g[h||f.lib].library());m(a)},n.signup=function(a,d,e){a=a||{},r(a,d,e),a=c("parseOptions")(a);var g=d?function(b,c,e,f,g){angular.isUndefined(a.auto_login)||a.auto_login?q(c,e,f,g,b).then(function(a){d&&d(a,c,e,f,g)}):d()}:null,h=e?function(a){p("loginFailure",{error:a}),e&&e(a)}:null,i=f.auth0lib,k=j.callbackify(b("signup"),g,h,i);k(a)},n.linkAccount=function(a,d,e,h,i,k){var l={popup:!0};if(!a||!d)throw new Error("Available token and profile is needed to link to another");if(!e.connection)throw new Error("Connection type (eg: facebook, github) is required to link account");e=e||{},r(e,h,i),angular.extend(e,l),e=c("parseOptions",k)(e);var m=b("signin",k),n=function(b,c){s(a,c,d).then(function(a){h(a)},function(a){i(a)})},o=function(a){i&&i(a)},p=j.callbackify(m,n,o,g[k||f.lib].library());p(e)},n.unLinkAccount=function(a,b,c,d){if(!(a&&b&&c&&d))throw new Error("All the arguments are required to unlink. Please refer to documentation for the arguments");return t(a,b,c,d)},n.reset=function(a,d,e){a=a||{},a=c("parseOptions")(a);var g=f.auth0lib,h=j.callbackify(b("reset"),d,e,g);h(a)},n.validateUser=function(a,d,e){a=a||{},a=c("parseOptions")(a);var g=f.auth0lib,h=j.callbackify(b("validateUser"),d,e,g);h(a)},n.signout=function(){n.isAuthenticated=!1,n.profile=null,n.profilePromise=null,n.idToken=null,n.state=null,n.accessToken=null,n.tokenPayload=null,a.isAuthenticated=!1,p("logout")},n.authenticate=function(a,b,c,d,e){return q(b,c,d,e,a,!0)},n.getProfile=function(a){var b=j.promisify(f.auth0lib.getProfile,f.auth0lib);return n.profilePromise=b(a||n.idToken),n.profilePromise.then(function(a){return n.profile=a,a})},n.hide=function(a){f.auth0lib.hide(a)},n}]}]),angular.module("auth0.directives",["auth0.service"]),angular.module("auth0.directives").directive("ifUser",["$rootScope",function(a){return{link:function(b,c){a.$watch("isAuthenticated",function(a){a?c.removeClass("ng-hide"):c.addClass("ng-hide")})}}}]);

@@ -6,3 +6,3 @@ {

"author": "Martin Gontovnikas",
"version": "4.2.0",
"version": "4.2.1",
"main": "index.js",

@@ -9,0 +9,0 @@ "devDependencies": {

@@ -627,2 +627,2 @@

}];
}]);t
}]);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc