social

package
v0.0.0-...-50a15a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SocialBaseUrl = utils.Getenv("OAUTH_LOGIN_URL", "/login/")
	SocialMap     = make(map[string]SocialConnector)
)

Functions

This section is empty.

Types

type BasicUserInfo

type BasicUserInfo struct {
	Id         string
	Name       string
	Email      string
	Login      string
	PictureUrl string
}

type GithubTeam

type GithubTeam struct {
	Id           int    `json:"id"`
	Slug         string `json:"slug"`
	URL          string `json:"html_url"`
	Organization struct {
		Login string `json:"login"`
	} `json:"organization"`
}

type OAuthInfo

type OAuthInfo struct {
	ClientId, ClientSecret string
	Scopes                 []string
	AuthUrl, TokenUrl      string
	Enabled                bool
	EmailAttributeName     string
	EmailAttributePath     string
	AllowedDomains         []string
	HostedDomain           string
	ApiUrl                 string
	AllowSignup            bool
	Name                   string
	TlsClientCert          string
	TlsClientKey           string
	TlsClientCa            string
	TlsSkipVerify          bool
	UsePKCE                bool
}

type Service

type Service interface {
	GetOAuthProviders() map[string]bool
	GetOAuthHttpClient(string) (*http.Client, error)
	GetConnector(string) (SocialConnector, error)
	GetOAuthInfoProvider(string) *OAuthInfo
	GetOAuthInfoProviders() map[string]*OAuthInfo
}

type SocialAuth0

type SocialAuth0 struct {
	*SocialBase
	// contains filtered or unexported fields
}

func (*SocialAuth0) Type

func (s *SocialAuth0) Type() int

func (*SocialAuth0) UserInfo

func (s *SocialAuth0) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)

type SocialBase

type SocialBase struct {
	*oauth2.Config
	// contains filtered or unexported fields
}

func (*SocialBase) IsEmailAllowed

func (s *SocialBase) IsEmailAllowed(email string) bool

func (*SocialBase) IsSignUpAllowed

func (s *SocialBase) IsSignUpAllowed() bool

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, authOptions ...oauth2.AuthCodeOption) (*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) 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
}

type SocialGoogle

type SocialGoogle struct {
	*SocialBase
	// contains filtered or unexported fields
}

func (*SocialGoogle) Type

func (s *SocialGoogle) Type() int

func (*SocialGoogle) UserInfo

func (s *SocialGoogle) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)

type SocialLine

type SocialLine struct {
	*SocialBase
	// contains filtered or unexported fields
}

func (*SocialLine) Type

func (s *SocialLine) Type() int

func (*SocialLine) UserInfo

func (s *SocialLine) UserInfo(client *http.Client, token *oauth2.Token) (*BasicUserInfo, error)

type SocialService

type SocialService struct {
	// contains filtered or unexported fields
}

func ProvideService

func ProvideService(cfg *config.Config) *SocialService

func (*SocialService) GetConnector

func (ss *SocialService) GetConnector(name string) (SocialConnector, error)

func (*SocialService) GetOAuthHttpClient

func (ss *SocialService) GetOAuthHttpClient(name string) (*http.Client, error)

func (*SocialService) GetOAuthInfoProvider

func (ss *SocialService) GetOAuthInfoProvider(name string) *OAuthInfo

func (*SocialService) GetOAuthInfoProviders

func (ss *SocialService) GetOAuthInfoProviders() map[string]*OAuthInfo

func (*SocialService) GetOAuthProviders

func (ss *SocialService) GetOAuthProviders() map[string]bool

type UserInfoJson

type UserInfoJson struct {
	Name        string              `json:"name"`
	DisplayName string              `json:"display_name"`
	Login       string              `json:"login"`
	Username    string              `json:"username"`
	Email       string              `json:"email"`
	Upn         string              `json:"upn"`
	Attributes  map[string][]string `json:"attributes"`
	// contains filtered or unexported fields
}

func (*UserInfoJson) String

func (info *UserInfoJson) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL