Skip to content

add passwordless timeout config value - #529

Merged
gord5500 merged 7 commits into
mainfrom
add_passwordless_timeout_config
Jun 5, 2026
Merged

add passwordless timeout config value#529
gord5500 merged 7 commits into
mainfrom
add_passwordless_timeout_config

Conversation

@gord5500

@gord5500 gord5500 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Why

Zscaler can be slow for some people. Bump the default timeout from 15 to 30 seconds and add an optional config value to lower timeout or just disable passwordless entirely. Updating the tests in vulcan-scratch repo too to cover a few scenarios

Ticket

HOD-4334 - BMX: support longer timeouts

@gord5500
gord5500 marked this pull request as ready for review June 3, 2026 15:27
@gord5500
gord5500 requested a review from a team as a code owner June 3, 2026 15:27
@gord5500
gord5500 requested review from boarnoah, cfbao and scowing June 3, 2026 15:27
Comment thread src/D2L.Bmx/OktaAuthenticator.cs Outdated
Comment on lines +186 to +188
// cancel if we can't load the first page within a derived timeout
using var pageTimer = new System.Timers.Timer(
TimeSpan.FromSeconds( Math.Min( 6, timeoutSeconds / 2 ) ) ) { AutoReset = false };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

6 is the min we should wait. Here should be Math.Max

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there's also a 3 sec wait somewhere below that need to be bumped up

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't believe the timeout that people actually hit is the 15 total timeout, but rather the 6 and 3 page load timeout.

Comment thread src/D2L.Bmx/BmxConfig.cs Outdated

internal static class PasswordlessTimeoutDefaults {
public const int Min = 5;
public const int Max = 30;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wouldn't necessarily cap max at 30. If people want to wait a minute I wouldn't stop them

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeaaa I was wondering what to do for this. I'll bump it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you updated the default not the max?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also, nit, and I'm not too sure either, but this seems more like "constants" rather than "config"?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we already have a constants class

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

was just looking at the config parsing logic - I'm not sure there's much value in setting a non-zero min either?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess what I'm leaning towards is no min or max.
We can keep the "0 = disable" behaviour (which is a logical conclusion from the config) and check timeout >=0 as a sanity check.
But I'm not seeing value in a non-zero min or any max.
Keep things simpler.

@gord5500 gord5500 Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure I can remove the limits. For me I just never saw it succeed below 5 seconds

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay I removed the limits and tried rewording the prompt for setting the value to 0 means disabling passwordless auth. Also the timing changes to always be timeout / 2.0

scowing
scowing previously approved these changes Jun 3, 2026
Comment thread src/D2L.Bmx/ParameterDescriptions.cs Outdated
public const string CacheAwsCredentials =
"Enables Cache for AWS tokens. Implied if '--use-credential-process' is supplied";
public static readonly string PasswordlessTimeout =
"Timeout for Okta passwordless (DSSO) authentication in seconds"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we ever say "DSSO" in user facing messages?

Comment thread src/D2L.Bmx/ParameterDescriptions.cs Outdated
"Enables Cache for AWS tokens. Implied if '--use-credential-process' is supplied";
public static readonly string PasswordlessTimeout =
"Timeout for Okta passwordless (DSSO) authentication in seconds"
+ $" (0 to disable, {PasswordlessTimeoutDefaults.Min}-{PasswordlessTimeoutDefaults.Max},"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

message not clear to me: 0 to disable the timeout control or to disable passwordless auth?

Comment thread src/D2L.Bmx/BmxConfigProvider.cs Outdated
Comment on lines +50 to +51
|| configTimeout < 0
|| ( configTimeout > 0 && configTimeout < PasswordlessTimeoutDefaults.Min )

@cfbao cfbao Jun 3, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

only need a single equality check with 0?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread src/D2L.Bmx/ConsolePrompter.cs Outdated

int? IConsolePrompter.PromptPasswordlessTimeout() {
Console.Error.Write(
"Okta passwordless (DSSO) timeout in seconds"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should use ParameterDescriptions here?

Comment thread src/D2L.Bmx/OktaAuthenticator.cs Outdated
using var pageTimer = new System.Timers.Timer( TimeSpan.FromSeconds( 6 ) ) { AutoReset = false };
// cancel if we can't load the first page within a derived timeout
using var pageTimer = new System.Timers.Timer(
TimeSpan.FromSeconds( Math.Max( 6, timeoutSeconds / 2 ) ) ) { AutoReset = false };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor, but might be better to avoid integer arithmetic and truncation behaviour
e.g.
5/2 = 2
vs
5/2.0 = 2.5
25% difference

Comment thread src/D2L.Bmx/OktaAuthenticator.cs Outdated
Comment on lines +210 to +211
// we give the first page 6 sec to load, but 3 sec is probably enough for subsequent pages
pageTimer.Interval = 3000;
pageTimer.Interval = Math.Max( 3, timeoutSeconds / 4 ) * 1000;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm maybe paranoid, but I wonder if any page might load really slow and 7 sec isn't enough... especially like, what if the first page isn't the slowest one, and it's the 3 page that would take bulk of the time??

thinking - remove the distinction between first page load vs subsequent page load, and just always use timeoutSeconds / 2.0 for each page load.

Comment thread src/D2L.Bmx/OktaAuthenticator.cs Outdated
Comment on lines +210 to +211
// we give the first page 6 sec to load, but 3 sec is probably enough for subsequent pages
pageTimer.Interval = 3000;
pageTimer.Interval = Math.Max( 3, timeoutSeconds / 2.0 ) * 1000;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thinking about these page timeouts again...
I wonder if the 6 vs 3 timeouts minimums are even meaningful now.
Can maybe just set a single page that's half the total timeout when the Timer is created, and not change the Interval here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure I've got it now to just always be set to half the total timeout

@gord5500
gord5500 merged commit 74ac92c into main Jun 5, 2026
14 checks passed
@gord5500
gord5500 deleted the add_passwordless_timeout_config branch June 5, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants