Skip to content

feat: Allow hiding password auth, changing OpenID Connect text and OpenID Connect icon#5101

Merged
kylecarbs merged 24 commits into
coder:mainfrom
normana10:configurable-openid-connect-text
Jan 31, 2023
Merged

feat: Allow hiding password auth, changing OpenID Connect text and OpenID Connect icon#5101
kylecarbs merged 24 commits into
coder:mainfrom
normana10:configurable-openid-connect-text

Conversation

@normana10

@normana10 normana10 commented Nov 16, 2022

Copy link
Copy Markdown
Contributor

Just some ideas to help decrease friction in onboarding developers to my coder deployment

For context, my users will never use password auth, only Oauth

Examples:

  1. Default coder login (nothing new here, just for reference)
    1
  2. With the following env vars set (also nothing new here, just for reference):
  • CODER_OIDC_ISSUER_URL
  • CODER_OIDC_EMAIL_DOMAIN
  • CODER_OIDC_CLIENT_ID
  • CODER_OIDC_CLIENT_SECRET
    2
  1. With the following env vars set:
  • CODER_OIDC_ISSUER_URL
  • CODER_OIDC_EMAIL_DOMAIN
  • CODER_OIDC_CLIENT_ID
  • CODER_OIDC_CLIENT_SECRET
  • CODER_PASSWORD_AUTH_HIDDEN=true
  • CODER_OIDC_SIGN_IN_TEXT="Sign in with Gitea"
  • CODER_OIDC_ICON_URL=https://gitea.io/images/gitea.png
    3

I only reference Gitea because that's my OpenID Connect provider at home, feel free to replace that with anything you like 👍

I also acknowledge that I'm changing the shape of the return body of api/v2/users/authmethods. Not sure if that's a deal breaker?

Also let me know if Coder intentionally didn't want to do any of these. Don't want my random PRs to steamroll any actual conversations that have taken place

@normana10 normana10 requested a review from a team as a code owner November 16, 2022 02:48
@normana10 normana10 requested review from presleyp and removed request for a team November 16, 2022 02:48
@presleyp presleyp requested a review from kylecarbs November 16, 2022 14:46

@kylecarbs kylecarbs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey 👋 I appreciate the contribution!

I think we'll want to end up disabling password authentication instead of hiding it for security reasons. I'll review this later today!

@bpmct

bpmct commented Nov 22, 2022

Copy link
Copy Markdown
Member

@kylecarbs and I just had a chat and decided we shouldn't completely disable the password login so the default Owner account can log in.

However, we can put it behind a backdoor (e.g. ?auth=password) so that users don't see an option to log in with a user/pass. Also, OIDC users wouldn't be able to log in with a password anyways

@normana10

Copy link
Copy Markdown
Contributor Author

Implemented

With the following env vars set:

  • CODER_OIDC_ISSUER_URL
  • CODER_OIDC_EMAIL_DOMAIN
  • CODER_OIDC_CLIENT_ID
  • CODER_OIDC_CLIENT_SECRET
  • CODER_PASSWORD_AUTH_HIDDEN=true
  • CODER_OIDC_SIGN_IN_TEXT="Sign in with Gitea"
  • CODER_OIDC_ICON_URL=https://gitea.io/images/gitea.png

image
image

@presleyp presleyp removed their request for review November 28, 2022 15:39
@github-actions

github-actions Bot commented Dec 6, 2022

Copy link
Copy Markdown

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions Bot added the stale This issue is like stale bread. label Dec 6, 2022
# Conflicts:
#	cli/deployment/config.go
#	cli/server.go
#	cli/testdata/coder_server_--help.golden
#	coderd/userauth.go
#	codersdk/deploymentconfig.go
#	docs/admin/auth.md
#	site/src/api/typesGenerated.ts
#	site/src/components/SignInForm/SignInForm.tsx
@normana10 normana10 requested a review from kylecarbs December 6, 2022 04:36
@github-actions github-actions Bot removed the stale This issue is like stale bread. label Dec 7, 2022
@github-actions

Copy link
Copy Markdown

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions Bot added the stale This issue is like stale bread. label Dec 14, 2022
@mafredri

Copy link
Copy Markdown
Member

I think we'll want to end up disabling password authentication instead of hiding it for security reasons. I'll review this later today!

@kylecarbs how would an owner/admin sign in if we disable password auth? As @bpmct proposed, we could put it behind ?password=password, or maybe better /login/admin. But ultimately that seems like an inconvenience. Maybe it's negligible though.

@mafredri mafredri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Backend changes look good to me with one minor request if we keep the flag.

Comment thread cli/deployment/config.go Outdated
@kylecarbs

Copy link
Copy Markdown
Member

