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

[BUG] Websocket Decorator Permissions #1009

Closed
ckrew opened this issue Feb 12, 2024 · 2 comments
Closed

[BUG] Websocket Decorator Permissions #1009

ckrew opened this issue Feb 12, 2024 · 2 comments
Labels

Comments

@ckrew
Copy link
Contributor

ckrew commented Feb 12, 2024

Describe the bug
Currently the websocket decorator has an authenticator but no way to check permissions to make sure the user (or anonymous user) should be able to access the endpoint.

Expected behavior
The websocket decorator should have an option to specify permissions to access the endpoint, just like the controller decorator. That way a user can be checked for authentication and authorization.

Tethys Environment Information

  • Tethys version 4.2.0
@ckrew ckrew added the bug label Feb 12, 2024
@swainn
Copy link
Member

swainn commented Feb 16, 2024

@ckrew is the authentication enforced currently? Can a anonymous in user access a web socket?

@ckrew
Copy link
Contributor Author

ckrew commented Feb 16, 2024

So if I use an incognito window and open up the dev tools, I can connect to the websocket using the lines below.
image

If I add a breakpoint in the python code, the code above connects to the websocket and I get the scoped user below
image

You can see that it is anonymous and not authenticated (which I was wrong about in the description) but it can still connect to the websocket unless I put some custom user handling like the code below.
image

If I connect to the websocket from tethys using an actual user, I can get the id of the scoped user and get the actual user from django users. I get the results below which shows the actual user is not anonymous and it is active.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants