exodus-framework 2.0.802 → 2.0.803
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.
| @@ -36,14 +36,15 @@ class SocketAuthenticationMiddleware extends _controller.SocketController { | |
| 36 36 | 
             
                try {
         | 
| 37 37 | 
             
                  if (!token) {
         | 
| 38 38 | 
             
                    const error = new Error('Token ausente');
         | 
| 39 | 
            -
                     | 
| 40 | 
            -
                    return  | 
| 39 | 
            +
                    res.statusCode = 401;
         | 
| 40 | 
            +
                    return res.writeContinue();
         | 
| 41 | 
            +
                    // return next(error);
         | 
| 41 42 | 
             
                  }
         | 
| 42 43 | 
             
                  const data = await _security.default.getService().verifySignature(token, _security.default.singleton().getServicePublicKey());
         | 
| 43 44 | 
             
                  if (!data) {
         | 
| 44 45 | 
             
                    const error = new Error('Token inválido');
         | 
| 45 | 
            -
                     | 
| 46 | 
            -
                    return  | 
| 46 | 
            +
                    res.statusCode = 401;
         | 
| 47 | 
            +
                    return res.writeContinue();
         | 
| 47 48 | 
             
                  }
         | 
| 48 49 | 
             
                  req.auth = {
         | 
| 49 50 | 
             
                    account: data.payload,
         | 
| @@ -70,23 +71,23 @@ class SocketAuthenticationMiddleware extends _controller.SocketController { | |
| 70 71 | 
             
                    });
         | 
| 71 72 | 
             
                    if (!application) {
         | 
| 72 73 | 
             
                      const error = new Error('Token de aplicação inválido');
         | 
| 73 | 
            -
                       | 
| 74 | 
            -
                      return  | 
| 74 | 
            +
                      res.statusCode = 401;
         | 
| 75 | 
            +
                      return res.writeContinue();
         | 
| 75 76 | 
             
                    } else if (!application.active) {
         | 
| 76 77 | 
             
                      const error = new Error('Token de aplicação desativado');
         | 
| 77 | 
            -
                       | 
| 78 | 
            -
                      return  | 
| 78 | 
            +
                      res.statusCode = 403;
         | 
| 79 | 
            +
                      return res.writeContinue();
         | 
| 79 80 | 
             
                    } else if ((0, _dateFns.isBefore)(application.expiresAt, new Date())) {
         | 
| 80 81 | 
             
                      const error = new Error('Token de aplicação expirado');
         | 
| 81 | 
            -
                       | 
| 82 | 
            -
                      return  | 
| 82 | 
            +
                      res.statusCode = 403;
         | 
| 83 | 
            +
                      return res.writeContinue();
         | 
| 83 84 | 
             
                    } else {
         | 
| 84 85 | 
             
                      //valido
         | 
| 85 86 | 
             
                      const data = await _security.default.singleton().verifySignature(applicationId, _security.default.singleton().getServicePublicKey());
         | 
| 86 87 | 
             
                      if (!data) {
         | 
| 87 88 | 
             
                        const error = new Error('Token de aplicação sem autênticidade');
         | 
| 88 | 
            -
                         | 
| 89 | 
            -
                        return  | 
| 89 | 
            +
                        res.statusCode = 401;
         | 
| 90 | 
            +
                        return res.writeContinue();
         | 
| 90 91 | 
             
                      }
         | 
| 91 92 | 
             
                      requestor.database = data.payload.database;
         | 
| 92 93 | 
             
                      requestor.environmentId = data.payload.envUuid;
         | 
| @@ -109,8 +110,8 @@ class SocketAuthenticationMiddleware extends _controller.SocketController { | |
| 109 110 | 
             
                  req.isApplication = isApplication;
         | 
| 110 111 | 
             
                  next();
         | 
| 111 112 | 
             
                } catch (error) {
         | 
| 112 | 
            -
                   | 
| 113 | 
            -
                   | 
| 113 | 
            +
                  res.statusCode = 500;
         | 
| 114 | 
            +
                  return res.writeContinue();
         | 
| 114 115 | 
             
                }
         | 
| 115 116 | 
             
              };
         | 
| 116 117 | 
             
            }
         |