Comparing version 2.31.1 to 2.32.0
# Change Log | ||
## [v2.32.0](https://github.com/auth0/node-auth0/tree/v2.32.0) (2021-01-21) | ||
**Added** | ||
- Additional options on getByEmail [SDK-2268][\#577](https://github.com/auth0/node-auth0/pull/577) ([davidpatrick](https://github.com/davidpatrick)) | ||
- [SDK-2261] Add forwardFor support to passwordless calls [\#576](https://github.com/auth0/node-auth0/pull/576) ([frederikprijck](https://github.com/frederikprijck)) | ||
- Adding Support for Guardian factor settings endpoints [\#569](https://github.com/auth0/node-auth0/pull/569) ([JayHelton](https://github.com/JayHelton)) | ||
[Full Changelog](https://github.com/auth0/node-auth0/compare/v2.31.1...v2.32.0) | ||
## [v2.31.1](https://github.com/auth0/node-auth0/tree/v2.31.1) (2021-01-05) | ||
@@ -4,0 +14,0 @@ |
{ | ||
"name": "auth0", | ||
"version": "2.31.1", | ||
"version": "2.32.0", | ||
"description": "SDK for Auth0 API v2", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -5,3 +5,17 @@ var extend = require('util')._extend; | ||
var RestClient = require('rest-facade').Client; | ||
var sanitizeArguments = require('../utils').sanitizeArguments; | ||
function getParamsFromOptions(options) { | ||
const params = {}; | ||
if (!options || typeof options !== 'object') { | ||
return params; | ||
} | ||
if (options.forwardedFor) { | ||
params._requestCustomizer = function(req) { | ||
req.set('auth0-forwarded-for', options.forwardedFor); | ||
}; | ||
} | ||
return params; | ||
} | ||
/** | ||
@@ -97,2 +111,4 @@ * @class | ||
* @param {String} [userData.connection=sms] [DEPRECATED] Connection string: "sms" or "email". | ||
* @param {Object} [options] Additional options. | ||
* @param {String} [options.forwardedFor] Value to be used for auth0-forwarded-for header | ||
* @param {Function} [cb] Method callback. | ||
@@ -102,3 +118,4 @@ * | ||
*/ | ||
PasswordlessAuthenticator.prototype.signIn = function(userData, cb) { | ||
PasswordlessAuthenticator.prototype.signIn = function(userData, options, cb) { | ||
var { options, cb } = sanitizeArguments(options, cb); | ||
var defaultFields = { | ||
@@ -124,3 +141,3 @@ client_id: this.clientId, | ||
data.grant_type = 'http://auth0.com/oauth/grant-type/passwordless/otp'; | ||
return this.oauth.signIn(data, { type: 'token' }, cb); | ||
return this.oauth.signIn(data, extend({ type: 'token' }, options), cb); | ||
} | ||
@@ -141,4 +158,3 @@ | ||
); | ||
return this.oauth.signIn(data, cb); | ||
return this.oauth.signIn(data, options, cb); | ||
}; | ||
@@ -187,2 +203,4 @@ | ||
* @param {String} userData.send The type of email to be sent. | ||
* @param {Object} [options] Additional options. | ||
* @param {String} [options.forwardedFor] Value to be used for auth0-forwarded-for header | ||
* @param {Function} [cb] Method callback. | ||
@@ -192,3 +210,4 @@ * | ||
*/ | ||
PasswordlessAuthenticator.prototype.sendEmail = function(userData, cb) { | ||
PasswordlessAuthenticator.prototype.sendEmail = function(userData, options, cb) { | ||
var { options, cb } = sanitizeArguments(options, cb); | ||
var defaultFields = { | ||
@@ -198,2 +217,3 @@ client_id: this.clientId, | ||
}; | ||
var params = getParamsFromOptions(options); | ||
var data = extend(defaultFields, userData); | ||
@@ -217,6 +237,6 @@ | ||
if (cb && cb instanceof Function) { | ||
return this.passwordless.create(data, cb); | ||
return this.passwordless.create(params, data, cb); | ||
} | ||
return this.passwordless.create(data); | ||
return this.passwordless.create(params, data); | ||
}; | ||
@@ -249,2 +269,4 @@ | ||
* @param {String} userData.phone_number User phone number. | ||
* @param {Object} [options] Additional options. | ||
* @param {String} [options.forwardedFor] Value to be used for auth0-forwarded-for header | ||
* @param {Function} [cb] Method callback. | ||
@@ -254,3 +276,4 @@ * | ||
*/ | ||
PasswordlessAuthenticator.prototype.sendSMS = function(userData, cb) { | ||
PasswordlessAuthenticator.prototype.sendSMS = function(userData, options, cb) { | ||
var { options, cb } = sanitizeArguments(options, cb); | ||
var defaultFields = { | ||
@@ -260,2 +283,3 @@ client_id: this.clientId, | ||
}; | ||
var params = getParamsFromOptions(options); | ||
var data = extend(defaultFields, userData); | ||
@@ -275,8 +299,8 @@ | ||
if (cb && cb instanceof Function) { | ||
return this.passwordless.create(data, cb); | ||
return this.passwordless.create(params, data, cb); | ||
} | ||
return this.passwordless.create(data); | ||
return this.passwordless.create(params, data); | ||
}; | ||
module.exports = PasswordlessAuthenticator; |
@@ -79,2 +79,14 @@ var ArgumentError = require('rest-facade').ArgumentError; | ||
/** | ||
* Provides an abstraction layer for configuring Factor settings | ||
* | ||
* @type {external:RestClient} | ||
*/ | ||
var guardianFactorSettingsAuth0RestClient = new Auth0RestClient( | ||
options.baseUrl + '/guardian/factors/:name/settings', | ||
clientOptions, | ||
options.tokenProvider | ||
); | ||
this.factorSettings = new RetryRestClient(guardianFactorSettingsAuth0RestClient, options.retry); | ||
/** | ||
* Provides an abstraction layer for retrieving Guardian factor templates. | ||
@@ -225,2 +237,41 @@ * | ||
/** | ||
* Get Guardian factor configuration | ||
* | ||
* @method getFactorSettings | ||
* @memberOf module:management.GuardianManager.prototype | ||
* | ||
* @example | ||
* management.guardian.getFactorSettings({ name: 'webauthn-roaming' }, function (err, settings) { | ||
* console.log(settings); | ||
* }); | ||
* | ||
* @param {Object} params Factor parameters. | ||
* @param {Function} [cb] Callback function. | ||
* | ||
* @return {Promise|undefined} | ||
*/ | ||
utils.wrapPropertyMethod(GuardianManager, 'getFactorSettings', 'factorSettings.get'); | ||
/** | ||
* Update Guardian factor configuration | ||
* | ||
* @method updateFactorSettings | ||
* @memberOf module:management.GuardianManager.prototype | ||
* | ||
* @example | ||
* management.guardian.updateFactorSettings( | ||
* { name: 'webauthn-roaming' }, | ||
* { userVerification: 'discouraged', overrideRelyingParty: false }, | ||
* function (err, settings) { | ||
* console.log(settings); | ||
* }); | ||
* | ||
* @param {Object} params Factor parameters. | ||
* @param {Function} [cb] Callback function. | ||
* | ||
* @return {Promise|undefined} | ||
*/ | ||
utils.wrapPropertyMethod(GuardianManager, 'updateFactorSettings', 'factorSettings.update'); | ||
/** | ||
* Get Guardian factor provider configuration | ||
@@ -227,0 +278,0 @@ * |
var ArgumentError = require('rest-facade').ArgumentError; | ||
var Auth0RestClient = require('../Auth0RestClient'); | ||
var RetryRestClient = require('../RetryRestClient'); | ||
var sanitizeArguments = require('../utils').sanitizeArguments; | ||
@@ -241,9 +242,14 @@ /** | ||
* | ||
* @param {String} [email] Email address of user(s) to find | ||
* @param {Function} [cb] Callback function. | ||
* @param {String} [email] Email address of user(s) to find | ||
* @param {Object} [options] Additional options to pass to the endpoint | ||
* @param {String} [options.fields] Comma-separated list of fields to include or exclude in the result | ||
* @param {Boolean} [options.include_fields] Whether specified fields are to be included (true) or excluded (false). Defaults to true. | ||
* @param {Function} [cb] Callback function. | ||
* | ||
* @return {Promise|undefined} | ||
*/ | ||
UsersManager.prototype.getByEmail = function(email, callback) { | ||
return this.usersByEmail.getAll({ email }, callback); | ||
UsersManager.prototype.getByEmail = function(email, options, cb) { | ||
var { options, cb } = sanitizeArguments(options, cb); | ||
return this.usersByEmail.getAll({ email, ...options }, cb); | ||
}; | ||
@@ -250,0 +256,0 @@ |
Sorry, the diff of this file is too big to display
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
384995
11331