From 1d9d72a634decff19f6eb92df67829a3553e8698 Mon Sep 17 00:00:00 2001 From: Liam Gordon Date: Tue, 12 May 2026 08:51:50 -0400 Subject: [PATCH 1/4] check for ACTIVE session id when doing passwordless authentication --- src/D2L.Bmx/Okta/Models/OktaSession.cs | 1 + src/D2L.Bmx/OktaAuthenticator.cs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/D2L.Bmx/Okta/Models/OktaSession.cs b/src/D2L.Bmx/Okta/Models/OktaSession.cs index 876a7cc8..4f8c90d7 100644 --- a/src/D2L.Bmx/Okta/Models/OktaSession.cs +++ b/src/D2L.Bmx/Okta/Models/OktaSession.cs @@ -4,6 +4,7 @@ internal record OktaSession( string Id, string Login, string UserId, + string Status, DateTimeOffset CreatedAt, DateTimeOffset ExpiresAt ); diff --git a/src/D2L.Bmx/OktaAuthenticator.cs b/src/D2L.Bmx/OktaAuthenticator.cs index 9e096f52..6c02d126 100644 --- a/src/D2L.Bmx/OktaAuthenticator.cs +++ b/src/D2L.Bmx/OktaAuthenticator.cs @@ -137,6 +137,14 @@ string browserPath var oktaAuthenticatedClient = oktaClientFactory.CreateAuthenticatedClient( orgUrl, sessionId ); var oktaSession = await oktaAuthenticatedClient.GetCurrentOktaSessionAsync(); + if( oktaSession.Status != "ACTIVE" ) { + messageWriter.WriteWarning( """ + Okta passwordless authentication failed. + An active session ID was not returned from Okta. + """ ); + return null; + } + string sessionLogin = oktaSession.Login.Split( "@" )[0]; string providedLogin = user.Split( "@" )[0]; if( !sessionLogin.Equals( providedLogin, StringComparison.OrdinalIgnoreCase ) ) { From 40b0c793d1f727437fbefe24272c0e8a5cdada2f Mon Sep 17 00:00:00 2001 From: Liam Gordon Date: Tue, 12 May 2026 09:19:05 -0400 Subject: [PATCH 2/4] reword --- src/D2L.Bmx/OktaAuthenticator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/D2L.Bmx/OktaAuthenticator.cs b/src/D2L.Bmx/OktaAuthenticator.cs index 6c02d126..38f77e5f 100644 --- a/src/D2L.Bmx/OktaAuthenticator.cs +++ b/src/D2L.Bmx/OktaAuthenticator.cs @@ -140,7 +140,7 @@ string browserPath if( oktaSession.Status != "ACTIVE" ) { messageWriter.WriteWarning( """ Okta passwordless authentication failed. - An active session ID was not returned from Okta. + Okta did not provide an expected response. """ ); return null; } From 4bab9b427fa4e2d302fc4230608c8d12d817a3ff Mon Sep 17 00:00:00 2001 From: Liam Gordon Date: Tue, 12 May 2026 09:26:48 -0400 Subject: [PATCH 3/4] generic fail message --- src/D2L.Bmx/OktaAuthenticator.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/D2L.Bmx/OktaAuthenticator.cs b/src/D2L.Bmx/OktaAuthenticator.cs index 38f77e5f..92242a8f 100644 --- a/src/D2L.Bmx/OktaAuthenticator.cs +++ b/src/D2L.Bmx/OktaAuthenticator.cs @@ -138,10 +138,9 @@ string browserPath var oktaAuthenticatedClient = oktaClientFactory.CreateAuthenticatedClient( orgUrl, sessionId ); var oktaSession = await oktaAuthenticatedClient.GetCurrentOktaSessionAsync(); if( oktaSession.Status != "ACTIVE" ) { - messageWriter.WriteWarning( """ - Okta passwordless authentication failed. - Okta did not provide an expected response. - """ ); + if( BmxEnvironment.IsDebug ) { + messageWriter.WriteWarning( "Okta passwordless authentication failed" ); + } return null; } From ffe67b81a8a2c4cd1f2279a4cb352ee2cf8d38ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 10:00:20 -0400 Subject: [PATCH 4/4] Auto format check_for_active_session_id_when_passwordless (#528) Auto format check_for_active_session_id_when_passwordless Co-authored-by: DotNet Format Bot --- src/D2L.Bmx/ConsolePrompter.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/D2L.Bmx/ConsolePrompter.cs b/src/D2L.Bmx/ConsolePrompter.cs index 070301a4..5bd82dee 100644 --- a/src/D2L.Bmx/ConsolePrompter.cs +++ b/src/D2L.Bmx/ConsolePrompter.cs @@ -185,14 +185,14 @@ Secret input won't be masked on screen! Console.Error.Write( moveLeftString + emptyString + moveLeftString ); passwordBuilder.Clear(); } else - // The backspace key is received as the DEL character in raw mode - if( ( key == '\b' || key == DEL ) && passwordBuilder.Length > 0 ) { - Console.Error.Write( "\b \b" ); - passwordBuilder.Length--; - } else if( !char.IsControl( key ) ) { - Console.Error.Write( '*' ); - passwordBuilder.Append( key ); - } + // The backspace key is received as the DEL character in raw mode + if( ( key == '\b' || key == DEL ) && passwordBuilder.Length > 0 ) { + Console.Error.Write( "\b \b" ); + passwordBuilder.Length--; + } else if( !char.IsControl( key ) ) { + Console.Error.Write( '*' ); + passwordBuilder.Append( key ); + } } } }