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

Cleaner exit when user credentials are incorrect #2296

Open
wants to merge 10 commits into
base: release-v5.1.0
Choose a base branch
from

Conversation

craddm
Copy link
Contributor

@craddm craddm commented Nov 15, 2024

✅ Checklist

  • You have given your pull request a meaningful title (e.g. Enable foobar integration rather than 515 foobar).
  • You are targeting the appropriate branch. If you're not certain which one this is, it should be develop.
  • Your branch is up-to-date with the target branch (it probably was when you started, but it may have changed since then).

🚦 Depends on

⤴️ Summary

When the user rejects the current credentials when asked to confirm they are correct, code would still continue to run, resulting in numerous additional, unnecessary and misleading error messages.

In addition, when the user rejects the Graph API credentials as incorrect, there is currently no clear way to change those credentials.
Graph API log-in is, unlike Az CLI log-in, not done by the user at the command line.

This PR simply exits when the user confirms that the credentials are incorrect, and prints only informative error messages.
In addition, it advises the user how to remove the cached Graph API credentials so as to be able to login with other credentials.

🌂 Related issues

Closes #2280
Closes #2153

🔬 Tests

Tested locally

@craddm craddm changed the base branch from develop to release-v5.1.0 November 15, 2024 16:09
Copy link

github-actions bot commented Nov 15, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  data_safe_haven/commands
  sre.py
  data_safe_haven/external/api
  credentials.py 225-230
  graph_api.py
Project Total  

This report was generated by python-coverage-comment-action

@craddm craddm marked this pull request as ready for review November 15, 2024 16:19
@craddm craddm requested a review from a team as a code owner November 15, 2024 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant