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

Check if access requests are enabled before redirecting to auth provider #62376

Merged
merged 4 commits into from May 2, 2024

Conversation

pjlast
Copy link
Contributor

@pjlast pjlast commented May 2, 2024

Closes #62313

This PR adds an additional check to the automatic redirect check that checks if request access is enabled or not, and only redirects if request access is disabled, otherwise there would be no way to request access to the instance.

Test plan

Added tests for redirect behaviour and verified locally

@cla-bot cla-bot bot added the cla-signed label May 2, 2024
@github-actions github-actions bot added team/product-platform team/source Tickets under the purview of Source - the one Source to graph it all labels May 2, 2024
@pjlast pjlast requested a review from a team May 2, 2024 11:02
// If there is only one auth provider that is going to be displayed, we want to redirect to it directly.
if (thirdPartyAuthProviders.length === 1 && !builtInAuthProvider) {
// If there is only one auth provider that is going to be displayed, and request access is disabled, we want to redirect to the auth provider directly.
if (thirdPartyAuthProviders.length === 1 && !builtInAuthProvider && !isRequestAccessAllowed) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is isRequestAccessAllowed ? What is the request access feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whether or not a user can request access to the sourcegraph instance https://docs.sourcegraph.com/admin/config/site_config#auth-accessRequest

Copy link
Member

Choose a reason for hiding this comment

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

Added some docs here: sourcegraph/docs#289

@pjlast pjlast merged commit a217a6a into main May 2, 2024
8 checks passed
@pjlast pjlast deleted the pjlast/62313-access-requests-with-one-auth-provider branch May 2, 2024 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed team/product-platform 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.

Bug: Users cannot make access requests when there is only one auth provider configured
3 participants