auth0 3.5.0 → 3.6.1

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,25 @@
1
1
  # Change Log
2
2
 
3
+ ## [v3.6.1](https://github.com/auth0/node-auth0/tree/v3.6.1) (2023-08-22)
4
+
5
+ [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.6.0...v3.6.1)
6
+
7
+ **Changed**
8
+
9
+ - Support providing Organization when resetting password [\#892](https://github.com/auth0/node-auth0/pull/892) ([frederikprijck](https://github.com/frederikprijck))
10
+
11
+ ## [v3.6.0](https://github.com/auth0/node-auth0/tree/v3.6.0) (2023-07-18)
12
+
13
+ [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.5.0...v3.6.0)
14
+
15
+ **Added**
16
+
17
+ - Support Organization Name [\#884](https://github.com/auth0/node-auth0/pull/884) ([frederikprijck](https://github.com/frederikprijck))
18
+
19
+ **Changed**
20
+
21
+ - Do not lowercase org_name claim [\#887](https://github.com/auth0/node-auth0/pull/887) ([frederikprijck](https://github.com/frederikprijck))
22
+
3
23
  ## [v3.5.0](https://github.com/auth0/node-auth0/tree/v3.5.0) (2023-06-26)
4
24
 
5
25
  [Full Changelog](https://github.com/auth0/node-auth0/compare/v3.4.0...v3.5.0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auth0",
3
- "version": "3.5.0",
3
+ "version": "3.6.1",
4
4
  "description": "SDK for Auth0 API v2",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.mjs",
@@ -182,6 +182,7 @@ class DatabaseAuthenticator {
182
182
  * @param {string} userData.email User email address.
183
183
  * @param {string} userData.password New password.
184
184
  * @param {string} userData.connection Identity provider in use.
185
+ * @param {string} userData.organization The organization_id of the Organization associated with the user.
185
186
  * @param {Function} [cb] Method callback.
186
187
  * @returns {Promise|undefined}
187
188
  */
@@ -84,14 +84,28 @@ const validate = function (token, options) {
84
84
 
85
85
  // Organization
86
86
  if (options.organization) {
87
- if (!payload.org_id || typeof payload.org_id !== 'string') {
88
- throw new Error('Organization Id (org_id) claim must be a string present in the ID token');
89
- }
90
-
91
- if (payload.org_id !== options.organization) {
92
- throw new Error(
93
- `Organization Id (org_id) claim value mismatch in the ID token; expected "${options.organization}", found "${payload.org_id}"'`
94
- );
87
+ if (options.organization.indexOf('org_') === 0) {
88
+ if (!payload.org_id || typeof payload.org_id !== 'string') {
89
+ throw new Error('Organization Id (org_id) claim must be a string present in the ID token');
90
+ }
91
+
92
+ if (payload.org_id !== options.organization) {
93
+ throw new Error(
94
+ `Organization Id (org_id) claim value mismatch in the ID token; expected "${options.organization}", found "${payload.org_id}"'`
95
+ );
96
+ }
97
+ } else {
98
+ if (!payload.org_name || typeof payload.org_name !== 'string') {
99
+ throw new Error(
100
+ 'Organization Name (org_name) claim must be a string present in the ID token'
101
+ );
102
+ }
103
+
104
+ if (payload.org_name !== options.organization.toLowerCase()) {
105
+ throw new Error(
106
+ `Organization Name (org_name) claim value mismatch in the ID token; expected "${options.organization}", found "${payload.org_name}"'`
107
+ );
108
+ }
95
109
  }
96
110
  }
97
111