auth0-angular
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
!function(){var a={capitalize:function(a){return a?a.charAt(0).toUpperCase()+a.substring(1).toLowerCase():null},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)}};angular.module("auth0",["auth0.storage","auth0.service","auth0.interceptor"]),angular.module("auth0.interceptor",[]).factory("authInterceptor",["$rootScope","$q","$injector",function(a,b,c){return{request:function(a){if(!c.has("auth"))return a;var b=c.get("auth");return a.headers=a.headers||{},b.idToken&&!a.headers.Authorization&&(a.headers.Authorization="Bearer "+b.idToken),a},responseError:function(c){return 401===c.status&&a.$broadcast("auth0.forbidden",c),b.reject(c)}}}]),angular.module("auth0.storage",["ngCookies"]).service("authStorage",["$cookieStore",function(a){this.store=function(b,c,d){a.put("idToken",b),a.put("accessToken",c),d&&a.put("state",d)},this.get=function(){return{idToken:a.get("idToken"),accessToken:a.get("accessToken"),state:a.get("state")}},this.remove=function(){a.remove("idToken"),a.remove("accessToken"),a.remove("state")}}]),angular.module("auth0.service",["auth0.storage"]).provider("auth",function(){var b={callbackOnLocationHash:!0},c=this;this.init=function(a,c){if(!c&&"undefined"==typeof Auth0Widget&&"undefined"==typeof Auth0)throw new Error("You must add either Auth0Widget.js or Auth0.js");if(!a)throw new Error("You must set options when calling init");this.loginUrl=a.loginUrl,this.loginState=a.loginState,this.clientID=a.clientID,this.sso=a.sso;var d=c;d||"undefined"==typeof Auth0Widget||(d=Auth0Widget),d||"undefined"==typeof Auth0||(d=Auth0),this.auth0lib=new d(angular.extend(b,a)),this.auth0lib.getClient?(this.auth0js=this.auth0lib.getClient(),this.isWidget=!0):(this.auth0js=this.auth0lib,this.isWidget=!1)},this.eventHandlers={},this.on=function(a,b){this.eventHandlers[a]||(this.eventHandlers[a]=[]),this.eventHandlers[a].push(b)};var d=["loginSuccess","loginFailure","logout","forbidden"];angular.forEach(d,function(b){c["add"+a.capitalize(b)+"Handler"]=function(a){c.on(b,a)}}),this.$get=["$rootScope","$q","$injector","authStorage","$window","$location",function(b,d,e,f,g,h){var i={isAuthenticated:!1},j=function(a){return c.eventHandlers[a]},k=function(a,b){angular.forEach(j(a)||[],function(a){e.invoke(a,i,b)})},l=function(a){var c=b.$root.$$phase;"$apply"===c||"$digest"===c?a&&"function"==typeof a&&a():b.$apply(a)},m=function(a){return function(){var b=arguments;l(function(){a.apply(null,b)})}},n=function(a,b,c,d){f.store(a,b,c);var e=i.getProfile(a),g={idToken:a,accessToken:b,state:c,isAuthenticated:!0};return angular.extend(i,g),k("loginSuccess",angular.extend({profile:e,locationEvent:d},g)),e};b.$on("$locationChangeStart",function(a){var b=c.auth0lib.parseHash(g.location.hash);if(!i.isAuthenticated){if(b&&b.id_token)return void n(b.id_token,b.access_token,b.state,a);var d=f.get();if(d&&d.idToken)return void n(d.idToken,d.accessToken,d.state,a);c.sso&&c.auth0js.getSSOData(m(function(a,b){b.sso&&i.signin({popup:!1,connection:b.lastUsedConnection.strategy},c.auth0js)}))}}),b.$on("auth0.forbidden",function(a,b){k("forbidden",{response:b})}),c.loginUrl&&b.$on("$routeChangeStart",function(a,b){b.$$route&&b.$$route.requiresLogin&&(i.isAuthenticated||h.path(c.loginUrl))}),c.loginState&&b.$on("$stateChangeStart",function(a,b){b.data&&b.data.requiresLogin&&(i.isAuthenticated||(a.preventDefault(),e.get("$state").go(c.loginState)))}),i.config=c;var o=function(a){var b=j("loginSuccess");if(!(a.popup||a.username||b&&0!==b.length))throw new Error("You must define a loginSuccess handlerif not using popup mode or not doing ro call because that means you are doing a redirect")};return i.hasTokenExpired=function(b){if(!b)return!0;var c=b.split(".");if(3!==c.length)return!0;var d=a.urlBase64Decode(c[1]);if(!d)return!0;try{d=JSON.parse(d)}catch(e){return!0}if(!d.exp)return!0;var f=new Date(0);return f.setUTCSeconds(d.exp),isNaN(f)?!0:f.valueOf()>(new Date).valueOf()?!1:!0},i.getToken=function(a,b){b=b||{scope:"openid"};var e=d.defer();return c.auth0js.getDelegationToken(a,this.idToken,b,m(function(a,b){a?e.reject(a):e.resolve(b.id_token)})),e.promise},i.refreshToken=function(a){return i.getToken(c.clientID,a)},i.signin=function(a,b){a=a||{},o(a);var e=function(a){return function(b,c,d,e,f){if(b)return k("loginFailure",{error:b}),void a.reject(b);var g=n(d,e,f);g.then(function(b){a.resolve(b)},function(b){k("loginFailure",{error:b}),a.reject(b)})}},f=d.defer(),g=b||c.auth0lib;return c.isWidget?g.signin(a,null,m(e(f))):g.signin(a,m(e(f))),f.promise},i.signout=function(){f.remove(),i.profile=null,i.idToken=null,i.state=null,i.accessToken=null,i.isAuthenticated=!1},i.getProfile=function(a){var b=d.defer(),e=function(a,c){return a?void b.reject(a):(i.profile=c,void b.resolve(c))};return c.auth0lib.getProfile(a||i.idToken,m(e)),b.promise},i}]})}(); | ||
!function(){var a={capitalize:function(a){return a?a.charAt(0).toUpperCase()+a.substring(1).toLowerCase():null},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)}};angular.module("auth0",["auth0.storage","auth0.service","auth0.interceptor"]),angular.module("auth0.interceptor",[]).factory("authInterceptor",["$rootScope","$q","$injector",function(a,b,c){return{request:function(a){if(!c.has("auth"))return a;var b=c.get("auth");return a.headers=a.headers||{},b.idToken&&!a.headers.Authorization&&(a.headers.Authorization="Bearer "+b.idToken),a},responseError:function(c){return 401===c.status&&a.$broadcast("auth0.forbidden",c),b.reject(c)}}}]),angular.module("auth0.storage",["ngCookies"]).service("authStorage",["$cookieStore",function(a){this.store=function(b,c,d){a.put("idToken",b),a.put("accessToken",c),d&&a.put("state",d)},this.get=function(){return{idToken:a.get("idToken"),accessToken:a.get("accessToken"),state:a.get("state")}},this.remove=function(){a.remove("idToken"),a.remove("accessToken"),a.remove("state")}}]),angular.module("auth0.service",["auth0.storage"]).provider("auth",function(){var b={callbackOnLocationHash:!0},c=this;this.init=function(a,c){if(!c&&"undefined"==typeof Auth0Widget&&"undefined"==typeof Auth0)throw new Error("You must add either Auth0Widget.js or Auth0.js");if(!a)throw new Error("You must set options when calling init");this.loginUrl=a.loginUrl,this.loginState=a.loginState,this.clientID=a.clientID,this.sso=a.sso;var d=c;d||"undefined"==typeof Auth0Widget||(d=Auth0Widget),d||"undefined"==typeof Auth0||(d=Auth0),this.auth0lib=new d(angular.extend(b,a)),this.auth0lib.getClient?(this.auth0js=this.auth0lib.getClient(),this.isWidget=!0):(this.auth0js=this.auth0lib,this.isWidget=!1)},this.eventHandlers={},this.on=function(a,b){this.eventHandlers[a]||(this.eventHandlers[a]=[]),this.eventHandlers[a].push(b)};var d=["loginSuccess","loginFailure","logout","forbidden"];angular.forEach(d,function(b){c["add"+a.capitalize(b)+"Handler"]=function(a){c.on(b,a)}}),this.$get=["$rootScope","$q","$injector","authStorage","$window","$location",function(b,d,e,f,g,h){var i={isAuthenticated:!1},j=function(a){return c.eventHandlers[a]},k=function(a,b){angular.forEach(j(a)||[],function(a){e.invoke(a,i,b)})},l=function(a){var c=b.$root.$$phase;"$apply"===c||"$digest"===c?a&&"function"==typeof a&&a():b.$apply(a)},m=function(a){return function(){var b=arguments;l(function(){a.apply(null,b)})}},n=function(a,b,c,d){f.store(a,b,c);var e=i.getProfile(a),g={idToken:a,accessToken:b,state:c,isAuthenticated:!0};return angular.extend(i,g),k("loginSuccess",angular.extend({profile:e,locationEvent:d},g)),e};b.$on("$locationChangeStart",function(a){var b=c.auth0lib.parseHash(g.location.hash);if(!i.isAuthenticated){if(b&&b.id_token)return void n(b.id_token,b.access_token,b.state,a);var d=f.get();if(d&&d.idToken)return void n(d.idToken,d.accessToken,d.state,a);c.sso&&c.auth0js.getSSOData(m(function(a,b){b.sso&&i.signin({popup:!1,connection:b.lastUsedConnection.strategy},c.auth0js)}))}}),b.$on("auth0.forbidden",function(a,b){k("forbidden",{response:b})}),c.loginUrl&&b.$on("$routeChangeStart",function(a,b){b.$$route&&b.$$route.requiresLogin&&(i.isAuthenticated||h.path(c.loginUrl))}),c.loginState&&b.$on("$stateChangeStart",function(a,b){b.data&&b.data.requiresLogin&&(i.isAuthenticated||(a.preventDefault(),e.get("$state").go(c.loginState)))}),i.config=c;var o=function(a){var b=j("loginSuccess");if(!(a.popup||a.username||b&&0!==b.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")};return i.hasTokenExpired=function(b){if(!b)return!0;var c=b.split(".");if(3!==c.length)return!0;var d=a.urlBase64Decode(c[1]);if(!d)return!0;try{d=JSON.parse(d)}catch(e){return!0}if(!d.exp)return!0;var f=new Date(0);return f.setUTCSeconds(d.exp),isNaN(f)?!0:f.valueOf()>(new Date).valueOf()?!1:!0},i.getToken=function(a,b){b=b||{scope:"openid"};var e=d.defer();return c.auth0js.getDelegationToken(a,this.idToken,b,m(function(a,b){a?e.reject(a):e.resolve(b.id_token)})),e.promise},i.refreshToken=function(a){return i.getToken(c.clientID,a)},i.signin=function(a,b){a=a||{},o(a);var e=function(a){return function(b,c,d,e,f){if(b)return k("loginFailure",{error:b}),void a.reject(b);var g=n(d,e,f);g.then(function(b){a.resolve(b)},function(b){k("loginFailure",{error:b}),a.reject(b)})}},f=d.defer(),g=b||c.auth0lib;return c.isWidget?g.signin(a,null,m(e(f))):g.signin(a,m(e(f))),f.promise},i.signout=function(){f.remove(),i.profile=null,i.idToken=null,i.state=null,i.accessToken=null,i.isAuthenticated=!1},i.getProfile=function(a){var b=d.defer(),e=function(a,c){return a?void b.reject(a):(i.profile=c,void b.resolve(c))};return c.auth0lib.getProfile(a||i.idToken,m(e)),b.promise},i}]})}(); |
# 1.0.X | ||
## 1.1.0 | ||
* Better popup handling (powered by Winchan). | ||
* Phonegap support. | ||
* updated examples: Auth0.js to 3.1 and Widget to 5.0. | ||
## 1.0.1 | ||
* Added `sso` configuration to the `authProvider` to use `SSO`. | ||
* Added `sso` configuration to the `authProvider` to use `SSO`. | ||
@@ -6,0 +11,0 @@ ## 1.0.0 |
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -7,3 +7,3 @@ require.config({ | ||
'auth-angular': './auth0-angular', | ||
'auth0': '//cdn.auth0.com/w2/auth0-2.0' | ||
'auth0': '//cdn.auth0.com/w2/auth0-3.1' | ||
}, | ||
@@ -10,0 +10,0 @@ shim: { |
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -241,3 +241,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
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'); | ||
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'); | ||
} | ||
@@ -244,0 +244,0 @@ }; |
@@ -74,5 +74,6 @@ var pkg = require('./package'); | ||
'examples/delegation-token/client/scripts/auth0-angular.js': 'build/auth0-angular.js', | ||
'examples/custom-signup/client/scripts/auth0-angular.js': 'build/auth0-angular.js', | ||
'examples/custom-signup/client/scripts/auth0-angular.js': 'build/auth0-angular.js', | ||
'examples/api-authentication/client/scripts/auth0-angular.js': 'build/auth0-angular.js', | ||
'examples/widget/scripts/auth0-angular.js': 'build/auth0-angular.js', | ||
'examples/sso/scripts/auth0-angular.js': 'build/auth0-angular.js', | ||
'examples/widget-redirect/scripts/auth0-angular.js': 'build/auth0-angular.js', | ||
@@ -79,0 +80,0 @@ 'examples/ui-router/scripts/auth0-angular.js': 'build/auth0-angular.js', |
{ | ||
"name": "auth0-angular", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"main": "./build/auth0-angular.js", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
# Auth0 and AngularJS | ||
This AngularJS module will help you implement client-side and server-side (API) authentication. You can use it together with [Auth0](https://www.auth0.com) to add support for sername/password authentication, enterprise identity providers like Active Directory or SAML and also for social identity providers like Google, Facebook or Salesforce among others to your web, API and mobile native apps. | ||
This AngularJS module will help you implement client-side and server-side (API) authentication. You can use it together with [Auth0](https://www.auth0.com) to add support for username/password authentication, enterprise identity providers like Active Directory or SAML and also for social identity providers like Google, Facebook or Salesforce among others to your web, API and mobile native apps. | ||
@@ -25,3 +25,3 @@ [Auth0](https://www.auth0.com) is a cloud service that provides a turn-key solution for authentication, authorization and Single Sign On. | ||
![widget_guide](https://cloud.githubusercontent.com/assets/419703/2867712/3580ca60-d23a-11e3-8312-636a309d7af0.gif) | ||
![widget_guide](https://cloudup.com/ctj4-5kRNFf+) | ||
@@ -34,3 +34,3 @@ #### User/Password + Social Login with Auth0 Widget (popup mode) | ||
![widget_popup](https://cloud.githubusercontent.com/assets/419703/2959883/1b7e1d9a-dab7-11e3-8060-bb14b3430e03.gif) | ||
![widget_popup](https://cloudup.com/cg8u9kVV5Vh+) | ||
@@ -46,3 +46,3 @@ | ||
![basic_guide](https://cloud.githubusercontent.com/assets/419703/2867713/35ac5914-d23a-11e3-91f9-b6365a10137f.gif) | ||
![basic_guide](https://cloudup.com/cmaeJKX7LEM+) | ||
@@ -55,3 +55,3 @@ #### Social Login | ||
![popup_guide](https://cloud.githubusercontent.com/assets/419703/2883025/e09a9158-d495-11e3-814b-32ae41ce1cc6.gif) | ||
![popup_guide](https://cloudup.com/cKpVNpR4s9y+) | ||
@@ -62,3 +62,3 @@ Also, we have an [examples](examples) section that contains comprehensive scenarios. | ||
You can now use `sso`. If you have multiple Angular apps in different domains, you can have your users Log in to one if they're logged in to another one. It's important that you **DON'T** use `popup` mode with this: | ||
You can now use `sso`. If you have multiple Angular apps in different domains, you can have your users be automatically logged in to one of your apps if they're logged in to the another one. It's important that you **DON'T** use `popup` mode with this: | ||
@@ -81,2 +81,4 @@ ````js | ||
You can [Check out the example here](https://github.com/auth0/auth0-angular/tree/master/examples/sso) | ||
## Documentation | ||
@@ -83,0 +85,0 @@ * [Using Redirect Mode](docs/redirect.md) |
@@ -170,4 +170,12 @@ /** | ||
expect(element(by.css('.message')).getText()).toEqual('invalid credentials'); | ||
browser.driver.wait(function() { | ||
return element(by.css('.message')).getText().then(function (text) { | ||
return 'invalid credentials' === text; | ||
}); | ||
}); | ||
element(by.css('.message')).getText().then(function (text) { | ||
expect(text).toEqual('invalid credentials'); | ||
}); | ||
}); | ||
@@ -174,0 +182,0 @@ }); |
@@ -257,3 +257,3 @@ (function () { | ||
if (!options.popup && !options.username && (!successHandlers || successHandlers.length === 0)) { | ||
throw new Error('You must define a loginSuccess handler' + | ||
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'); | ||
@@ -260,0 +260,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
334026
150
5502
107