[v11.3.x] OAuth: Return SocialError on membership check failure (#98860)

OAuth: Return SocialError on membership check failure (#98330)

use socialerror

(cherry picked from commit ddca09fb02)

Co-authored-by: Daniel-Davies <33356828+Daniel-Davies@users.noreply.github.com>
pull/98907/head
grafana-delivery-bot[bot] 6 months ago committed by GitHub
parent 2d8c7ea350
commit 578f49a7f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      pkg/login/social/connectors/generic_oauth.go

@ -4,7 +4,6 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/mail"
@ -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"}
}
if !s.isOrganizationMember(ctx, client) {
return nil, errors.New("user not a member of one of the required organizations")
return nil, &SocialError{"User not a member of one of the required organizations"}
}
if !s.isGroupMember(userInfo.Groups) {

Loading…
Cancel
Save