dms-middleware-auth 1.0.3 → 1.0.4

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.
@@ -87,7 +87,7 @@ let AuthMiddleware = class AuthMiddleware {
87
87
  }
88
88
  // Check route access
89
89
  clientAttributes = JSON.parse(clientAttributes);
90
- if (!clientAttributes[req.originalUrl]) {
90
+ if (clientAttributes[req.originalUrl][0] !== "true") {
91
91
  return res.status(403).json({ message: 'Access denied for this route' });
92
92
  }
93
93
  // Cache interface details
@@ -103,7 +103,7 @@ let AuthMiddleware = class AuthMiddleware {
103
103
  userAttributes = JSON.parse(userAttributes);*/
104
104
  req['user'] = {
105
105
  role: role,
106
- userName: decoded.email
106
+ userName: decoded.preferred_username
107
107
  };
108
108
  // req['attributes'] = {
109
109
  // client: clientAttributes[req.originalUrl],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dms-middleware-auth",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Reusable middleware for authentication and authorization in NestJS applications.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -57,7 +57,7 @@ export class AuthMiddleware implements NestMiddleware {
57
57
 
58
58
  // Check route access
59
59
  clientAttributes = JSON.parse(clientAttributes);
60
- if (!clientAttributes[req.originalUrl]) {
60
+ if (clientAttributes[req.originalUrl][0] !== "true") {
61
61
  return res.status(403).json({ message: 'Access denied for this route' });
62
62
  }
63
63
 
@@ -74,7 +74,7 @@ export class AuthMiddleware implements NestMiddleware {
74
74
  userAttributes = JSON.parse(userAttributes);*/
75
75
  req['user'] = {
76
76
  role: role,
77
- userName:decoded.email
77
+ userName:decoded.preferred_username
78
78
  };
79
79
 
80
80
  // req['attributes'] = {