oauth2

package
v0.0.0-...-62da3de Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

http oauth2 define.

Index

Constants

View Source
const (
	Oauth2Eudore = "eudore"
	Oauth2Github = "github"
	Oauth2Google = "google"
	Oauth2Gitlab = "gitlab"
)

Variables

View Source
var (
	// ErrOauthCode code exchange failed error
	ErrOauthCode = errors.New("Code exchange failed")
	// ErrUnknownOauth2 unknown oauth2 error
	ErrUnknownOauth2 = errors.New("unknow oauth2")
)

Functions

func GetRandomString

func GetRandomString() string

GetRandomString 创建一个16为随机数

Types

type Config

type Config = oauth2.Config

Config 定义oauth2配置对象

type Oauth2

type Oauth2 interface {
	// Set Ouath2 config
	Config(*oauth2.Config)
	// Get redirect Addr
	Redirect(string) string
	// Handle callback request
	Callback(*http.Request) (map[string]interface{}, string, error)
}

Oauth2 定义http Oauth2接口

func NewOuath2

func NewOuath2(name string) (Oauth2, error)

NewOuath2 func Ouath2 factory,return oauth2 handle

type Oauth2GithubHandle

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

func (*Oauth2GithubHandle) Callback

func (o *Oauth2GithubHandle) Callback(req *http.Request) (map[string]interface{}, string, error)

func (*Oauth2GithubHandle) Config

func (o *Oauth2GithubHandle) Config(config *oauth2.Config)

func (*Oauth2GithubHandle) Redirect

func (o *Oauth2GithubHandle) Redirect(stats string) string

type Oauth2GitlabHandle

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

func (*Oauth2GitlabHandle) Callback

func (o *Oauth2GitlabHandle) Callback(req *http.Request) (map[string]interface{}, string, error)

func (*Oauth2GitlabHandle) Config

func (o *Oauth2GitlabHandle) Config(config *oauth2.Config)

func (*Oauth2GitlabHandle) Redirect

func (o *Oauth2GitlabHandle) Redirect(stats string) string

type Oauth2GoogleHandle

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

func (*Oauth2GoogleHandle) Callback

func (o *Oauth2GoogleHandle) Callback(req *http.Request) (map[string]interface{}, string, error)

func (*Oauth2GoogleHandle) Config

func (o *Oauth2GoogleHandle) Config(config *oauth2.Config)

func (*Oauth2GoogleHandle) Redirect

func (o *Oauth2GoogleHandle) Redirect(stats string) string

Jump to

Keyboard shortcuts

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