mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Oauth: Remove unused function for oauth implementations (#58887)
* Oauth: remove unused function * Oauth: remove unused Oauth types
This commit is contained in:
parent
7e9d94cfda
commit
6e3cb2e3ed
@ -8,7 +8,6 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
@ -46,10 +45,6 @@ type azureAccessClaims struct {
|
||||
TenantID string `json:"tid"`
|
||||
}
|
||||
|
||||
func (s *SocialAzureAD) Type() int {
|
||||
return int(models.AZUREAD)
|
||||
}
|
||||
|
||||
func (s *SocialAzureAD) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error) {
|
||||
idToken := token.Extra("id_token")
|
||||
if idToken == nil {
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
@ -32,10 +31,6 @@ type SocialGenericOAuth struct {
|
||||
teamIds []string
|
||||
}
|
||||
|
||||
func (s *SocialGenericOAuth) Type() int {
|
||||
return int(models.GENERIC)
|
||||
}
|
||||
|
||||
func (s *SocialGenericOAuth) IsTeamMember(client *http.Client) bool {
|
||||
if len(s.teamIds) == 0 {
|
||||
return true
|
||||
|
@ -7,8 +7,6 @@ import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
@ -33,10 +31,6 @@ var (
|
||||
ErrMissingOrganizationMembership = Error{"user not a member of one of the required organizations"}
|
||||
)
|
||||
|
||||
func (s *SocialGithub) Type() int {
|
||||
return int(models.GITHUB)
|
||||
}
|
||||
|
||||
func (s *SocialGithub) IsTeamMember(client *http.Client) bool {
|
||||
if len(s.teamIds) == 0 {
|
||||
return true
|
||||
|
@ -6,8 +6,6 @@ import (
|
||||
"net/http"
|
||||
"regexp"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
@ -17,10 +15,6 @@ type SocialGitlab struct {
|
||||
apiUrl string
|
||||
}
|
||||
|
||||
func (s *SocialGitlab) Type() int {
|
||||
return int(models.GITLAB)
|
||||
}
|
||||
|
||||
func (s *SocialGitlab) IsGroupMember(groups []string) bool {
|
||||
if len(s.allowedGroups) == 0 {
|
||||
return true
|
||||
|
@ -5,8 +5,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
@ -16,10 +14,6 @@ type SocialGoogle struct {
|
||||
apiUrl string
|
||||
}
|
||||
|
||||
func (s *SocialGoogle) Type() int {
|
||||
return int(models.GOOGLE)
|
||||
}
|
||||
|
||||
func (s *SocialGoogle) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error) {
|
||||
var data struct {
|
||||
Id string `json:"id"`
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
|
||||
"golang.org/x/oauth2"
|
||||
@ -21,10 +20,6 @@ type OrgRecord struct {
|
||||
Login string `json:"login"`
|
||||
}
|
||||
|
||||
func (s *SocialGrafanaCom) Type() int {
|
||||
return int(models.GRAFANA_COM)
|
||||
}
|
||||
|
||||
func (s *SocialGrafanaCom) IsEmailAllowed(email string) bool {
|
||||
return true
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"golang.org/x/oauth2"
|
||||
"gopkg.in/square/go-jose.v2/jwt"
|
||||
)
|
||||
@ -44,10 +43,6 @@ func (claims *OktaClaims) extractEmail() string {
|
||||
return claims.Email
|
||||
}
|
||||
|
||||
func (s *SocialOkta) Type() int {
|
||||
return int(models.OKTA)
|
||||
}
|
||||
|
||||
func (s *SocialOkta) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error) {
|
||||
idToken := token.Extra("id_token")
|
||||
if idToken == nil {
|
||||
|
@ -240,7 +240,6 @@ func (b *BasicUserInfo) String() string {
|
||||
}
|
||||
|
||||
type SocialConnector interface {
|
||||
Type() int
|
||||
UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
|
||||
IsEmailAllowed(email string) bool
|
||||
IsSignupAllowed() bool
|
||||
|
@ -1,14 +0,0 @@
|
||||
package models
|
||||
|
||||
type OAuthType int
|
||||
|
||||
const (
|
||||
GITHUB OAuthType = iota + 1
|
||||
GOOGLE
|
||||
TWITTER
|
||||
GENERIC
|
||||
GRAFANA_COM
|
||||
GITLAB
|
||||
AZUREAD
|
||||
OKTA
|
||||
)
|
Loading…
Reference in New Issue
Block a user