Skip to content

Commit

Permalink
dont mention sso
Browse files Browse the repository at this point in the history
  • Loading branch information
gord5500 committed Sep 20, 2024
1 parent 6dba5c1 commit f46d800
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/D2L.Bmx/OktaAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ bool experimentalBypassBrowserSecurity
}

if( !nonInteractive ) {
Console.Error.WriteLine( "Attempting to automatically login using Okta Desktop Single Sign-On." );
Console.Error.WriteLine( "Attempting to automatically sign in to Okta." );
}
using var cancellationTokenSource = new CancellationTokenSource( TimeSpan.FromSeconds( 15 ) );
var sessionIdTcs = new TaskCompletionSource<string?>( TaskCreationOptions.RunContinuationsAsynchronously );
string? sessionId;
string? sessionId = null;

try {
using var page = await browser.NewPageAsync().WaitAsync( cancellationTokenSource.Token );
Expand All @@ -180,7 +180,7 @@ async Task GetSessionCookieAsync() {
await page.GoToAsync( orgUrl.AbsoluteUri ).WaitAsync( cancellationTokenSource.Token );
} else {
consoleWriter.WriteWarning(
"WARNING: Could not authenticate with Okta using Desktop Single Sign-On." );
"WARNING: Failed to authenticate with Okta when trying to automatically sign in" );
sessionIdTcs.SetResult( null );
}
return;
Expand All @@ -193,23 +193,22 @@ async Task GetSessionCookieAsync() {
}
} catch( TaskCanceledException ) {
consoleWriter.WriteWarning( $"""
WARNING: Timed out when trying to create Okta session through Desktop Single Sign-On.
Check if the org '{orgUrl}' is correct. If running BMX with elevated privileges,
rerun the command with the '--experimental-bypass-browser-security' flag
WARNING: 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.
"""
);
return null;
} catch( TargetClosedException ) {
consoleWriter.WriteWarning( """
WARNING: Failed to create Okta session through Desktop Single Sign-On as BMX is likely being run
with elevated privileges. Rerun the command with the '--experimental-bypass-browser-security' flag.
WARNING: 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.
"""
);
return null;
} catch( Exception ) {
consoleWriter.WriteWarning(
"WARNING: Unknown error while trying to authenticate with Okta using Desktop Single Sign-On." );
return null;
"WARNING: Unknown error occurred while trying to automatically sign in with Okta." );
}

if( sessionId is null ) {
Expand All @@ -220,7 +219,7 @@ with elevated privileges. Rerun the command with the '--experimental-bypass-brow
var oktaSession = await oktaAuthenticatedClient.GetCurrentOktaSessionAsync();
if( !OktaUserMatchesProvided( oktaSession.Login, user ) ) {
consoleWriter.WriteWarning(
"WARNING: Could not create Okta session using Desktop Single Sign-On as provided Okta user "
"WARNING: Could not automatically sign in to Okta as provided Okta user "
+ $"'{StripLoginDomain( user )}' does not match user '{StripLoginDomain( oktaSession.Login )}'." );
return null;
}
Expand Down

0 comments on commit f46d800

Please sign in to comment.