-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
OAuth: Return SocialError on membership check failure #98330
Merged
mgyongyosi
merged 1 commit into
grafana:main
from
Daniel-Davies:ddavies/better-user-membership-errors
Jan 13, 2025
Merged
OAuth: Return SocialError on membership check failure #98330
mgyongyosi
merged 1 commit into
grafana:main
from
Daniel-Davies:ddavies/better-user-membership-errors
Jan 13, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Daniel-Davies
requested review from
dmihai and
kalleep
and removed request for
a team
December 20, 2024 16:35
grafana-pr-automation
bot
added
area/backend
pr/external
This PR is from external contributor
labels
Dec 20, 2024
Daniel-Davies
commented
Dec 20, 2024
@@ -320,11 +319,11 @@ func (s *SocialGenericOAuth) UserInfo(ctx context.Context, client *http.Client, | |||
} | |||
|
|||
if !s.isTeamMember(ctx, client) { | |||
return nil, errors.New("user not a member of one of the required teams") | |||
return nil, &SocialError{"User not a member of one of the required teams"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This follows what the current setup for other OAuth providers is. See below:
errMissingGroupMembership = &SocialError{"user not a member of one of the required groups"} |
Can this be backported to version 11.2.x and above by any chance? |
mgyongyosi
added
no-changelog
Skip including change in changelog/release notes
type/bug
labels
Jan 13, 2025
mgyongyosi
approved these changes
Jan 13, 2025
mgyongyosi
changed the title
Return SocialError on membership check failure
OAuth: Return SocialError on membership check failure
Jan 13, 2025
Thank you @Daniel-Davies for your contribution! |
mgyongyosi
added
backport v11.2.x
Mark PR for automatic backport to v11.2.x
backport v11.3.x
Mark PR for automatic backport to v11.3.x
labels
Jan 13, 2025
grafana-delivery-bot bot
pushed a commit
that referenced
this pull request
Jan 13, 2025
use socialerror (cherry picked from commit ddca09f)
1 task
grafana-delivery-bot bot
pushed a commit
that referenced
this pull request
Jan 13, 2025
use socialerror (cherry picked from commit ddca09f)
1 task
grafana-delivery-bot bot
pushed a commit
that referenced
this pull request
Jan 13, 2025
use socialerror (cherry picked from commit ddca09f)
1 task
mgyongyosi
pushed a commit
that referenced
this pull request
Jan 13, 2025
mgyongyosi
pushed a commit
that referenced
this pull request
Jan 13, 2025
mgyongyosi
pushed a commit
that referenced
this pull request
Jan 13, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/backend
backport v11.2.x
Mark PR for automatic backport to v11.2.x
backport v11.3.x
Mark PR for automatic backport to v11.3.x
backport v11.4.x
Mark PR for automatic backport to v11.4.x
no-changelog
Skip including change in changelog/release notes
pr/external
This PR is from external contributor
type/bug
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is this feature?
Propagation of a public facing error message using the existing SocialError construct that is already used in Azure OAuth in a similar context.
Details in existing issue. A quick bottom line: for the generic oauth plugin, the server administrator can specify that a user must be a member of certain oauth groups to access grafana. Currently, if a user fails this check, they are presented with an error screen that specifies 'InternalError' with no context. This is obviously very confusing to users, who then assume that Grafana is in an outage state or misconfigured.
Why do we need this feature?
See existing issue: #95800
We are facing significant user confusion in the current state. When a user is not a member of the teams that have been configured by a server administrator, they are met with an InternalError. This makes no sense.
Which issue(s) does this PR fix?:
Fixes #95800
Special notes for your reviewer:
Please check that: