Documentation ¶
Index ¶
- Variables
- func NewOAuthService()
- type BasicUserInfo
- type Error
- type HttpGetResponse
- type OrgRecord
- type SocialBase
- type SocialConnector
- type SocialGenericOAuth
- func (s *SocialGenericOAuth) FetchOrganizations(client *http.Client) ([]string, error)
- func (s *SocialGenericOAuth) FetchPrivateEmail(client *http.Client) (string, error)
- func (s *SocialGenericOAuth) FetchTeamMemberships(client *http.Client) ([]int, error)
- func (s *SocialGenericOAuth) IsEmailAllowed(email string) bool
- func (s *SocialGenericOAuth) IsOrganizationMember(client *http.Client) bool
- func (s *SocialGenericOAuth) IsSignupAllowed() bool
- func (s *SocialGenericOAuth) IsTeamMember(client *http.Client) bool
- func (s *SocialGenericOAuth) Type() int
- func (s *SocialGenericOAuth) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
- type SocialGithub
- func (s *SocialGithub) FetchOrganizations(client *http.Client, organizationsUrl string) ([]string, error)
- func (s *SocialGithub) FetchPrivateEmail(client *http.Client) (string, error)
- func (s *SocialGithub) FetchTeamMemberships(client *http.Client) ([]int, error)
- func (s *SocialGithub) HasMoreRecords(headers http.Header) (string, bool)
- func (s *SocialGithub) IsEmailAllowed(email string) bool
- func (s *SocialGithub) IsOrganizationMember(client *http.Client, organizationsUrl string) bool
- func (s *SocialGithub) IsSignupAllowed() bool
- func (s *SocialGithub) IsTeamMember(client *http.Client) bool
- func (s *SocialGithub) Type() int
- func (s *SocialGithub) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
- type SocialGitlab
- func (s *SocialGitlab) GetGroups(client *http.Client, url string) ([]string, string)
- func (s *SocialGitlab) IsEmailAllowed(email string) bool
- func (s *SocialGitlab) IsGroupMember(client *http.Client) bool
- func (s *SocialGitlab) IsSignupAllowed() bool
- func (s *SocialGitlab) Type() int
- func (s *SocialGitlab) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
- type SocialGoogle
- type SocialGrafanaCom
- func (s *SocialGrafanaCom) IsEmailAllowed(email string) bool
- func (s *SocialGrafanaCom) IsOrganizationMember(organizations []OrgRecord) bool
- func (s *SocialGrafanaCom) IsSignupAllowed() bool
- func (s *SocialGrafanaCom) Type() int
- func (s *SocialGrafanaCom) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
- type UserInfoJson
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingTeamMembership = &Error{"User not a member of one of the required teams"} ErrMissingOrganizationMembership = &Error{"User not a member of one of the required organizations"} )
View Source
var ( SocialBaseUrl = "/login/" SocialMap = make(map[string]SocialConnector) )
View Source
var (
ErrMissingGroupMembership = &Error{"User not a member of one of the required groups"}
)
View Source
var GetOAuthProviders = func(cfg *setting.Cfg) map[string]bool { result := map[string]bool{} if cfg == nil || cfg.Raw == nil { return result } for _, name := range allOauthes { if name == "grafananet" { name = grafanaCom } sec := cfg.Raw.Section("auth." + name) if sec == nil { continue } result[name] = sec.Key("enabled").MustBool() } return result }
GetOAuthProviders returns available oauth providers and if they're enabled or not
Functions ¶
func NewOAuthService ¶
func NewOAuthService()
Types ¶
type BasicUserInfo ¶
type HttpGetResponse ¶
type SocialBase ¶
type SocialConnector ¶
type SocialConnector interface { Type() int UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error) IsEmailAllowed(email string) bool IsSignupAllowed() bool AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string Exchange(ctx context.Context, code string) (*oauth2.Token, error) Client(ctx context.Context, t *oauth2.Token) *http.Client TokenSource(ctx context.Context, t *oauth2.Token) oauth2.TokenSource }
type SocialGenericOAuth ¶
type SocialGenericOAuth struct { *SocialBase // contains filtered or unexported fields }
func (*SocialGenericOAuth) FetchOrganizations ¶
func (s *SocialGenericOAuth) FetchOrganizations(client *http.Client) ([]string, error)
func (*SocialGenericOAuth) FetchPrivateEmail ¶
func (s *SocialGenericOAuth) FetchPrivateEmail(client *http.Client) (string, error)
func (*SocialGenericOAuth) FetchTeamMemberships ¶
func (s *SocialGenericOAuth) FetchTeamMemberships(client *http.Client) ([]int, error)
func (*SocialGenericOAuth) IsEmailAllowed ¶
func (s *SocialGenericOAuth) IsEmailAllowed(email string) bool
func (*SocialGenericOAuth) IsOrganizationMember ¶
func (s *SocialGenericOAuth) IsOrganizationMember(client *http.Client) bool
func (*SocialGenericOAuth) IsSignupAllowed ¶
func (s *SocialGenericOAuth) IsSignupAllowed() bool
func (*SocialGenericOAuth) IsTeamMember ¶
func (s *SocialGenericOAuth) IsTeamMember(client *http.Client) bool
func (*SocialGenericOAuth) Type ¶
func (s *SocialGenericOAuth) Type() int
func (*SocialGenericOAuth) UserInfo ¶
func (s *SocialGenericOAuth) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
type SocialGithub ¶
type SocialGithub struct { *SocialBase // contains filtered or unexported fields }
func (*SocialGithub) FetchOrganizations ¶
func (*SocialGithub) FetchPrivateEmail ¶
func (s *SocialGithub) FetchPrivateEmail(client *http.Client) (string, error)
func (*SocialGithub) FetchTeamMemberships ¶
func (s *SocialGithub) FetchTeamMemberships(client *http.Client) ([]int, error)
func (*SocialGithub) HasMoreRecords ¶
func (s *SocialGithub) HasMoreRecords(headers http.Header) (string, bool)
func (*SocialGithub) IsEmailAllowed ¶
func (s *SocialGithub) IsEmailAllowed(email string) bool
func (*SocialGithub) IsOrganizationMember ¶
func (s *SocialGithub) IsOrganizationMember(client *http.Client, organizationsUrl string) bool
func (*SocialGithub) IsSignupAllowed ¶
func (s *SocialGithub) IsSignupAllowed() bool
func (*SocialGithub) IsTeamMember ¶
func (s *SocialGithub) IsTeamMember(client *http.Client) bool
func (*SocialGithub) Type ¶
func (s *SocialGithub) Type() int
func (*SocialGithub) UserInfo ¶
func (s *SocialGithub) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
type SocialGitlab ¶
type SocialGitlab struct { *SocialBase // contains filtered or unexported fields }
func (*SocialGitlab) IsEmailAllowed ¶
func (s *SocialGitlab) IsEmailAllowed(email string) bool
func (*SocialGitlab) IsGroupMember ¶
func (s *SocialGitlab) IsGroupMember(client *http.Client) bool
func (*SocialGitlab) IsSignupAllowed ¶
func (s *SocialGitlab) IsSignupAllowed() bool
func (*SocialGitlab) Type ¶
func (s *SocialGitlab) Type() int
func (*SocialGitlab) UserInfo ¶
func (s *SocialGitlab) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
type SocialGoogle ¶
type SocialGoogle struct { *SocialBase // contains filtered or unexported fields }
func (*SocialGoogle) IsEmailAllowed ¶
func (s *SocialGoogle) IsEmailAllowed(email string) bool
func (*SocialGoogle) IsSignupAllowed ¶
func (s *SocialGoogle) IsSignupAllowed() bool
func (*SocialGoogle) Type ¶
func (s *SocialGoogle) Type() int
func (*SocialGoogle) UserInfo ¶
func (s *SocialGoogle) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
type SocialGrafanaCom ¶
type SocialGrafanaCom struct { *SocialBase // contains filtered or unexported fields }
func (*SocialGrafanaCom) IsEmailAllowed ¶
func (s *SocialGrafanaCom) IsEmailAllowed(email string) bool
func (*SocialGrafanaCom) IsOrganizationMember ¶
func (s *SocialGrafanaCom) IsOrganizationMember(organizations []OrgRecord) bool
func (*SocialGrafanaCom) IsSignupAllowed ¶
func (s *SocialGrafanaCom) IsSignupAllowed() bool
func (*SocialGrafanaCom) Type ¶
func (s *SocialGrafanaCom) Type() int
func (*SocialGrafanaCom) UserInfo ¶
func (s *SocialGrafanaCom) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)
Click to show internal directories.
Click to hide internal directories.