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

display okta user and org in password prompt / failed auth error message #451

Merged
merged 8 commits into from
Jun 14, 2024

Conversation

gord5500
Copy link
Contributor

@gord5500 gord5500 commented Jun 12, 2024

Why

Potential for the config file to have bad user / org values and it's not immediately obvious to the user that those could be the reason for their okta auth failing. This can happen with our internal install script when running wsl and the user gets set to 'root' in the config file.

image

Ticket

VUL-330

@gord5500 gord5500 marked this pull request as ready for review June 12, 2024 18:37
@gord5500 gord5500 requested a review from a team as a code owner June 12, 2024 18:37
src/D2L.Bmx/ParameterDescriptions.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/ConsolePrompter.cs Outdated Show resolved Hide resolved
@@ -23,15 +23,18 @@ internal interface IOktaApi {
internal class OktaApi : IOktaApi {
private readonly CookieContainer _cookieContainer;
private readonly HttpClient _httpClient;
private string organization = string.Empty;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't initialize things to invalid non-null values just so we can mark things as non-nullable and skip null checks.
Nullables are good. Forced null checks are good. That's the compiler helping us avoid null errors.
False non-null values are much worse.

also - we name private fields with an underscore

Suggested change
private string organization = string.Empty;
private string? _organization;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that's fair. I saw we couldn't reach the exception without having that value set already but I can see the reasoning

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cfbao
cfbao previously approved these changes Jun 12, 2024
src/D2L.Bmx/Okta/OktaApi.cs Outdated Show resolved Hide resolved
@gord5500 gord5500 merged commit c882915 into main Jun 14, 2024
9 checks passed
@gord5500 gord5500 deleted the display_okta_user_and_org_in_prompt branch June 14, 2024 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants