Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Allow sign-in providers for permissions use only#60722

Merged
pjlast merged 17 commits into
mainfrom
pjlast/60615-allow-non-sign-in-auth-provider
Mar 21, 2024
Merged

Allow sign-in providers for permissions use only#60722
pjlast merged 17 commits into
mainfrom
pjlast/60615-allow-non-sign-in-auth-provider

Conversation

@pjlast

@pjlast pjlast commented Feb 23, 2024

Copy link
Copy Markdown
Contributor

Closes #60615

The check that determines whether or not to auto-redirect to the auth provider does not take into account whether or not the auth provider is marked as hidden or not.

This PR fixes that so that if an auth provider his hidden, it is not factored into the decision of whether or not the user should be auto-redirected to the auth provider.

So now, if you have two auth providers configured:

{
  "auth.providers": [
    {
      "type": "github",
      "hidden": true
    },
    {
      "type": "gitlab"
    }
  ]
}

you would be auto-redirected to the GitLab sign-in page when visting /sign-in on Sourcegraph

Furthermore, this PR also adds a new config option, noSignIn, that allows an auth provider to be only hidden from the sign-in page (hidden hides it from the sign-in and account security page).

Test plan

Existing tests pass.

@cla-bot cla-bot Bot added the cla-signed label Feb 23, 2024
@github-actions github-actions Bot added the team/source Tickets under the purview of Source - the one Source to graph it all label Feb 23, 2024
@pjlast pjlast requested a review from a team February 23, 2024 11:00

@eseliger eseliger 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 should probably apply to all provider types, not just OAuth

@pjlast

pjlast commented Mar 13, 2024

Copy link
Copy Markdown
Contributor Author

@pjlast pjlast enabled auto-merge (squash) March 13, 2024 11:04
@pjlast pjlast disabled auto-merge March 13, 2024 11:05
@eseliger

Copy link
Copy Markdown
Member

aha! that's interesting(read: a little confusing), but also probably fine :D


type authProviderInfo struct {
IsBuiltin bool `json:"isBuiltin"`
NoSignIn bool `json:"noSignIn"`

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.

I think we'd want to add that to the jscontext type definition on the JS side, to stay consistent.

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.

Ah sorry, this was WIP, should have marked it as draft again

@pjlast pjlast marked this pull request as draft March 14, 2024 11:32
@pjlast pjlast marked this pull request as ready for review March 14, 2024 13:02
@sourcegraph-bot

sourcegraph-bot commented Mar 21, 2024

Copy link
Copy Markdown
Contributor

📖 Storybook live preview

@pjlast pjlast changed the title [fix] Check only providers that aren't hidden for sign-in redirect Allow sign-in providers for permissions use only Mar 21, 2024
@pjlast pjlast merged commit f171779 into main Mar 21, 2024
@pjlast pjlast deleted the pjlast/60615-allow-non-sign-in-auth-provider branch March 21, 2024 09:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/source Tickets under the purview of Source - the one Source to graph it all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow that identity providers cannot be used for sign in

3 participants