Skip to content

Adding error tracking and response for logins over CLI - #96

Open
davidpcls wants to merge 1 commit into
bluesky:mainfrom
davidpcls:main
Open

Adding error tracking and response for logins over CLI#96
davidpcls wants to merge 1 commit into
bluesky:mainfrom
davidpcls:main

Conversation

@davidpcls

Copy link
Copy Markdown
Contributor

Now the queueserver-api client will actually report failures instead of just polling forever, as it can get the failed status from the bluesky-httpserver instance it is talking to.

Description

This adds a new key into the auth database called "error" that tracks the authentication status for a particular authentication flow. This key gets updated asynchronously when an update from the external authenticator is processed and stored. When the CLI requests an update regarding the status of the authentication, the application checks the database and reports back if there was an error, otherwise it assumes authentication is still pending.

Motivation and Context

This solves the edge case of logging in over http using the bluesky-queueserver-api client, where when logging in there is an error and the login fails (for any number of reasons). Without this, the client will poll until a timeout is reached. Now the error is reported quickly back to the CLI so the user doesn't have to ctrl-c out of the auth attempt.

Is this needed? Possibly not, since the user is the one doing the auth and if their auth fails they "should" know and would know to cancel the auth in the command line. However this seems like a nicer user experience when the tool actually knows something broke.

Summary of Changes for Release Notes

Fixed

Added

  • Added error tracking for external authentication
  • Added reporting of errors back to anyone polling for the authentication status

Changed

Removed

How Has This Been Tested?

Testing was done by starting up the httpserver locally with an entraauthenticator properly configured, but with the api resource policy set to fail. Then every login attempt does not function correctly. I used this specific commit of the bluesky-queueserver-api to test against: bluesky/bluesky-queueserver-api@c03b090

from bluesky_queueserver_api.http import REManagerAPI
RM = REManagerAPI(http_server_uri="http://localhost:60610", http_auth_provider="entra/authorize")
RM.login()

On an error, this then creates an exception like so:

HTTPClientError: 400: {'error': 'access_denied'} http://localhost:60610/api/auth/provider/entra/token

Which, while not a great user experience to have a python exception get raised, it does break out of the login attempt. Further cleanup could be done with bluesky-queueserver-api to make it just report "login failed" if desired. But that change does not affect bluesky-httpserver.

* Adds error response

Now the queueserver-api client will actually report failures instead of
just polling forever.

* This add login error reporting for CLI clients

This will report back to the CLI client that there was an error logging
in, so the user doesn't just wait forever.

* Fixing pre-commit
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.

1 participant