omniauth

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 7 Imported by: 3

README

omniauth

test codecov

Omniauth implementation in Go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingIdToken = errors.New("missing id_token")
	ErrInvalidIdToken = errors.New("invalid id_token")
)

Functions

This section is empty.

Types

type Auth

type Auth struct {
	ID      string
	Name    string
	Email   string
	Picture string

	RawInfo RawInfo
}

type Claims

type Claims struct {
	ID      string `json:"sub"`
	Name    string `json:"name"`
	Email   string `json:"email"`
	Picture string `json:"picture"`
}

type Config

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

func NewConfig

func NewConfig(config *oauth2.Config) *Config

func (*Config) ExchangeAuthInfo

func (c *Config) ExchangeAuthInfo(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*Auth, error)

func (*Config) ExchangeAuthInfoByToken

func (c *Config) ExchangeAuthInfoByToken(token *oauth2.Token) (*Auth, error)

func (*Config) GetSelf

func (c *Config) GetSelf() IConfig

func (*Config) SetSelf

func (c *Config) SetSelf(self IConfig) *Config

type IConfig

type IConfig interface {
	Exchange(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*oauth2.Token, error)
	ExchangeAuthInfoByToken(token *oauth2.Token) (*Auth, error)
}

type OmniAuth

type OmniAuth interface {
	AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string
	ExchangeAuthInfo(ctx context.Context, code string, opts ...oauth2.AuthCodeOption) (*Auth, error)
}

func NewOmniAuth

func NewOmniAuth(config *oauth2.Config) OmniAuth

type RawInfo

type RawInfo map[string]any

Directories

Path Synopsis
strategies
github Module

Jump to

Keyboard shortcuts

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