Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearranging Middlewares to allow Authentication before setting WebSocket Conn #1530

Open
wants to merge 11 commits into
base: development
Choose a base branch
from

Conversation

coolwednesday
Copy link
Contributor

@coolwednesday coolwednesday commented Feb 26, 2025

  • Closes Cannot Close websocket conneciton in case of unauthorised request #1526
  • As websocket connection does not inherently provide authentication support. It is favourable to authenticate before starting a websocket connection. This can only be done, if user's added authentication or other middlewares are executed before, upgrading to a websocket connection. This PR addresses the same.

@coolwednesday coolwednesday changed the title Rearranging Rearranging Middlewares to allow Authentication before setting WebSocket Conn Feb 26, 2025
Comment on lines +31 to +34
a.httpServer.router.Use(middleware.WSHandlerUpgrade(a.container, a.httpServer.ws))
a.httpServer.router.Use(middleware.Logging(a.Logger()))
a.httpServer.router.Use(middleware.Metrics(a.Metrics()))
}
Copy link
Member

Choose a reason for hiding this comment

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

When other default middleware's are being registered in httpServer, we should not be registering any default middleware here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added a developer note ... explaining the necessity to register it here ....

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.

Cannot Close websocket conneciton in case of unauthorised request
3 participants