bluesky / bluesky-widgets

Components for graphical applications that interact with bluesky libraries
http://blueskyproject.io/bluesky-widgets
BSD 3-Clause "New" or "Revised" License
7 stars 23 forks source link

ENH: tiled auth widget #199

Closed maffettone closed 1 week ago

maffettone commented 1 week ago

A widget that uses tiled's auth mechanism to pass a user and password for read only permissions.

Description

The widget does a couple of things: 1 . Creates a tiled Context and uses Context.authenticate to get off the ground.

  1. Generates a temporary API key (default of 12 hours) that has read only scopes. @jmaruland: is there a risk of api key bloat, or does the server know to remove invalid API keys after a period of time?
  2. Spawns a tiled client with that API key. This client will loose access after the timeout and a new login with be required.
  3. A singleton state manager is holds onto the context, partial api_key, and tiled client object.
  4. Enables logging out, so that the api key is removed, the client object deleted, and the context logout.
  5. A big fat warning up top.

This should provide 2 forms of security: the ability to logout when finished, and the ability to set a timeout for the duration of your work should you forget to logout.

Motivation and Context

Data security. Folks want the operator accounts to be able to persistently run a QT GUI that can read back data from rest. This allows for one user to login for their beam time, and not have their data accessible outside of their experiment.

How Has This Been Tested?

Local env on a Mac, using the example in the PR. Screenshots provided.

Screenshot 2024-11-19 at 9 25 34 AM Screenshot 2024-11-19 at 9 52 43 AM Screenshot 2024-11-19 at 9 54 21 AM

whs92 commented 1 week ago

@padraic-shafer are we using this with the pymca tiled integration?

maffettone commented 1 week ago

@whs92 no, this was just something I hacked together and wanted feedback on. We'll align more strategically before pushing something that is managing Auth flow.