server

package
v0.0.0-...-2f30af1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetErrorData

func GetErrorData(err error) (data map[string]interface{}, statusCode int, header http.Header)

func GetRedirectUri

func GetRedirectUri(req *oauth2.Request, data map[string]interface{}) (uri string, err error)

func ParseBasicAuth

func ParseBasicAuth(basicAuth string) (username, password string, ok bool)

func Redirect

func Redirect(req *oauth2.Request, data map[string]interface{}, ctx *context.Context) (err error)

func RedirectError

func RedirectError(req *oauth2.Request, err error, ctx *context.Context) error

func ResponseErr

func ResponseErr(err error, ctx *context.Context) error

func ResponseToken

func ResponseToken(data map[string]interface{}, header http.Header, ctx *context.Context, statusCode ...int) (err error)

Types

type AuthenticateClientHandler

type AuthenticateClientHandler func(ctx *context.Context, clientIdAndSecret ...string) (redirectUris string, err error)

authenticate client (client is valid or satisfy some condition) or default when authorize request check client existed and token request check client_id match client_secret

type CheckUserGrantAccessHandler

type CheckUserGrantAccessHandler func(req *oauth2.Request, ctx *context.Context) (userId string, err error)

check user if has or not grant access ( check user is login and user has granted access to the client)

type CheckUserPasswordHandler

type CheckUserPasswordHandler func(username, password string, ctx *context.Context) (userId string, err error)

check username and password is match

type CustomizedAuthorizeErrHandler

type CustomizedAuthorizeErrHandler func(err error, ctx *context.Context) error

type CustomizedCheckScopeHandler

type CustomizedCheckScopeHandler func(scope string, grantType *oauth2.GrantType, ctx *context.Context) (allowed bool, err error)

check scope or default not check scope

type CustomizedClientCredentialsUserIdHandler

type CustomizedClientCredentialsUserIdHandler func(clientId string) (userId string)

type CustomizedRefreshingScopeHandler

type CustomizedRefreshingScopeHandler func(newScope, oldScope string, ctx *context.Context) (allowed bool, err error)

check refresh scope or default check newScope equals oldScope

type CustomizedTokenExtensionFieldsHandler

type CustomizedTokenExtensionFieldsHandler func(token store.Token, req *oauth2.Request, ctx *context.Context) (fieldsValue map[string]interface{})

type Server

type Server struct {
	Manager *manager.Manager
	// contains filtered or unexported fields
}

func NewDefaultServer

func NewDefaultServer() *Server

func NewServer

func NewServer(config *oauth2.Config) *Server

func (*Server) Authorize

func (s *Server) Authorize(ctx *context.Context)

* handle authorize

func (*Server) SetAuthenticateClientHandler

func (s *Server) SetAuthenticateClientHandler(h AuthenticateClientHandler)

func (*Server) SetCheckUserGrantAccessHandler

func (s *Server) SetCheckUserGrantAccessHandler(h CheckUserGrantAccessHandler)

func (*Server) SetCheckUserPasswordHandler

func (s *Server) SetCheckUserPasswordHandler(h CheckUserPasswordHandler)

func (*Server) SetCustomizedAuthorizeErrHandler

func (s *Server) SetCustomizedAuthorizeErrHandler(h CustomizedAuthorizeErrHandler)

func (*Server) SetCustomizedCheckScopeHandler

func (s *Server) SetCustomizedCheckScopeHandler(h CustomizedCheckScopeHandler)

func (*Server) SetCustomizedClientCredentialsUserIdHandler

func (s *Server) SetCustomizedClientCredentialsUserIdHandler(h CustomizedClientCredentialsUserIdHandler)

func (*Server) SetCustomizedRefreshingScopeHandler

func (s *Server) SetCustomizedRefreshingScopeHandler(h CustomizedRefreshingScopeHandler)

func (*Server) SetCustomizedTokenExtensionFieldsHandler

func (s *Server) SetCustomizedTokenExtensionFieldsHandler(h CustomizedTokenExtensionFieldsHandler)

func (*Server) Token

func (s *Server) Token(ctx *context.Context)

* handle token

Jump to

Keyboard shortcuts

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