mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Oauth: Display friendly error message when role_attribute_strict=true and no valid role found (#57818)
* Oauth: change error type to a struct that unwraps into a social error * Oauth: Handle empty role in error and fix unwrap * Oauth: provide more informatio in error * Oauth: return InvalidBasicRoleError * Oauth: Fix tests * Login: Remove casing * Oath: Change to warning logs
This commit is contained in:
@@ -99,7 +99,7 @@ func TestSocialGitlab_UserInfo(t *testing.T) {
|
||||
UserRespBody: editorUserRespBody,
|
||||
GroupsRespBody: "[" + strings.Join([]string{}, ",") + "]",
|
||||
RoleAttributePath: gitlabAttrPath,
|
||||
ExpectedError: ErrInvalidBasicRole,
|
||||
ExpectedError: &InvalidBasicRoleError{idP: "Gitlab"},
|
||||
},
|
||||
{ // Edge case, no match, no strict mode and no fallback => User has an empty role
|
||||
Name: "Fallback with no default will create a user with an empty role",
|
||||
@@ -117,7 +117,7 @@ func TestSocialGitlab_UserInfo(t *testing.T) {
|
||||
UserRespBody: editorUserRespBody,
|
||||
GroupsRespBody: "[" + strings.Join([]string{editorGroup}, ",") + "]",
|
||||
RoleAttributePath: "",
|
||||
ExpectedError: ErrInvalidBasicRole,
|
||||
ExpectedError: &InvalidBasicRoleError{idP: "Gitlab"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user