From 5138b01e5d3119c6db1938561783611565c8c318 Mon Sep 17 00:00:00 2001 From: Chenfeng Bao Date: Tue, 15 Oct 2024 16:20:01 -0700 Subject: [PATCH] reword user-facing messages to say "passwordless" --- src/D2L.Bmx/OktaAuthenticator.cs | 36 ++++++++++------------------ src/D2L.Bmx/ParameterDescriptions.cs | 2 +- src/D2L.Bmx/Program.cs | 2 +- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/src/D2L.Bmx/OktaAuthenticator.cs b/src/D2L.Bmx/OktaAuthenticator.cs index 68a3cb09..ee549a4a 100644 --- a/src/D2L.Bmx/OktaAuthenticator.cs +++ b/src/D2L.Bmx/OktaAuthenticator.cs @@ -150,14 +150,14 @@ bool bypassBrowserSecurity bool hasElevatedPermissions = UserPrivileges.HasElevatedPermissions(); if( hasElevatedPermissions && !bypassBrowserSecurity ) { consoleWriter.WriteWarning( $""" - BMX is being run with elevated privileges and is unable to automatically sign in to Okta. - If you want to automatically sign in, and aren't concerned with the security of {orgUrl.Host}, - consider using '--experimental-bypass-browser-security' flag. + BMX is being run with elevated privileges and is unable to use Okta passwordless authentication. + If you want passwordless authentication, and aren't concerned with the security of {orgUrl.Host}, + consider using the '--experimental-bypass-browser-security' flag. """ ); return null; } else if( !hasElevatedPermissions && bypassBrowserSecurity ) { - // We want to avoid providing '--no-sandbox' to chromium unless absolutely neccessary. + // We want to avoid providing '--no-sandbox' to chromium unless absolutely necessary. bypassBrowserSecurity = false; } @@ -167,7 +167,7 @@ BMX is being run with elevated privileges and is unable to automatically sign in } if( !nonInteractive ) { - Console.Error.WriteLine( "Attempting to automatically sign in to Okta." ); + Console.Error.WriteLine( "Attempting Okta passwordless authentication." ); } using var cancellationTokenSource = new CancellationTokenSource( TimeSpan.FromSeconds( 15 ) ); var sessionIdTcs = new TaskCompletionSource( TaskCreationOptions.RunContinuationsAsynchronously ); @@ -193,7 +193,7 @@ async Task GetSessionCookieAsync() { await page.GoToAsync( orgUrl.AbsoluteUri ).WaitAsync( cancellationTokenSource.Token ); } else { consoleWriter.WriteWarning( - "Failed to authenticate with Okta when trying to automatically sign in" ); + "Okta passwordless authentication failed" ); sessionIdTcs.SetResult( null ); } return; @@ -205,22 +205,9 @@ async Task GetSessionCookieAsync() { } } } catch( TaskCanceledException ) { - consoleWriter.WriteWarning( $""" - Timed out when trying to automatically sign in to Okta. Check if the org '{orgUrl}' is correct. - If you have to run BMX with elevated privileges, and aren't concerned with the security of {orgUrl.Host}, - consider running the command again with the '--experimental-bypass-browser-security' flag. - """ - ); - } catch( TargetClosedException ) { - consoleWriter.WriteWarning( """ - Failed to automatically sign in to Okta as BMX is likely being run with elevated privileges. - If you have to run BMX with elevated privileges, and aren't concerned with the security of {orgUrl.Host}, - consider running the command again with the '--experimental-bypass-browser-security' flag. - """ - ); + consoleWriter.WriteWarning( "Okta passwordless authentication timed out." ); } catch( Exception ) { - consoleWriter.WriteWarning( - "Unknown error occurred while trying to automatically sign in with Okta." ); + consoleWriter.WriteWarning( "Unknown error occurred while trying Okta passwordless authentication." ); } if( sessionId is null ) { @@ -232,9 +219,10 @@ consider running the command again with the '--experimental-bypass-browser-secur string sessionLogin = oktaSession.Login.Split( "@" )[0]; string providedLogin = user.Split( "@" )[0]; if( !sessionLogin.Equals( providedLogin, StringComparison.OrdinalIgnoreCase ) ) { - consoleWriter.WriteWarning( - "Could not automatically sign in to Okta as provided Okta user " - + $"'{sessionLogin}' does not match user '{providedLogin}'." ); + consoleWriter.WriteWarning( $""" + Okta passwordless authentication failed. + The provided Okta user '{providedLogin}' does not match the system configured passwordless user '{sessionLogin}'. + """ ); return null; } diff --git a/src/D2L.Bmx/ParameterDescriptions.cs b/src/D2L.Bmx/ParameterDescriptions.cs index 4891014b..8367e536 100644 --- a/src/D2L.Bmx/ParameterDescriptions.cs +++ b/src/D2L.Bmx/ParameterDescriptions.cs @@ -20,5 +20,5 @@ internal static class ParameterDescriptions { """; public const string ExperimentalBypassBrowserSecurity - = "Disable Chromium sandbox when automatically signing into Okta"; + = "Disable Chromium sandbox when using Okta passwordless auth"; } diff --git a/src/D2L.Bmx/Program.cs b/src/D2L.Bmx/Program.cs index f3d20ed7..1d68b8d1 100644 --- a/src/D2L.Bmx/Program.cs +++ b/src/D2L.Bmx/Program.cs @@ -18,7 +18,7 @@ name: "--user", description: ParameterDescriptions.User ); -// allow no-sandbox argument for chromium to for passwordless auth with elevated permissions +// allow no-sandbox argument for Chromium to for passwordless auth with elevated permissions var bypassBrowserSecurityOption = new Option( name: "--experimental-bypass-browser-security", description: ParameterDescriptions.ExperimentalBypassBrowserSecurity );