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

okta: add passwordless dsso support #480

Merged
merged 42 commits into from
Sep 24, 2024
Merged

okta: add passwordless dsso support #480

merged 42 commits into from
Sep 24, 2024

Conversation

gord5500
Copy link
Contributor

@gord5500 gord5500 commented Sep 17, 2024

Why

It'll probably make a lot of people happy

This is going to be on by default and if any failure occurs, fall back to the password prompt.

Adding an additional flag --experimental-bypass-browser-security only for using bmx with elevated permissions. Chromium sandbox doesn't work without the --no-sanbox arg as admin. This can only be passed as a command line arg

File size jumped from 13.3 MB to 18.6 MB. Doesn't seem too bad?

Ticket

VUL-453

@github-actions github-actions bot added language/csharp size/L A large PR. Could this be broken up? labels Sep 17, 2024
@gord5500 gord5500 changed the title okta: add dsso authentication okta: add dsso authentication option Sep 17, 2024
@gord5500 gord5500 marked this pull request as ready for review September 17, 2024 16:28
@gord5500 gord5500 requested a review from a team as a code owner September 17, 2024 16:28
@gord5500 gord5500 requested review from cfbao and boarnoah September 17, 2024 16:28
src/D2L.Bmx/Okta/OktaClient.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/Okta/OktaClient.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
@cfbao
Copy link
Member

cfbao commented Sep 20, 2024

There are still quite a few mentions of DSSO in user-facing messages.

@gord5500
Copy link
Contributor Author

There are still quite a few mentions of DSSO in user-facing messages.

@cfbao I replaced DSSO with the actual name but I'll just say 'automatically' instead

@cfbao
Copy link
Member

cfbao commented Sep 20, 2024

yeah... I don't think "Desktop Single Sign-On" means anything to most people either.

cfbao
cfbao previously approved these changes Sep 23, 2024
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
bool nonInteractive,
bool experimentalBypassBrowserSecurity
) {
await using IBrowser? browser = await Browser.LaunchBrowserAsync( experimentalBypassBrowserSecurity );
Copy link
Member

Choose a reason for hiding this comment

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

nit: for such a side-effect heavy operation (launching a browser), I'd rather not invoke it through a static class.
A class-interface combo with it passed as an explicit dependency through the constructor parameter the DI way would be nice.

No need to change this now though. I have a couple other nits with this OktaAuthenticator class's structure overall. Will perhaps refactor it sometime.

src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
Comment on lines +220 to +222
string sessionLogin = oktaSession.Login.Split( "@" )[0];
string providedLogin = user.Split( "@" )[0];
if( !sessionLogin.Equals( providedLogin, StringComparison.OrdinalIgnoreCase ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

It's technically possible for an Okta org to have two distinct users with logins:

  1. [email protected]
  2. [email protected]

Our logic here won't capture such a mismatch.

I'm fine with our logic for now, but this is something to think about.

src/D2L.Bmx/OktaAuthenticator.cs Outdated Show resolved Hide resolved
src/D2L.Bmx/ParameterDescriptions.cs Outdated Show resolved Hide resolved
@cfbao
Copy link
Member

cfbao commented Sep 23, 2024

Please update PR description too

@gord5500 gord5500 changed the title okta: add dsso authentication okta: add automatic authentication Sep 24, 2024
@gord5500 gord5500 changed the title okta: add automatic authentication okta: add automatic sign in Sep 24, 2024
@gord5500 gord5500 changed the title okta: add automatic sign in okta: add passwordless dsso support Sep 24, 2024
@gord5500
Copy link
Contributor Author

@cfbao the review became stale. Do you mind looking over again please?

foreach( string environmentVariable in WindowsEnvironmentVariables ) {
string? prefix = Environment.GetEnvironmentVariable( environmentVariable );
if( prefix is not null ) {
string path = prefix + windowsPartialPath;
Copy link
Member

Choose a reason for hiding this comment

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

Just noticed this... best to use Path.Join for safe path concatenation.
Also, it'd be good to not start WindowsPartialPaths with leading (back)slashes, because they're relative (not absolute) paths.

Comment on lines 56 to 58
return MacPaths.First( File.Exists );
} else if( OperatingSystem.IsLinux() ) {
return LinuxPaths.First( File.Exists );
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't look right. If someone's Mac doesn't have Chrome or Edge installed, this would throw.
.FirstOrDefault should work.

@gord5500 gord5500 merged commit 0dbe6b1 into main Sep 24, 2024
9 checks passed
@gord5500 gord5500 deleted the add_passwordless branch September 24, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/github-actions language/csharp size/L A large PR. Could this be broken up?
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants