client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

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

func (*Component) OauthCode

func (c *Component) OauthCode(w http.ResponseWriter, r *http.Request) (*OauthToken, error)

OauthCode 获取code Handler

func (*Component) OauthLogin

func (c *Component) OauthLogin(w http.ResponseWriter, r *http.Request, req OauthLoginParams)

OauthLogin 登录Handler

type Config

type Config struct {
	ClientID             string
	ClientSecret         string
	AuthURL              string
	TokenURL             string
	RedirectURL          string
	UserInfoURL          string
	OauthStateCookieName string
}

Config oauth2配置

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig 定义默认配置

type Container

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

func DefaultContainer

func DefaultContainer() *Container

func Load

func Load(key string) *Container

func (*Container) Build

func (c *Container) Build(options ...Option) *Component

Build 构建实例

type OauthLoginParams

type OauthLoginParams struct {
	Referer string
}

type OauthState

type OauthState struct {
	State   string `json:"state"`
	Referer string `json:"referer"`
}

OauthState base 64 编码 referer和state信息

type OauthToken

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

func (*OauthToken) UserInfo

func (o *OauthToken) UserInfo(ctx context.Context, user interface{}) (err error)

type Option

type Option func(c *Container)

Jump to

Keyboard shortcuts

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