propro-utils 1.4.83 → 1.4.84
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/package.json +1 -1
- package/src/server/index.js +12 -3
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -307,10 +307,19 @@ class AuthMiddleware {
|
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
309
|
|
|
310
|
+
pathRequiresAccessToken = path => {
|
|
311
|
+
return (
|
|
312
|
+
!path.includes('/api/v1/auth/login') &&
|
|
313
|
+
!path.includes('/api/v1/auth/register')
|
|
314
|
+
);
|
|
315
|
+
};
|
|
316
|
+
|
|
310
317
|
proxyToAuthServer = async (req, path) => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
318
|
+
if (this.pathRequiresAccessToken(path)) {
|
|
319
|
+
const accessToken = req.cookies['x-access-token'];
|
|
320
|
+
if (!accessToken) {
|
|
321
|
+
throw new Error('No access token provided');
|
|
322
|
+
}
|
|
314
323
|
}
|
|
315
324
|
|
|
316
325
|
const formattedAuthUrl = formatRedirectUrl(this.options.authUrl);
|