Conversation
bluesky_httpserver/authentication.py
Outdated
| auth_header = websocket.headers.get("Authorization", "") | ||
| access_token, api_key = None, None | ||
| if auth_header.startswith("Bearer "): | ||
| access_token = auth_header[len("Bearer") :].strip() |
Member
There was a problem hiding this comment.
For what it's worth, we chose not to support these in Tiled because there is no mechanism for the server to request that they be refreshed, since it cannot send HTTP response codes.
Instead, the client mints a short-lived API key and revokes it after the connection is formed.
Contributor
Author
There was a problem hiding this comment.
This makes sense. It should be possible to implement a refresh scheme when a token is validated by sending a plain HTTP request in case connection to a websocket fails and then refreshed if requested by the server, but it does not look like a standard approach.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implementation of websocket security. The clients must authenticate with the server when connecting to the websocket. If authentication fails, then the connection is immediately closed. Clients can authenticate with the server using API keys. The authentication scheme is identical to the scheme used for other API endpoints. If the client is using tokens, it must request a short-lived API key from the server and use it to establish the connection. Once connection is established, the key should be revoked.
The websockets implemented in #74 are not secured. The security is added in this PR.
Summary of Changes for Release Notes
Added
How Has This Been Tested?
Unit tests were added.