providers

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscordKeyModeID discordKeyMode = iota
	DiscordKeyModeEmail
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Discord

type Discord struct {
	Gosesh Gosesher
	Config *oauth2.Config
	// contains filtered or unexported fields
}

func NewDiscord

func NewDiscord(sesh Gosesher, scopes DiscordScopes, credentials gosesh.OAuth2Credentials, redirectPath string, opts ...DiscordOpt) *Discord

Creates a new Discord OAuth2 provider. redirectPath should have a leading slash.

func (*Discord) NewUser added in v0.1.1

func (d *Discord) NewUser() gosesh.OAuth2User

func (*Discord) OAuth2Begin

func (d *Discord) OAuth2Begin() http.HandlerFunc

func (*Discord) OAuth2Callback

func (d *Discord) OAuth2Callback(handler gosesh.CallbackHandler) http.HandlerFunc

type DiscordOpt added in v0.1.1

type DiscordOpt func(*Discord)

func WithDiscordKeyMode added in v0.1.0

func WithDiscordKeyMode(mode discordKeyMode) DiscordOpt

type DiscordScopes

type DiscordScopes struct {
	Email bool
}

type DiscordUser

type DiscordUser struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Email    string `json:"email,omitempty"`
	Verified bool   `json:"verified,omitempty"`

	Discord     *Discord `json:"-"`
	DiscordHost string   `json:"-"`
}

func (*DiscordUser) Request

func (user *DiscordUser) Request(ctx context.Context, accessToken string) (*http.Response, error)

func (*DiscordUser) String

func (user *DiscordUser) String() string

func (*DiscordUser) Unmarshal

func (user *DiscordUser) Unmarshal(b []byte) error

type GoogleProvider

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

func NewGoogle

func NewGoogle(gs *gosesh.Gosesh, providerConfig gosesh.OAuth2Credentials) GoogleProvider

func (*GoogleProvider) OAuth2Begin

func (p *GoogleProvider) OAuth2Begin() http.HandlerFunc

func (*GoogleProvider) OAuth2Callback added in v0.0.3

func (p *GoogleProvider) OAuth2Callback(handler gosesh.CallbackHandler) http.HandlerFunc

type Gosesher

type Gosesher interface {
	OAuth2Begin(cfg *oauth2.Config) http.HandlerFunc
	OAuth2Callback(user gosesh.OAuth2User, cfg *oauth2.Config, handler gosesh.CallbackHandler) http.HandlerFunc
	Scheme() string
	Host() string
}

Jump to

Keyboard shortcuts

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