auth0 3.1.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Change Log
2
2
 
3
+ ## [v3.2.0](https://github.com/auth0/node-auth0/tree/v3.2.0) (2023-02-09)
4
+
5
+ [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.1.2...v3.2.0)
6
+
7
+ **Added**
8
+
9
+ - Add DELETE /api/v2/users/{id}/authenticators [\#785](https://github.com/auth0/node-auth0/pull/785) ([adamjmcgrath](https://github.com/adamjmcgrath))
10
+
11
+ ## [v3.1.2](https://github.com/auth0/node-auth0/tree/v3.1.2) (2023-01-25)
12
+
13
+ [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.1.1...v3.1.2)
14
+
15
+ **Fixed**
16
+
17
+ - Add support for proxy in AuthenticationClient [\#779](https://github.com/auth0/node-auth0/pull/779) ([frederikprijck](https://github.com/frederikprijck))
18
+
3
19
  ## [v3.1.1](https://github.com/auth0/node-auth0/tree/v3.1.1) (2023-01-12)
4
20
 
5
21
  [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.1.0...v3.1.1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "SDK for Auth0 API v2",
5
5
  "main": "src/index.js",
6
6
  "sideEffects": false,
@@ -10,6 +10,7 @@ class DatabaseAuthenticator {
10
10
  * @param {object} options Authenticator options.
11
11
  * @param {string} options.baseUrl The auth0 account URL.
12
12
  * @param {string} [options.clientId] Default client ID.
13
+ * @param {string} [options.proxy] Add the `superagent-proxy` dependency and specify a proxy url eg 'https://myproxy.com:1234'
13
14
  * @param {OAuthAuthenticator} oauth OAuthAuthenticator instance.
14
15
  */
15
16
  constructor(options, oauth) {
@@ -29,6 +30,7 @@ class DatabaseAuthenticator {
29
30
  const clientOptions = {
30
31
  errorFormatter: { message: 'message', name: 'error' },
31
32
  headers: options.headers,
33
+ proxy: options.proxy,
32
34
  };
33
35
 
34
36
  this.oauth = oauth;
@@ -35,6 +35,7 @@ class OAuthAuthenticator {
35
35
  * @param {string} [options.clientAssertionSigningKey] Private key used to sign the client assertion JWT.
36
36
  * @param {string} [options.clientAssertionSigningAlg] Default 'RS256'.
37
37
  * @param {boolean} [options.__bypassIdTokenValidation] Whether the id_token should be validated or not
38
+ * @param {string} [options.proxy] Add the `superagent-proxy` dependency and specify a proxy url eg 'https://myproxy.com:1234'
38
39
  */
39
40
  constructor(options) {
40
41
  if (!options) {
@@ -54,6 +55,7 @@ class OAuthAuthenticator {
54
55
  errorCustomizer: SanitizedError,
55
56
  errorFormatter: { message: 'message', name: 'error' },
56
57
  headers: options.headers,
58
+ proxy: options.proxy,
57
59
  };
58
60
 
59
61
  this.oauth = new RestClient(`${options.baseUrl}/oauth/:type`, clientOptions);
@@ -29,6 +29,7 @@ class PasswordlessAuthenticator {
29
29
  * @param {string} [options.clientSecret] Default client secret.
30
30
  * @param {string} [options.clientAssertionSigningKey] Private key used to sign the client assertion JWT.
31
31
  * @param {string} [options.clientAssertionSigningAlg] Default 'RS256'.
32
+ * @param {string} [options.proxy] Add the `superagent-proxy` dependency and specify a proxy url eg 'https://myproxy.com:1234'
32
33
  * @param {OAuthAuthenticator} oauth OAuthAuthenticator instance.
33
34
  */
34
35
  constructor(options, oauth) {
@@ -48,6 +49,7 @@ class PasswordlessAuthenticator {
48
49
  const clientOptions = {
49
50
  errorFormatter: { message: 'message', name: 'error' },
50
51
  headers: options.headers,
52
+ proxy: options.proxy,
51
53
  };
52
54
 
53
55
  this.oauth = oauth;
package/src/auth/index.js CHANGED
@@ -42,6 +42,7 @@ class AuthenticationClient {
42
42
  * @param {string} [options.supportedAlgorithms] Algorithms that your application expects to receive
43
43
  * @param {boolean} [options.__bypassIdTokenValidation] Whether the id_token should be validated or not
44
44
  * @param {object} [options.headers] Additional headers that will be added to the outgoing requests.
45
+ * @param {string} [options.proxy] Add the `superagent-proxy` dependency and specify a proxy url eg 'https://myproxy.com:1234'
45
46
  */
46
47
  constructor(options) {
47
48
  if (!options || typeof options !== 'object') {
@@ -67,6 +68,7 @@ class AuthenticationClient {
67
68
  baseUrl: util.format(BASE_URL_FORMAT, options.domain),
68
69
  supportedAlgorithms: options.supportedAlgorithms,
69
70
  __bypassIdTokenValidation: options.__bypassIdTokenValidation,
71
+ proxy: options.proxy,
70
72
  };
71
73
 
72
74
  if (options.telemetry !== false) {
@@ -19,6 +19,7 @@ class ManagementTokenProvider {
19
19
  * @param {boolean} [options.enableCache=true] Enabled or Disable Cache
20
20
  * @param {number} [options.cacheTTLInSeconds] By default the `expires_in` value will be used to determine the cached time of the token, this can be overridden.
21
21
  * @param {object} [options.headers] Additional headers that will be added to the outgoing requests.
22
+ * @param {string} [options.proxy] Add the `superagent-proxy` dependency and specify a proxy url eg 'https://myproxy.com:1234'
22
23
  */
23
24
  constructor(options) {
24
25
  if (!options || typeof options !== 'object') {
@@ -74,6 +75,7 @@ class ManagementTokenProvider {
74
75
  telemetry: this.options.telemetry,
75
76
  clientInfo: this.options.clientInfo,
76
77
  headers: this.options.headers,
78
+ proxy: this.options.proxy,
77
79
  };
78
80
  this.authenticationClient = new AuthenticationClient(authenticationClientOptions);
79
81
 
@@ -85,6 +85,13 @@ class UsersManager extends BaseManager {
85
85
  */
86
86
  this.permissions = this._getRestClient('/users/:id/permissions');
87
87
 
88
+ /**
89
+ * For CRUD on user's authenticators
90
+ *
91
+ * @type {external:RestClient}
92
+ */
93
+ this.authenticators = this._getRestClient('/users/:id/authenticators');
94
+
88
95
  this.organizations = this._getRestClient('/users/:id/organizations');
89
96
  }
90
97
 
@@ -742,6 +749,24 @@ class UsersManager extends BaseManager {
742
749
  return this.permissions.delete(query, data);
743
750
  }
744
751
 
752
+ deleteAllAuthenticators(params, cb) {
753
+ const query = params || {};
754
+
755
+ // Require a user ID.
756
+ if (!query.id) {
757
+ throw new ArgumentError('The user_id cannot be null or undefined');
758
+ }
759
+ if (typeof query.id !== 'string') {
760
+ throw new ArgumentError('The user_id has to be a string');
761
+ }
762
+
763
+ if (cb && cb instanceof Function) {
764
+ return this.authenticators.delete(query, cb);
765
+ }
766
+
767
+ return this.authenticators.delete(query);
768
+ }
769
+
745
770
  /**
746
771
  * Get a list of organizations for a user.
747
772
  *