Socket
Socket
Sign inDemoInstall

angular-lock

Package Overview
Dependencies
47
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-beta.1 to 2.0.0

146

angular-lock.js

@@ -1,9 +0,5 @@

;(function() {
(function() {
'use strict';
angular.module('auth0.lock', []).provider('lock', lock);
angular
.module('auth0.lock', [])
.provider('lock', lock);
function lock() {

@@ -15,4 +11,8 @@ if (typeof Auth0Lock !== 'function') {

// Stub required functions to allow auth0-angular to initialize
Auth0Lock.prototype.getClient = function() { void 0; };
Auth0Lock.prototype.parseHash = function() { void 0; };
Auth0Lock.prototype.getClient = function() {
void 0;
};
Auth0Lock.prototype.parseHash = function() {
void 0;
};

@@ -28,78 +28,86 @@ this.init = function(config) {

this.$get = ["$rootScope", function($rootScope) {
var Lock = new Auth0Lock(this.clientID, this.domain, this.options);
var credentials = {clientID: this.clientID, domain: this.domain};
var lock = {};
var functions = [];
for (var i in Lock) {
if(typeof Lock[i] === 'function') {
functions.push(i);
this.$get = [
'$rootScope',
function($rootScope) {
var Lock = new Auth0Lock(this.clientID, this.domain, this.options);
var credentials = { clientID: this.clientID, domain: this.domain };
var shouldVerifyIdToken = true;
if (this.options._idTokenVerification === false)
shouldVerifyIdToken = false;
var lock = {};
var functions = [];
for (var i in Lock) {
if (typeof Lock[i] === 'function') {
functions.push(i);
}
}
}
function safeApply(fn) {
var phase = $rootScope.$root.$$phase;
if(phase === '$apply' || phase === '$digest') {
if(fn && (typeof(fn) === 'function')) {
fn();
function safeApply(fn) {
var phase = $rootScope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn && typeof fn === 'function') {
fn();
}
} else {
$rootScope.$apply(fn);
}
} else {
$rootScope.$apply(fn);
}
}
function wrapArguments(parameters) {
var lastIndex = parameters.length - 1,
func = parameters[lastIndex];
if(typeof func === 'function') {
parameters[lastIndex] = function() {
var args = arguments;
safeApply(function() {
func.apply(Lock, args)
})
function wrapArguments(parameters) {
var lastIndex = parameters.length - 1, func = parameters[lastIndex];
if (typeof func === 'function') {
parameters[lastIndex] = function() {
var args = arguments;
safeApply(function() {
func.apply(Lock, args);
});
};
}
return parameters;
}
return parameters;
}
for (var i = 0; i < functions.length; i++) {
lock[functions[i]] = (function(name){
var customFunction = function() {
return Lock[name].apply(Lock, wrapArguments(arguments) );
};
return customFunction;
})(functions[i]);
}
lock.interceptHash = function() {
if (typeof auth0.WebAuth !== 'function') {
throw new Error('Auth0.js version 8 or higher must be loaded');
return;
for (var i = 0; i < functions.length; i++) {
lock[functions[i]] = (function(name) {
var customFunction = function() {
return Lock[name].apply(Lock, wrapArguments(arguments));
};
return customFunction;
})(functions[i]);
}
$rootScope.$on('$locationChangeStart', function(event, location) {
lock.interceptHash = function() {
if (typeof auth0.WebAuth !== 'function') {
throw new Error('Auth0.js version 8 or higher must be loaded');
return;
}
if (/id_token=/.test(location) || /error=/.test(location)) {
var webAuth = new auth0.WebAuth(credentials);
$rootScope.$on('$locationChangeStart', function(event, location) {
if (/id_token=/.test(location) || /error=/.test(location)) {
var webAuth = new auth0.WebAuth(credentials);
// Hash simulation for html5Mode(true).
var hash = (window.location.hash) ? window.location.hash : '#' + location.replace(/http.?:\/\/[^/]+/,'').slice(1);
// Hash simulation for html5Mode(true).
var hash = window.location.hash
? window.location.hash
: '#' + location.replace(/http.?:\/\/[^/]+/, '').slice(1);
webAuth.parseHash({ hash: hash }, function(err, authResult) {
if (err) {
Lock.emit('authorization_error', err);
}
if (authResult && authResult.idToken) {
Lock.emit('authenticated', authResult);
}
});
}
webAuth.parseHash(
{ hash: hash, _idTokenVerification: shouldVerifyIdToken },
function(err, authResult) {
console.log('here');
if (err) {
Lock.emit('authorization_error', err);
}
if (authResult && authResult.idToken) {
Lock.emit('authenticated', authResult);
}
}
);
}
});
};
});
};
return lock;
}]
return lock;
}
];
}
})();
{
"name": "angular-lock",
"version": "2.0.0-beta.1",
"version": "2.0.0",
"main": "angular-lock.js",
"dependencies": {
"angular": "*",
"auth0-lock": ">= 10.9.0",
"auth0.js": "^8.0.0"
"auth0-lock": ">=10.13.0",
"auth0.js": "^8.4.0"
},
"resolutions": {
"angular": "1.5.8"
"angular": "1.6.3"
}
}

@@ -1,9 +0,5 @@

;(function() {
(function() {
'use strict';
angular.module('auth0.lock', []).provider('lock', lock);
angular
.module('auth0.lock', [])
.provider('lock', lock);
function lock() {

@@ -15,4 +11,8 @@ if (typeof Auth0Lock !== 'function') {

// Stub required functions to allow auth0-angular to initialize
Auth0Lock.prototype.getClient = function() { void 0; };
Auth0Lock.prototype.parseHash = function() { void 0; };
Auth0Lock.prototype.getClient = function() {
void 0;
};
Auth0Lock.prototype.parseHash = function() {
void 0;
};

@@ -28,78 +28,86 @@ this.init = function(config) {

this.$get = ["$rootScope", function($rootScope) {
var Lock = new Auth0Lock(this.clientID, this.domain, this.options);
var credentials = {clientID: this.clientID, domain: this.domain};
var lock = {};
var functions = [];
for (var i in Lock) {
if(typeof Lock[i] === 'function') {
functions.push(i);
this.$get = [
'$rootScope',
function($rootScope) {
var Lock = new Auth0Lock(this.clientID, this.domain, this.options);
var credentials = { clientID: this.clientID, domain: this.domain };
var shouldVerifyIdToken = true;
if (this.options._idTokenVerification === false)
shouldVerifyIdToken = false;
var lock = {};
var functions = [];
for (var i in Lock) {
if (typeof Lock[i] === 'function') {
functions.push(i);
}
}
}
function safeApply(fn) {
var phase = $rootScope.$root.$$phase;
if(phase === '$apply' || phase === '$digest') {
if(fn && (typeof(fn) === 'function')) {
fn();
function safeApply(fn) {
var phase = $rootScope.$root.$$phase;
if (phase === '$apply' || phase === '$digest') {
if (fn && typeof fn === 'function') {
fn();
}
} else {
$rootScope.$apply(fn);
}
} else {
$rootScope.$apply(fn);
}
}
function wrapArguments(parameters) {
var lastIndex = parameters.length - 1,
func = parameters[lastIndex];
if(typeof func === 'function') {
parameters[lastIndex] = function() {
var args = arguments;
safeApply(function() {
func.apply(Lock, args)
})
function wrapArguments(parameters) {
var lastIndex = parameters.length - 1, func = parameters[lastIndex];
if (typeof func === 'function') {
parameters[lastIndex] = function() {
var args = arguments;
safeApply(function() {
func.apply(Lock, args);
});
};
}
return parameters;
}
return parameters;
}
for (var i = 0; i < functions.length; i++) {
lock[functions[i]] = (function(name){
var customFunction = function() {
return Lock[name].apply(Lock, wrapArguments(arguments) );
};
return customFunction;
})(functions[i]);
}
lock.interceptHash = function() {
if (typeof auth0.WebAuth !== 'function') {
throw new Error('Auth0.js version 8 or higher must be loaded');
return;
for (var i = 0; i < functions.length; i++) {
lock[functions[i]] = (function(name) {
var customFunction = function() {
return Lock[name].apply(Lock, wrapArguments(arguments));
};
return customFunction;
})(functions[i]);
}
$rootScope.$on('$locationChangeStart', function(event, location) {
lock.interceptHash = function() {
if (typeof auth0.WebAuth !== 'function') {
throw new Error('Auth0.js version 8 or higher must be loaded');
return;
}
if (/id_token=/.test(location) || /error=/.test(location)) {
var webAuth = new auth0.WebAuth(credentials);
$rootScope.$on('$locationChangeStart', function(event, location) {
if (/id_token=/.test(location) || /error=/.test(location)) {
var webAuth = new auth0.WebAuth(credentials);
// Hash simulation for html5Mode(true).
var hash = (window.location.hash) ? window.location.hash : '#' + location.replace(/http.?:\/\/[^/]+/,'').slice(1);
// Hash simulation for html5Mode(true).
var hash = window.location.hash
? window.location.hash
: '#' + location.replace(/http.?:\/\/[^/]+/, '').slice(1);
webAuth.parseHash({ hash: hash }, function(err, authResult) {
if (err) {
Lock.emit('authorization_error', err);
}
if (authResult && authResult.idToken) {
Lock.emit('authenticated', authResult);
}
});
}
webAuth.parseHash(
{ hash: hash, _idTokenVerification: shouldVerifyIdToken },
function(err, authResult) {
console.log('here');
if (err) {
Lock.emit('authorization_error', err);
}
if (authResult && authResult.idToken) {
Lock.emit('authenticated', authResult);
}
}
);
}
});
};
});
};
return lock;
}]
return lock;
}
];
}
})();

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

!function(){"use strict";function t(){if("function"!=typeof Auth0Lock)throw new Error("Auth0Lock must be loaded.");Auth0Lock.prototype.getClient=function(){},Auth0Lock.prototype.parseHash=function(){},this.init=function(t){if(!t)throw new Error("clientID and domain must be provided to lock");this.clientID=t.clientID,this.domain=t.domain,this.options=t.options||{}},this.$get=["$rootScope",function(t){function o(o){var n=t.$root.$$phase;"$apply"===n||"$digest"===n?o&&"function"==typeof o&&o():t.$apply(o)}function n(t){var n=t.length-1,e=t[n];return"function"==typeof e&&(t[n]=function(){var t=arguments;o(function(){e.apply(i,t)})}),t}var i=new Auth0Lock(this.clientID,this.domain,this.options),e={clientID:this.clientID,domain:this.domain},r={},a=[];for(var u in i)"function"==typeof i[u]&&a.push(u);for(var u=0;u<a.length;u++)r[a[u]]=function(t){var o=function(){return i[t].apply(i,n(arguments))};return o}(a[u]);return r.interceptHash=function(){if("function"!=typeof auth0.WebAuth)throw new Error("Auth0.js version 8 or higher must be loaded");t.$on("$locationChangeStart",function(t,o){if(/id_token=/.test(o)||/error=/.test(o)){var n=new auth0.WebAuth(e),r=window.location.hash?window.location.hash:"#"+o.replace(/http.?:\/\/[^\/]+/,"").slice(1);n.parseHash({hash:r},function(t,o){t&&i.emit("authorization_error",t),o&&o.idToken&&i.emit("authenticated",o)})}})},r}]}angular.module("auth0.lock",[]).provider("lock",t)}();
!function(){"use strict";function t(){if("function"!=typeof Auth0Lock)throw new Error("Auth0Lock must be loaded.");Auth0Lock.prototype.getClient=function(){},Auth0Lock.prototype.parseHash=function(){},this.init=function(t){if(!t)throw new Error("clientID and domain must be provided to lock");this.clientID=t.clientID,this.domain=t.domain,this.options=t.options||{}},this.$get=["$rootScope",function(t){function o(o){var n=t.$root.$$phase;"$apply"===n||"$digest"===n?o&&"function"==typeof o&&o():t.$apply(o)}function n(t){var n=t.length-1,e=t[n];return"function"==typeof e&&(t[n]=function(){var t=arguments;o(function(){e.apply(i,t)})}),t}var i=new Auth0Lock(this.clientID,this.domain,this.options),e={clientID:this.clientID,domain:this.domain},r=!0;this.options._idTokenVerification===!1&&(r=!1);var a={},c=[];for(var h in i)"function"==typeof i[h]&&c.push(h);for(var h=0;h<c.length;h++)a[c[h]]=function(t){return function(){return i[t].apply(i,n(arguments))}}(c[h]);return a.interceptHash=function(){if("function"!=typeof auth0.WebAuth)throw new Error("Auth0.js version 8 or higher must be loaded");t.$on("$locationChangeStart",function(t,o){if(/id_token=/.test(o)||/error=/.test(o)){var n=new auth0.WebAuth(e),a=window.location.hash?window.location.hash:"#"+o.replace(/http.?:\/\/[^\/]+/,"").slice(1);n.parseHash({hash:a,_idTokenVerification:r},function(t,o){console.log("here"),t&&i.emit("authorization_error",t),o&&o.idToken&&i.emit("authenticated",o)})}})},a}]}angular.module("auth0.lock",[]).provider("lock",t)}();
{
"name": "angular-lock",
"version": "2.0.0-beta.1",
"version": "2.0.0",
"description": "Angular wrapper for Lock",

@@ -18,10 +18,10 @@ "main": "angular-lock.js",

"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-concat": "^2.6.1",
"gulp-ng-annotate": "^2.0.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^2.0.0"
"gulp-uglify": "^2.1.0"
},
"dependencies": {
"auth0-js": "^8.0.4"
"auth0-js": "^8.4.0"
}
}

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

# Auth0 Lock 10 for Angular 1.x
# Auth0 Lock for Angular 1.x
This module provides a thin wrapper for version 10 of Auth0's [Lock widget](https://auth0.com/docs/libraries/lock).
> **Note:** angular-lock version 2 is meant to be used with Auth0Lock version 10.9 or higher. Please ensure you have auth0.js v8 or higher loaded.
> **Note:** angular-lock version 2.0 is meant to be used with Auth0Lock version 10.9 or higher. Please ensure you have auth0.js v8 or higher loaded as well.

@@ -12,3 +12,3 @@ ## Installation

```bash
bower install angular-lock#2.0.0-beta.0
bower install angular-lock
```

@@ -19,8 +19,6 @@

```html
...
<script src="bower_components/auth0-lock/build/lock.js"></script>
<script src="bower_components/auth0.js/build/auth0.js"></script>
<script src="bower_components/angular-lock/build/angular-lock.js"></script>
...
```

@@ -48,2 +46,18 @@

With Lock versions > 10.9 (and thus auth0.js versions > 8.0), the `id_token` must be signed with the RS256 algorithm. You may choose to skip `id_token` verification if you need to use HS256 as the signing algorithm.
```js
app.config(function(lockProvider) {
lockProvider.init({
clientID: AUTH0_CLIENT_ID,
domain: AUTH0_DOMAIN,
options: {
_idTokenVerification: false
}
});
});
```
See the [auth0.js migration guide](https://auth0.com/docs/libraries/auth0js/migration-guide#switching-from-hs256-to-rs256) for more information.
Use `lock` in the `run` block, in a service, or in a controller. For example, show the Auth0Lock widget from a controller and associated view.

@@ -59,3 +73,2 @@

```html
...

@@ -62,0 +75,0 @@ <div ng-controller="loginController as login">

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc