oauth2

package
v0.0.0-...-678a821 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallbackHandler

func CallbackHandler(ctx context.Context)

func Redirect

func Redirect(ctx context.Context)

func SaveAccount

func SaveAccount(providerName string, account Account) error

Types

type Account

type Account struct {
	Id       string        `json:"id"`
	Token    *oauth2.Token `json:"-"`
	Scopes   []string      `json:"scopes"`
	Name     string        `json:"name"`
	ImageURL string        `json:"image_url"`
}

func GetAccount

func GetAccount(providerName, accountId string) (Account, error)

type AccountGetter

type AccountGetter func(t *oauth2.Token) (Account, error)

type Config

type Config struct {
	ClientID string `json:"client_id"`
	Secret   string `json:"secret"`
}

type OAuth

type OAuth struct {
	ProviderName       string
	Endpoint           oauth2.Endpoint
	ConfigHelpTemplate string

	GatAccount AccountGetter
	// contains filtered or unexported fields
}

func (*OAuth) Config

func (o *OAuth) Config() interface{}

func (*OAuth) ConfigHelp

func (o *OAuth) ConfigHelp() string

func (*OAuth) Fulfilled

func (o *OAuth) Fulfilled() bool

func (*OAuth) GoConfig

func (o *OAuth) GoConfig(scopes []string) oauth2.Config

func (*OAuth) Init

func (o *OAuth) Init(providerName string)

func (*OAuth) Name

func (o *OAuth) Name() string

func (*OAuth) RedirectURL

func (o *OAuth) RedirectURL() string

func (*OAuth) SetConfig

func (o *OAuth) SetConfig(c interface{}) error

Jump to

Keyboard shortcuts

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