Documentation ¶
Index ¶
- func ParseBasicAuth(auth string) (username, password string, ok bool)
- type ClientAuthorizedHandler
- type ClientScopeHandler
- type ClientStore
- type ExtensionFieldsHandler
- type InternalErrorHandler
- type PasswordAuthorizationHandler
- type RefreshingScopeHandler
- type ResponseErrorHandler
- type Server
- func (s *Server) CheckGrantType(gt oauth2.GrantType) bool
- func (s *Server) CheckResponseType(rt oauth2.ResponseType) bool
- func (s *Server) GetAccessToken(ctx context.Context, gt oauth2.GrantType, tgr *oauth2.TokenGenerateRequest) (oauth2.TokenInfo, error)
- func (s *Server) GetAuthorizeData(rt oauth2.ResponseType, ti oauth2.TokenInfo) map[string]interface{}
- func (s *Server) GetAuthorizeToken(ctx context.Context, req *param.OauthReq) (ti oauth2.TokenInfo, err error)
- func (s *Server) GetErrorData(err error) (map[string]interface{}, int, http.Header)
- func (s *Server) GetRedirectURI(req *param.OauthReq, data map[string]interface{}) (uri string, err error)
- func (s *Server) GetTokenData(ti oauth2.TokenInfo) map[string]interface{}
- func (s *Server) HandleAuthorizeRequest(ctx context.Context, req *param.OauthReq, token string, w http.ResponseWriter)
- func (s *Server) HandleTokenRequest(ctx context.Context, r *param.OauthReq, w http.ResponseWriter) error
- func (s *Server) ValidationAuthorizeRequest(req *param.OauthReq) error
- func (s *Server) ValidationTokenRequest(r *param.OauthReq) (*oauth2.TokenGenerateRequest, error)
- type UserAuthorizationHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseBasicAuth ¶
Types ¶
type ClientAuthorizedHandler ¶
type ClientAuthorizedHandler func(clientID string, grant oauth2.GrantType) (allowed bool, err error)
ClientAuthorizedHandler check the client allows to use this authorization grant type
type ClientScopeHandler ¶
ClientScopeHandler check the client allows to use scope
type ClientStore ¶
type ClientStore interface { GetByID(ctx context.Context, id string) (oauth2.ClientInfo, error) Set(cli oauth2.ClientInfo) (err error) }
ClientStore client information store
type ExtensionFieldsHandler ¶
type ExtensionFieldsHandler func(ti oauth2.TokenInfo) (fieldsValue map[string]interface{})
ExtensionFieldsHandler in response to the access token with the extension of the field
type InternalErrorHandler ¶
InternalErrorHandler internal error handing
type PasswordAuthorizationHandler ¶
type PasswordAuthorizationHandler func(username, password, verifyCode string) (userID string, err error)
PasswordAuthorizationHandler get user id from username and password
type RefreshingScopeHandler ¶
RefreshingScopeHandler check the scope of the refreshing token
type ResponseErrorHandler ¶
ResponseErrorHandler response error handing
type Server ¶
type Server struct { Config *server.Config Manager oauth2.Manager ClientAuthorizedHandler ClientAuthorizedHandler ClientScopeHandler ClientScopeHandler UserAuthorizationHandler UserAuthorizationHandler RefreshingScopeHandler RefreshingScopeHandler ResponseErrorHandler ResponseErrorHandler InternalErrorHandler InternalErrorHandler ExtensionFieldsHandler ExtensionFieldsHandler }
func NewDefaultServer ¶
func NewDefaultServer(manager oauth2.Manager) *Server
func (*Server) CheckGrantType ¶
func (*Server) CheckResponseType ¶
func (*Server) GetAccessToken ¶
func (*Server) GetAuthorizeData ¶
func (*Server) GetAuthorizeToken ¶
func (*Server) GetErrorData ¶
func (*Server) GetRedirectURI ¶
func (*Server) GetTokenData ¶
func (*Server) HandleAuthorizeRequest ¶
func (*Server) HandleTokenRequest ¶
func (*Server) ValidationAuthorizeRequest ¶
type UserAuthorizationHandler ¶
UserAuthorizationHandler get user id from request authorization
Click to show internal directories.
Click to hide internal directories.