providers

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseProvider

type BaseProvider struct {
	DefaultAvatar string
	UserInfoURL   string

	Name string
	// contains filtered or unexported fields
}

func (*BaseProvider) GetName

func (b *BaseProvider) GetName() string

func (*BaseProvider) GetRedirect

func (b *BaseProvider) GetRedirect(state string) string

func (*BaseProvider) SetMapping

func (b *BaseProvider) SetMapping(mapping *config.OAuth2Mapping)

func (*BaseProvider) SetOauthConfig

func (b *BaseProvider) SetOauthConfig(cfg *oauth2.Config)

type Discord

type Discord struct {
	BaseProvider
}

func (*Discord) GetUserInfo

func (p *Discord) GetUserInfo(ctx context.Context, code string) (*UserInfo, error)

type Generic

type Generic struct {
	BaseProvider
}

func (*Generic) GetUserInfo

func (p *Generic) GetUserInfo(ctx context.Context, code string) (*UserInfo, error)

type IProvider

type IProvider interface {
	SetOauthConfig(*oauth2.Config)
	SetMapping(*config.OAuth2Mapping)

	GetName() string

	GetRedirect(state string) string
	GetUserInfo(ctx context.Context, code string) (*UserInfo, error)
}

type UserInfo

type UserInfo struct {
	ID       string
	Username string
	Avatar   string
}

Jump to

Keyboard shortcuts

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