auth0-angular
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -1,1 +0,1 @@ | ||
!function(){function a(a,b,c,d,e,f){this.auth0Lib=a,this.$cookieStore=b,this.$rootScope=c,this.$q=d,this.$timeout=f,this.urlBase64Decode=e,this.delegatedTokens={},this.profile={},this._loaded=d.defer(),this.loaded=this._loaded.promise}function b(a,b,c){c?a.put(b,c):a.remove(b)}var c=angular.module("util",[]);c.value("urlBase64Decode",function(a){var b=a.replace("-","+").replace("_","/");switch(b.length%4){case 0:break;case 2:b+="==";break;case 3:b+="=";break;default:throw"Illegal base64url string!"}return window.atob(b)});var d=angular.module("auth0",["util","ngCookies"]),e={forbidden:"auth:FORBIDDEN",loginSuccess:"auth:LOGIN_SUCCESS",loginFailure:"auth:LOGIN_FAILED",loginFailed:"auth:LOGIN_FAILED",logout:"auth:LOGOUT",redirectEnded:"auth:REDIRECT_ENDED"};d.constant("AUTH_EVENTS",e),a.prototype={},a.prototype.parseHash=function(a,b){this.auth0Lib.parseHash(a,b)},a.prototype._deserialize=function(){var a;try{a=this.$cookieStore.get("idToken")}catch(b){a=void 0}return!a||this.hasTokenExpired(a)?(this.isAuthenticated=!1,this.idToken=void 0,this.accessToken=void 0,void this._serialize(void 0,void 0,void 0)):(this.idToken=this.$cookieStore.get("idToken"),this.accessToken=this.$cookieStore.get("accessToken"),void(this.isAuthenticated=!0))},a.prototype._serialize=function(a,c,d){b(this.$cookieStore,"idToken",a),b(this.$cookieStore,"accessToken",c),b(this.$cookieStore,"state",d)},a.prototype.hasTokenExpired=function(a){if(!a)return!0;var b=a.split(".");if(3!==b.length)return!0;var c=this.urlBase64Decode(b[1]);if(!c)return!0;try{c=JSON.parse(c)}catch(d){return!0}if(!c.exp)return!0;var e=new Date(0);return e.setUTCSeconds(c.exp),isNaN(e)?!0:e.valueOf()>(new Date).valueOf()?!1:!0},a.prototype.getToken=function(a,b,c){b=b||{scope:"openid"};var d=this,e=d.$q.defer();c&&(this.delegatedTokens[a]=void 0);var f=this.delegatedTokens[a],g=this.hasTokenExpired(f);if(f&&!g)return e.resolve(f),e.promise;var h=this.auth0Lib;return h.getDelegationToken||(h=h.getClient()),h.getDelegationToken(a,this.idToken,b,function(b,c){d.$timeout(function(){return b?e.reject(b):(d.delegatedTokens[a]=c.id_token,e.resolve(c.id_token))})}),e.promise},a.prototype.signin=function(a){a=a||{};var b=this,c=b.$q,d=c.defer(),f=function(a,c,f,g,h){b.$timeout(function(){return a?(b.$rootScope.$broadcast(e.loginFailure,a),void d.reject(a)):(b._serialize(f,g,h),b._deserialize(),void b.getProfile(f).then(function(){b.$rootScope.$broadcast(e.loginSuccess,b.profile),d.resolve(b.profile)},function(a){b.$rootScope.$broadcast(e.loginFailure,a),d.reject(a)}))})};if("undefined"!=typeof Auth0Widget&&b.auth0Lib instanceof Auth0Widget){if(a.popup)return b.auth0Lib.signin(a,null,f),d.promise;f=null}return b.auth0Lib.signin(a,f),d.promise},a.prototype.signout=function(){this._serialize(void 0,void 0,void 0),this._deserialize(),this.$rootScope.$broadcast(e.logout)},a.prototype.parseHash=function(a){return this.auth0Lib.parseHash(a)},a.prototype.getProfile=function(a){var b=this.$q.defer(),c=this,d=function(a,d){c.$timeout(function(){return a?b.reject(a):(Object.keys(c.profile).forEach(function(a){delete c.profile[a]}),Object.keys(d).forEach(function(a){c.profile[a]=d[a]}),void b.resolve(c.profile))})};return this.auth0Lib.getProfile(a,d),b.promise},a.prototype.signup=function(a){this.auth0Lib.signup(a)},a.prototype.reset=function(a){this.auth0Lib.reset(a)},d.provider("auth",["$provide",function(b){var c;this.init=function(a,c){var d;if(void 0===a.callbackOnLocationHash&&(a.callbackOnLocationHash=!0),c)d=new c(a);else if("undefined"!=typeof Auth0Widget)d=new Auth0Widget(a);else{if("undefined"==typeof Auth0)throw new Error("Auth0Widget or Auth0.js dependency not found");d=new Auth0(a)}b.value("auth0Lib",d)},this.$get=["$cookieStore","$rootScope","$q","$injector","urlBase64Decode","$timeout",function(b,d,f,g,h,i){var j=g.get("auth0Lib");if(!j)throw new Error("auth0Lib dependency not found. Have you called authProvider.init?");return c||(c=new a(j,b,d,f,h,i),g.has("parseHash")||(c._deserialize(),c.getProfile(c.idToken).finally(function(){c._loaded.resolve(),d.$broadcast(e.redirectEnded)}))),c}]}]);var f=angular.module("auth0-redirect",["auth0"]);f.factory("parseHash",["auth","$rootScope","$window",function(a,b,c){return function(){function d(){h&&h.id_token&&a._serialize(h.id_token,h.access_token,h.state),a._deserialize(),b.$broadcast(e.loginSuccess,a.profile)}function f(c){a._deserialize(),b.$broadcast(e.loginFailure,c)}function g(){a._loaded.resolve(),b.$broadcast(e.redirectEnded)}var h=a.parseHash(c.location.hash);a._deserialize(),a.idToken?a.getProfile(a.idToken).then(d,f).finally(g):h&&h.id_token?a.getProfile(h.id_token).then(d,f).finally(g):g()}}]),f.run(["parseHash",function(a){a()}]);var g=angular.module("authInterceptor",["auth0"]);g.factory("authInterceptor",["$rootScope","$q","AUTH_EVENTS","$injector",function(a,b,c,d){return{request:function(a){if(!d.has("auth"))return a;var b=d.get("auth");return a.headers=a.headers||{},b.idToken&&(a.headers.Authorization="Bearer "+b.idToken),a},responseError:function(d){return 401===d.status&&a.$broadcast(c.forbidden,d),b.reject(d)}}}])}(); | ||
!function(){function a(a,b,c,d,e,f){this.auth0Lib=a,this.$cookieStore=b,this.$rootScope=c,this.$q=d,this.$timeout=f,this.urlBase64Decode=e,this.delegatedTokens={},this.profile={},this._loaded=d.defer(),this.loaded=this._loaded.promise}function b(a,b,c){c?a.put(b,c):a.remove(b)}var c=angular.module("util",[]);c.value("urlBase64Decode",function(a){var b=a.replace("-","+").replace("_","/");switch(b.length%4){case 0:break;case 2:b+="==";break;case 3:b+="=";break;default:throw"Illegal base64url string!"}return window.atob(b)});var d=angular.module("auth0",["util","ngCookies"]),e={forbidden:"auth:FORBIDDEN",loginSuccess:"auth:LOGIN_SUCCESS",loginFailure:"auth:LOGIN_FAILED",loginFailed:"auth:LOGIN_FAILED",logout:"auth:LOGOUT",redirectEnded:"auth:REDIRECT_ENDED"};d.constant("AUTH_EVENTS",e),a.prototype={},a.prototype.parseHash=function(a,b){this.auth0Lib.parseHash(a,b)},a.prototype._deserialize=function(){var a;try{a=this.$cookieStore.get("idToken")}catch(b){a=void 0}return!a||this.hasTokenExpired(a)?(this.isAuthenticated=!1,this.idToken=void 0,this.accessToken=void 0,void this._serialize(void 0,void 0,void 0)):(this.idToken=this.$cookieStore.get("idToken"),this.accessToken=this.$cookieStore.get("accessToken"),void(this.isAuthenticated=!0))},a.prototype._serialize=function(a,c,d){b(this.$cookieStore,"idToken",a),b(this.$cookieStore,"accessToken",c),b(this.$cookieStore,"state",d)},a.prototype.hasTokenExpired=function(a){if(!a)return!0;var b=a.split(".");if(3!==b.length)return!0;var c=this.urlBase64Decode(b[1]);if(!c)return!0;try{c=JSON.parse(c)}catch(d){return!0}if(!c.exp)return!0;var e=new Date(0);return e.setUTCSeconds(c.exp),isNaN(e)?!0:e.valueOf()>(new Date).valueOf()?!1:!0},a.prototype.getToken=function(a,b,c){b=b||{scope:"openid"};var d=this,e=d.$q.defer();c&&(this.delegatedTokens[a]=void 0);var f=this.delegatedTokens[a],g=this.hasTokenExpired(f);if(f&&!g)return e.resolve(f),e.promise;var h=this.auth0Lib;return h.getDelegationToken||(h=h.getClient()),h.getDelegationToken(a,this.idToken,b,function(b,c){d.$timeout(function(){return b?e.reject(b):(d.delegatedTokens[a]=c.id_token,e.resolve(c.id_token))})}),e.promise},a.prototype.signin=function(a){a=a||{};var b=this,c=b.$q,d=c.defer(),f=function(a,c,f,g,h){b.$timeout(function(){return a?(b.$rootScope.$broadcast(e.loginFailure,a),void d.reject(a)):(b._serialize(f,g,h),b._deserialize(),void b.getProfile(f).then(function(){b.$rootScope.$broadcast(e.loginSuccess,b.profile),d.resolve(b.profile)},function(a){b.$rootScope.$broadcast(e.loginFailure,a),d.reject(a)}))})};if(b.auth0Lib&&b.auth0Lib.constructor&&"Auth0"!==b.auth0Lib.constructor.name){if(a.popup)return b.auth0Lib.signin(a,null,f),d.promise;f=null}return b.auth0Lib.signin(a,f),d.promise},a.prototype.signout=function(){this._serialize(void 0,void 0,void 0),this._deserialize(),this.$rootScope.$broadcast(e.logout)},a.prototype.parseHash=function(a){return this.auth0Lib.parseHash(a)},a.prototype.getProfile=function(a){var b=this.$q.defer(),c=this,d=function(a,d){c.$timeout(function(){return a?b.reject(a):(Object.keys(c.profile).forEach(function(a){delete c.profile[a]}),Object.keys(d).forEach(function(a){c.profile[a]=d[a]}),void b.resolve(c.profile))})};return this.auth0Lib.getProfile(a,d),b.promise},a.prototype.signup=function(a){this.auth0Lib.signup(a)},a.prototype.reset=function(a){this.auth0Lib.reset(a)},d.provider("auth",["$provide",function(b){var c;this.init=function(a,c){var d;if(void 0===a.callbackOnLocationHash&&(a.callbackOnLocationHash=!0),c)d=new c(a);else if("undefined"!=typeof Auth0Widget)d=new Auth0Widget(a);else{if("undefined"==typeof Auth0)throw new Error("Auth0Widget or Auth0.js dependency not found");d=new Auth0(a)}b.value("auth0Lib",d)},this.$get=["$cookieStore","$rootScope","$q","$injector","urlBase64Decode","$timeout",function(b,d,f,g,h,i){var j=g.get("auth0Lib");if(!j)throw new Error("auth0Lib dependency not found. Have you called authProvider.init?");return c||(c=new a(j,b,d,f,h,i),g.has("parseHash")||(c._deserialize(),c.getProfile(c.idToken).finally(function(){c._loaded.resolve(),d.$broadcast(e.redirectEnded)}))),c}]}]);var f=angular.module("auth0-redirect",["auth0"]);f.factory("parseHash",["auth","$rootScope","$window",function(a,b,c){return function(){function d(){h&&h.id_token&&a._serialize(h.id_token,h.access_token,h.state),a._deserialize(),b.$broadcast(e.loginSuccess,a.profile)}function f(c){a._deserialize(),b.$broadcast(e.loginFailure,c)}function g(){a._loaded.resolve(),b.$broadcast(e.redirectEnded)}var h=a.parseHash(c.location.hash);a._deserialize(),a.idToken?a.getProfile(a.idToken).then(d,f).finally(g):h&&h.id_token?a.getProfile(h.id_token).then(d,f).finally(g):g()}}]),f.run(["parseHash",function(a){a()}]);var g=angular.module("authInterceptor",["auth0"]);g.factory("authInterceptor",["$rootScope","$q","AUTH_EVENTS","$injector",function(a,b,c,d){return{request:function(a){if(!d.has("auth"))return a;var b=d.get("auth");return a.headers=a.headers||{},b.idToken&&(a.headers.Authorization="Bearer "+b.idToken),a},responseError:function(d){return 401===d.status&&a.$broadcast(c.forbidden,d),b.reject(d)}}}])}(); |
# 0.4.x | ||
## 0.4.3 | ||
* Fixes Auth0Widget check to be compatible with requireJS. | ||
## 0.4.2 | ||
@@ -4,0 +8,0 @@ |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -29,2 +29,5 @@ var myApp = angular.module('myApp', [ | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.config(function ($routeProvider, authProvider, $httpProvider) { | ||
@@ -31,0 +34,0 @@ $routeProvider |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -28,2 +28,5 @@ var myApp = angular.module('myApp', [ | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.config(function ($routeProvider, authProvider, $httpProvider) { | ||
@@ -30,0 +33,0 @@ $routeProvider |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -28,2 +28,5 @@ var myApp = angular.module('myApp', [ | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.config(function ($routeProvider, authProvider, $httpProvider) { | ||
@@ -30,0 +33,0 @@ $routeProvider |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -28,2 +28,5 @@ var myApp = angular.module('myApp', [ | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.factory('customInterceptor', function ($injector, $rootScope, $q) { | ||
@@ -30,0 +33,0 @@ return { |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -41,2 +41,5 @@ var myApp = angular.module('myApp', [ | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.config(function ($routeProvider, authProvider, $httpProvider) { | ||
@@ -43,0 +46,0 @@ $routeProvider |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -29,2 +29,5 @@ define(['angular', 'auth0', 'auth0-angular', 'angular-cookies', 'angular-route'], function (angular, Auth0) { | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.config(function ($routeProvider, authProvider, $httpProvider) { | ||
@@ -31,0 +34,0 @@ $routeProvider |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -18,2 +18,5 @@ var myApp = angular.module('myApp', [ | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.config(function($stateProvider, $urlRouterProvider, $httpProvider, authProvider) { | ||
@@ -20,0 +23,0 @@ |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -37,2 +37,5 @@ var myApp = angular.module('myApp', [ | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.config(function ($routeProvider, authProvider, $httpProvider) { | ||
@@ -39,0 +42,0 @@ $routeProvider |
@@ -175,3 +175,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -178,0 +178,0 @@ // Auth0 widget & popup mode (popup: true) callback is the third parameter |
@@ -27,2 +27,5 @@ var myApp = angular.module('myApp', [ | ||
// Make it work with minifiers | ||
isAuthenticated.$inject = ['$q', 'auth']; | ||
myApp.config(function ($routeProvider, authProvider, $httpProvider) { | ||
@@ -29,0 +32,0 @@ $routeProvider |
{ | ||
"name": "auth0-angular", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"main": "./build/auth0-angular.js", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
@@ -245,3 +245,3 @@ (function () { | ||
// Auth0 Widget special cases | ||
if (typeof Auth0Widget !== 'undefined' && that.auth0Lib instanceof Auth0Widget) { | ||
if (that.auth0Lib && that.auth0Lib.constructor && that.auth0Lib.constructor.name !== 'Auth0') { | ||
if (options.popup) { | ||
@@ -248,0 +248,0 @@ |
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
353009
5831