Documentation
¶
Index ¶
- func GetErrorData(err error) (data map[string]interface{}, statusCode int, header http.Header)
- func GetRedirectUri(req *oauth2.Request, data map[string]interface{}) (uri string, err error)
- func ParseBasicAuth(basicAuth string) (username, password string, ok bool)
- func Redirect(req *oauth2.Request, data map[string]interface{}, ctx *context.Context) (err error)
- func RedirectError(req *oauth2.Request, err error, ctx *context.Context) error
- func ResponseErr(err error, ctx *context.Context) error
- func ResponseToken(data map[string]interface{}, header http.Header, ctx *context.Context, ...) (err error)
- type AuthenticateClientHandler
- type CheckUserGrantAccessHandler
- type CheckUserPasswordHandler
- type CustomizedAuthorizeErrHandler
- type CustomizedCheckScopeHandler
- type CustomizedClientCredentialsUserIdHandler
- type CustomizedRefreshingScopeHandler
- type CustomizedTokenExtensionFieldsHandler
- type Server
- func (s *Server) Authorize(ctx *context.Context)
- func (s *Server) SetAuthenticateClientHandler(h AuthenticateClientHandler)
- func (s *Server) SetCheckUserGrantAccessHandler(h CheckUserGrantAccessHandler)
- func (s *Server) SetCheckUserPasswordHandler(h CheckUserPasswordHandler)
- func (s *Server) SetCustomizedAuthorizeErrHandler(h CustomizedAuthorizeErrHandler)
- func (s *Server) SetCustomizedCheckScopeHandler(h CustomizedCheckScopeHandler)
- func (s *Server) SetCustomizedClientCredentialsUserIdHandler(h CustomizedClientCredentialsUserIdHandler)
- func (s *Server) SetCustomizedRefreshingScopeHandler(h CustomizedRefreshingScopeHandler)
- func (s *Server) SetCustomizedTokenExtensionFieldsHandler(h CustomizedTokenExtensionFieldsHandler)
- func (s *Server) Token(ctx *context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetErrorData ¶
func GetRedirectUri ¶
func ParseBasicAuth ¶
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 CustomizedCheckScopeHandler ¶
type CustomizedCheckScopeHandler func(scope string, grantType *oauth2.GrantType, ctx *context.Context) (allowed bool, err error)
check scope or default not check scope
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 Server ¶
func NewDefaultServer ¶
func NewDefaultServer() *Server
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)
Click to show internal directories.
Click to hide internal directories.