Skip to content

Conversation

@SammyOina
Copy link
Contributor

Pull request title should be MF-XXX - description or NOISSUE - description where XXX is ID of issue that this PR relate to.
Please review the CONTRIBUTING.md file for detailed contributing guidelines.

What does this do?

Which issue(s) does this PR fix/relate to?

Put here Resolves #XXX to auto-close the issue that your PR fixes (if such)

List any changes that modify/break current functionality

Have you included tests for your changes?

Did you document any new/modified functionality?

Notes

Signed-off-by: SammyOina <sammyoina@gmail.com>
The websocket package has been refactored to improve code organization and maintainability. The following changes have been made:

- The package import path has been updated to "github.com/mainflux/mproxy/pkg/websockets".
- Unused constants and variables related to the websocket configuration have been removed.

These changes improve the clarity and readability of the codebase.

Signed-off-by: SammyOina <sammyoina@gmail.com>
This commit fixes the authorization handling in the websockets handler.
Previously, the code was assuming that the authorization token would always be provided as a query parameter. However, this is not always the case, as the token can also be provided in the `Authorization` header.

To fix this issue, the code now checks both the query parameter and the header for the authorization token. If the token is not found in either of these locations, an `ErrAuthorizationNotSet` error is returned.

This change ensures that the websockets handler correctly handles authorization and provides a more robust and secure implementation.

Signed-off-by: SammyOina <sammyoina@gmail.com>
Import the missing package "golang.org/x/sync/errgroup" to fix the import error in websockets.go file.

Signed-off-by: SammyOina <sammyoina@gmail.com>
Signed-off-by: SammyOina <sammyoina@gmail.com>
The commit refactors the configuration struct in the main.go file
to improve readability and maintainability. The struct fields
(httpConfig, mqttConfig, wsMQTTConfig, wsConfig, and logLevel)
are now properly aligned and indented.

Additionally, the commit updates the logging message for starting
the encrypted WebSocket proxy on port cfg.wsMQTTConfig.wssPort.
The previous message incorrectly referenced cfg.mqttWssPort.

This commit follows the best practices for writing commit messages
and provides a clear and concise summary of the changes made in
the commit.

Signed-off-by: SammyOina <sammyoina@gmail.com>
The variable "target" in the Proxy.Handler() function was assigned
using an incorrect format string. This commit fixes the issue by
updating the format string to the correct value.

Summary:
- Fix incorrect variable assignment in Proxy.Handler()

Body:
- The variable "target" in the Proxy.Handler() function was assigned
  using an incorrect format string. This commit fixes the issue by
  updating the format string to the correct value.

Signed-off-by: SammyOina <sammyoina@gmail.com>
Copy link
Contributor

@drasko drasko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@drasko drasko merged commit 0e0db9e into absmach:master Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants