oauth2

package
v0.0.0-...-aa6f050 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RESPONSE_TYPE_CODE  = "code"
	RESPONSE_TYPE_TOKEN = "token"

	GRANT_TYPE_CODE         = "authorization_code"
	GRANT_TYPE_IMPLICIT     = "implicit"
	GRANT_TYPE_PASSWORD     = "password"
	GRANT_TYPE_CLIENTCERD   = "client_credentials"
	GRANT_TYPE_DEVICECODE   = "device code"
	GRANT_TYPE_REFRESHTOKEN = "refresh_token"
)

Variables

This section is empty.

Functions

func ProcessAccessToken

func ProcessAccessToken(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessGrantTypeClientCredentials

func ProcessGrantTypeClientCredentials(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessGrantTypeCode

func ProcessGrantTypeCode(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessGrantTypePassword

func ProcessGrantTypePassword(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessGrantTypeRefreshToken

func ProcessGrantTypeRefreshToken(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessRespTypeCode

func ProcessRespTypeCode(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessRespTypeToken

func ProcessRespTypeToken(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessRespTypeWebCode

func ProcessRespTypeWebCode(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessRespTypeWebToken

func ProcessRespTypeWebToken(auth *OAuth2, request *restful.Request, response *restful.Response)

func ProcessRevokeToken

func ProcessRevokeToken(auth *OAuth2, request *restful.Request, response *restful.Response)

func Run

func Run(host, port string)

Types

type GrantTypeFunc

type GrantTypeFunc func(auth *OAuth2, request *restful.Request, response *restful.Response)

type OAuth2

type OAuth2 struct {
	Addr           string
	UserManager    defines.UserManager
	ClientManager  defines.ClientManager
	DataManager    defines.DataManager
	EventListener  defines.EventListener
	CodeExpireTime time.Duration
	ErrorLog       *log.Logger
	LogHttpInfo    bool
	// contains filtered or unexported fields
}

func New

func New() *OAuth2

func NewWithWebCode

func NewWithWebCode(loginUrl, authorizeUrl string) *OAuth2

func (*OAuth2) Close

func (auth *OAuth2) Close()

func (*OAuth2) Handle

func (auth *OAuth2) Handle(c *restful.Container)

func (*OAuth2) RegisterGrantProcessor

func (auth *OAuth2) RegisterGrantProcessor(grant_type string, function GrantTypeFunc)

func (*OAuth2) RegisterRespProcessor

func (auth *OAuth2) RegisterRespProcessor(resp_type string, function ResponseTypeFunc)

func (*OAuth2) RegisterRespWebProcessor

func (auth *OAuth2) RegisterRespWebProcessor(resp_type string, function ResponseTypeFunc)

func (*OAuth2) Run

func (auth *OAuth2) Run(host, port string)

func (*OAuth2) RunWithContainer

func (auth *OAuth2) RunWithContainer(wsContainer *restful.Container, host, port string)

type ResponseTypeFunc

type ResponseTypeFunc func(auth *OAuth2, request *restful.Request, response *restful.Response)

Jump to

Keyboard shortcuts

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