Versions in this module Expand all Collapse all v4 v4.0.0 May 22, 2020 Changes in this version + func ClientBasicHandler(r *http.Request) (string, string, error) + func ClientFormHandler(r *http.Request) (string, string, error) + type AccessTokenExpHandler func(w http.ResponseWriter, r *http.Request) (exp time.Duration, err error) + type AuthorizeRequest struct + AccessTokenExp time.Duration + ClientID string + RedirectURI string + Request *http.Request + ResponseType oauth2.ResponseType + Scope string + State string + UserID string + type AuthorizeScopeHandler func(w http.ResponseWriter, r *http.Request) (scope string, err error) + type ClientAuthorizedHandler func(clientID string, grant oauth2.GrantType) (allowed bool, err error) + type ClientInfoHandler func(r *http.Request) (clientID, clientSecret string, err error) + type ClientScopeHandler func(clientID, scope string) (allowed bool, err error) + type Config struct + AllowGetAccessRequest bool + AllowedGrantTypes []oauth2.GrantType + AllowedResponseTypes []oauth2.ResponseType + TokenType string + func NewConfig() *Config + type ExtensionFieldsHandler func(ti oauth2.TokenInfo) (fieldsValue map[string]interface{}) + type InternalErrorHandler func(err error) (re *errors.Response) + type PasswordAuthorizationHandler func(username, password string) (userID string, err error) + type RefreshingScopeHandler func(newScope, oldScope string) (allowed bool, err error) + type ResponseErrorHandler func(re *errors.Response) + type Server struct + AccessTokenExpHandler AccessTokenExpHandler + AuthorizeScopeHandler AuthorizeScopeHandler + ClientAuthorizedHandler ClientAuthorizedHandler + ClientInfoHandler ClientInfoHandler + ClientScopeHandler ClientScopeHandler + Config *Config + ExtensionFieldsHandler ExtensionFieldsHandler + InternalErrorHandler InternalErrorHandler + Manager oauth2.Manager + PasswordAuthorizationHandler PasswordAuthorizationHandler + RefreshingScopeHandler RefreshingScopeHandler + ResponseErrorHandler ResponseErrorHandler + UserAuthorizationHandler UserAuthorizationHandler + func NewDefaultServer(manager oauth2.Manager) *Server + func NewServer(cfg *Config, manager oauth2.Manager) *Server + func (s *Server) BearerAuth(r *http.Request) (string, bool) + 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 *AuthorizeRequest) (oauth2.TokenInfo, error) + func (s *Server) GetErrorData(err error) (map[string]interface{}, int, http.Header) + func (s *Server) GetRedirectURI(req *AuthorizeRequest, data map[string]interface{}) (string, error) + func (s *Server) GetTokenData(ti oauth2.TokenInfo) map[string]interface{} + func (s *Server) HandleAuthorizeRequest(w http.ResponseWriter, r *http.Request) error + func (s *Server) HandleTokenRequest(w http.ResponseWriter, r *http.Request) error + func (s *Server) SetAccessTokenExpHandler(handler AccessTokenExpHandler) + func (s *Server) SetAllowGetAccessRequest(allow bool) + func (s *Server) SetAllowedGrantType(types ...oauth2.GrantType) + func (s *Server) SetAllowedResponseType(types ...oauth2.ResponseType) + func (s *Server) SetAuthorizeScopeHandler(handler AuthorizeScopeHandler) + func (s *Server) SetClientAuthorizedHandler(handler ClientAuthorizedHandler) + func (s *Server) SetClientInfoHandler(handler ClientInfoHandler) + func (s *Server) SetClientScopeHandler(handler ClientScopeHandler) + func (s *Server) SetExtensionFieldsHandler(handler ExtensionFieldsHandler) + func (s *Server) SetInternalErrorHandler(handler InternalErrorHandler) + func (s *Server) SetPasswordAuthorizationHandler(handler PasswordAuthorizationHandler) + func (s *Server) SetRefreshingScopeHandler(handler RefreshingScopeHandler) + func (s *Server) SetResponseErrorHandler(handler ResponseErrorHandler) + func (s *Server) SetTokenType(tokenType string) + func (s *Server) SetUserAuthorizationHandler(handler UserAuthorizationHandler) + func (s *Server) ValidationAuthorizeRequest(r *http.Request) (*AuthorizeRequest, error) + func (s *Server) ValidationBearerToken(r *http.Request) (oauth2.TokenInfo, error) + func (s *Server) ValidationTokenRequest(r *http.Request) (oauth2.GrantType, *oauth2.TokenGenerateRequest, error) + type UserAuthorizationHandler func(w http.ResponseWriter, r *http.Request) (userID string, err error) Other modules containing this package gopkg.in/oauth2.v2 gopkg.in/oauth2.v3