@punks/backend-entity-manager 0.0.194 → 0.0.195

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/dist/cjs/index.js CHANGED
@@ -22749,26 +22749,28 @@ let AuthenticationMiddleware = class AuthenticationMiddleware {
22749
22749
  const organizationalUnits = user
22750
22750
  ? await this.getUserOrganizationalUnits(user)
22751
22751
  : [];
22752
- req.auth = {
22752
+ const authData = {
22753
22753
  user,
22754
22754
  roles,
22755
22755
  permissions,
22756
22756
  organizationalUnits,
22757
22757
  };
22758
- await this.postProcessContext(req.auth);
22758
+ req.auth = await this.postProcessContext(authData);
22759
22759
  }
22760
22760
  }
22761
22761
  next();
22762
22762
  }
22763
- async postProcessContext(auth) {
22763
+ async postProcessContext(authData) {
22764
+ let processedAuth = authData;
22764
22765
  const authenticationMiddlewares = this.getAuthenticationMiddlewares();
22765
22766
  for (const middleware of authenticationMiddlewares) {
22766
- const additionalProps = await middleware.processContext(auth);
22767
- auth = {
22768
- ...auth,
22767
+ const additionalProps = await middleware.processContext(authData);
22768
+ processedAuth = {
22769
+ ...authData,
22769
22770
  ...additionalProps,
22770
22771
  };
22771
22772
  }
22773
+ return processedAuth;
22772
22774
  }
22773
22775
  getAuthenticationMiddlewares() {
22774
22776
  return this.registry