I think I'd prefer if we did a small "Login with Password" link at the bottom that would permit authenticating with a password. It's awkward to not allow it, since in emergency situations it would be required.

An alternative is to take the stance that owners/admins should be able to modify the deployment, so they could always disable this feature.

@bpmct

bpmct commented Dec 14, 2022

Copy link
Copy Markdown
Member

I think I'd prefer if we did a small "Login with Password" link at the bottom that would permit authenticating with a password. It's awkward to not allow it, since in emergency situations it would be required.

An alternative is to take the stance that owners/admins should be able to modify the deployment, so they could always disable this feature.

I can get behind a small link as long as it's clear that SSO is preferred. Many login forms tend to have both even if 99% of an organization's users use SSO

@bpmct bpmct left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This UX LGTM! Thanks for the contribution, let's ship it 🚢

<div>
<LoadingButton
loading={isLoading}
{showPasswordAuth && (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have some new conditionals in this file introduced by the new booleans: nonPasswordAuthEnabled and showPasswordAuth. Considering the file is getting fairly large, it might be nice to break the JSX inside these conditionals into separate components in separate files. This will make everything a bit more readable. Not a blocker though!

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.

I agree

I took a hack at it (might have made a few stylistic choices, open to feedback)

Also turned these var && into <Maybes as I saw that used all over the codebase (and might have to steal that for myself)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks beautiful! Thanks for leaving things better than you found them :)

Comment thread site/src/pages/LoginPage/LoginPage.test.tsx
@github-actions

github-actions Bot commented Jan 20, 2023

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@normana10 normana10 force-pushed the configurable-openid-connect-text branch from 6e20df2 to 1ed7911 Compare January 20, 2023 04:33
@normana10

normana10 commented Jan 20, 2023

Copy link
Copy Markdown
Contributor Author

Oops sorry pushed the golden files update from a different computer

@kylecarbs

Copy link
Copy Markdown
Member

@normana10 seems like make gen isn't quite producing the same for you... want me to post a patch you can apply?

@normana10

Copy link
Copy Markdown
Contributor Author

@kylecarbs

Feel free

I keep trying to run make gen and it does nothing

Then I do a make gen -B

And I get a:

$ make gen -B
panic: could not start resource: : dial unix /var/run/docker.sock: connect: connection refused

goroutine 1 [running]:
main.main()
	/Users/normana10/git/coder/coderd/database/gen/dump/main.go:23 +0xb25
exit status 2
make: *** [Makefile:461: coderd/database/dump.sql] Error 1

(On my Mac)

Which.... totally makes sense, I don't have Docker installed on my Mac

Buuuut, when I try the same on my Fedora computer it ends up erroring out with a:

...
../docs/api/workspaces.md 99ms
../docs/manifest.json 16ms
../coderd/apidoc/swagger.json 351ms
Done in 4.37s.
ERROR: The 'yq' dependency is required, but is not available.

ERROR: One or more dependencies are not available, check above log output for more details.
make: *** [Makefile:509: site/.prettierrc.yaml] Error 1

But... yq is definitely installed

@mafredri

Copy link
Copy Markdown
Member

@normana10 sorry the error is so unhelpful, you'll need to have yq v4 installed, either as yq4 or yq --version >= v4.

@normana10

Copy link
Copy Markdown
Contributor Author
$ yq --version
yq version 4.2.0

🤷

@normana10

Copy link
Copy Markdown
Contributor Author

Wait I just noticed that yq outside of nix-shell is v4 but inside it's v3 o.O

Just symlinked my install of yq to yq4 and make gen -B ran just fine

Pushing up now

@normana10

Copy link
Copy Markdown
Contributor Author

That was a roller coaster but I think it's all good now? 👍

Thanks!

@kylecarbs

Copy link
Copy Markdown
Member

Woot woot. Thanks for pushing through @normana10 🥳

@kylecarbs

Copy link
Copy Markdown
Member

@normana10 can you merge in main then I'll merge this in ASAP! Thank you again for being patient, this was a controversial one for us.

@normana10

Copy link
Copy Markdown
Contributor Author

@kylecarbs

Done

Sorry if I caused any issues 😬

@normana10 normana10 changed the title Allow hiding password auth, changing OpenID Connect text and OpenID Connect icon feat: Allow hiding password auth, changing OpenID Connect text and OpenID Connect icon Jan 30, 2023
@kylecarbs kylecarbs enabled auto-merge (squash) January 31, 2023 18:26
@kylecarbs kylecarbs merged commit 69fce04 into coder:main Jan 31, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 31, 2023
@kylecarbs

Copy link
Copy Markdown
Member

@normana10 we're now using this on https://dev.coder.com 😎

image

@github-actions github-actions Bot deleted the configurable-openid-connect-text branch May 17, 2024 00:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants