Versions in this module Expand all Collapse all v5 v5.0.0 Mar 3, 2022 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 + CodeChallenge string + CodeChallengeMethod oauth2.CodeChallengeMethod + 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(tgr *oauth2.TokenGenerateRequest) (allowed bool, err error) + type Config struct + AllowGetAccessRequest bool + AllowedCodeChallengeMethods []oauth2.CodeChallengeMethod + AllowedGrantTypes []oauth2.GrantType + AllowedResponseTypes []oauth2.ResponseType + ForcePKCE bool + 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(ctx context.Context, username, password string) (userID string, err error) + type PreRedirectErrorHandler func(w http.ResponseWriter, req *AuthorizeRequest, err error) error + type RefreshingScopeHandler func(tgr *oauth2.TokenGenerateRequest, oldScope string) (allowed bool, err error) + type RefreshingValidationHandler func(ti oauth2.TokenInfo) (allowed bool, err error) + type ResponseErrorHandler func(re *errors.Response) + type ResponseTokenHandler func(w http.ResponseWriter, data map[string]interface{}, header http.Header, ...) error + type Server struct + AccessTokenExpHandler AccessTokenExpHandler + AuthorizeScopeHandler AuthorizeScopeHandler + ClientAuthorizedHandler ClientAuthorizedHandler + ClientInfoHandler ClientInfoHandler + ClientScopeHandler ClientScopeHandler + Config *Config + ExtensionFieldsHandler ExtensionFieldsHandler + InternalErrorHandler InternalErrorHandler + Manager oauth2.Manager + PasswordAuthorizationHandler PasswordAuthorizationHandler + PreRedirectErrorHandler PreRedirectErrorHandler + RefreshingScopeHandler RefreshingScopeHandler + RefreshingValidationHandler RefreshingValidationHandler + ResponseErrorHandler ResponseErrorHandler + ResponseTokenHandler ResponseTokenHandler + 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) CheckCodeChallengeMethod(ccm oauth2.CodeChallengeMethod) 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) SetPreRedirectErrorHandler(handler PreRedirectErrorHandler) + func (s *Server) SetRefreshingScopeHandler(handler RefreshingScopeHandler) + func (s *Server) SetRefreshingValidationHandler(handler RefreshingValidationHandler) + func (s *Server) SetResponseErrorHandler(handler ResponseErrorHandler) + func (s *Server) SetResponseTokenHandler(handler ResponseTokenHandler) + 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 github.com/dikhimartin/oauth2