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

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

Merged
pjlast merged 4 commits intomainfrom
pjlast/62313-access-requests-with-one-auth-provider
May 2, 2024
Merged

Check if access requests are enabled before redirecting to auth provider#62376
pjlast merged 4 commits intomainfrom
pjlast/62313-access-requests-with-one-auth-provider

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
@pjlast pjlast deleted the pjlast/62313-access-requests-with-one-auth-provider branch May 2, 2024 13:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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