client

package
v0.0.0-...-3ada85e Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultInvokerCfg = InvokerCfg{
	Debug:       false,
	AppID:       "",
	AppSecret:   "",
	RedirectURI: "",
	AuthURL:     "",
	TokenURL:    "",
	State:       "",
	UserInfoURL: "",
	Scopes:      nil,
}

Functions

func DefaultBuild

func DefaultBuild() module.Invoker

default invoker build

Types

type Client

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

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(state, code string, option ...oauth2.AuthCodeOption) (token *oauth2.Token, err error)

func (*Client) GetCfg

func (c *Client) GetCfg() InvokerCfg

func (*Client) GetUserInfo

func (c *Client) GetUserInfo(token *oauth2.Token, info interface{}) (user interface{}, err error)

func (*Client) LoginPage

func (c *Client) LoginPage(option ...oauth2.AuthCodeOption) string

type InvokerCfg

type InvokerCfg struct {
	Debug       bool     `ini:"debug"`
	AppID       string   `ini:"appId"`
	AppSecret   string   `ini:"appSecret"`
	RedirectURI string   `ini:"redirectUri"`
	AuthURL     string   `ini:"authUrl"`
	TokenURL    string   `ini:"tokenUrl"`
	State       string   `ini:"state"`
	UserInfoURL string   `ini:"userInfoUrl"`
	Scopes      []string `ini:"scopes"`
}

type OAuthService

type OAuthService interface {
	LoginPage(option ...oauth2.AuthCodeOption) string
	GetAccessToken(state, code string, option ...oauth2.AuthCodeOption) (token *oauth2.Token, err error)
	GetUserInfo(token *oauth2.Token, info interface{}) (user interface{}, err error)
	GetCfg() InvokerCfg
}

func Invoker

func Invoker(name string) OAuthService

invoker

Jump to

Keyboard shortcuts

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