-
Notifications
You must be signed in to change notification settings - Fork 308
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
base: development
Are you sure you want to change the base?
Conversation
coolwednesday
commented
Feb 26, 2025
•
edited
Loading
edited
- 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.
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())) | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ....