Documentation ¶
Index ¶
- Constants
- func MemeoryStore(server *Server)
- func NewFileTokenStore(filename string) (oauth2.TokenStore, error)
- func NewMemoryTokenStore() oauth2.TokenStore
- func NewMultiLevelTokenStore(stores ...oauth2.TokenStore) oauth2.TokenStore
- func NewTokenExtension(tes ...TokenExtension) func(oauth2.TokenInfo) map[string]interface{}
- func UserExtension(fieldsValue map[string]interface{}, ti oauth2.TokenInfo)
- type AuthClient
- type AuthOption
- type ClientInfo
- type Server
- func (as *Server) HandleTokenRequest(w http.ResponseWriter, r *http.Request)
- func (as *Server) RemoveAccessToken(access string) (err error)
- func (as *Server) RemoveRefreshToken(refresh string) (err error)
- func (as *Server) SetClientStore(clientStore oauth2.ClientStore)
- func (as *Server) SetClients(clients ...ClientInfo)
- func (as *Server) SetExtensionFieldsHandler(handler func(ti oauth2.TokenInfo) map[string]interface{})
- func (as *Server) SetPasswordAuthorizationHandler(handler func(username, password string) (string, error))
- func (as *Server) SetPasswordTokenCfg(accessTokenExp, refreshTokenExp time.Duration, isGenerateRefresh bool)
- func (as *Server) SetRefreshTokenCfg(accessTokenExp, refreshTokenExp time.Duration, ...)
- func (as *Server) SetTokenStorage(tokenStore oauth2.TokenStore)
- func (as *Server) ValidateToken(w http.ResponseWriter, r *http.Request) (ti oauth2.TokenInfo, err error)
- type TokenExtension
Constants ¶
View Source
const ( TokenExpiredErrorCode = "token_expired" )
Variables ¶
This section is empty.
Functions ¶
func NewFileTokenStore ¶
func NewMemoryTokenStore ¶
func NewMemoryTokenStore() oauth2.TokenStore
func NewMultiLevelTokenStore ¶
func NewMultiLevelTokenStore(stores ...oauth2.TokenStore) oauth2.TokenStore
func NewTokenExtension ¶
func NewTokenExtension(tes ...TokenExtension) func(oauth2.TokenInfo) map[string]interface{}
func UserExtension ¶
func UserExtension(fieldsValue map[string]interface{}, ti oauth2.TokenInfo)
Types ¶
type AuthClient ¶
func (*AuthClient) GetDomain ¶
func (ac *AuthClient) GetDomain() string
func (*AuthClient) GetID ¶
func (ac *AuthClient) GetID() string
func (*AuthClient) GetSecret ¶
func (ac *AuthClient) GetSecret() string
func (*AuthClient) GetUserID ¶
func (ac *AuthClient) GetUserID() string
type AuthOption ¶
type AuthOption func(server *Server)
type ClientInfo ¶
type ClientInfo interface { oauth2.ClientInfo }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewOAuthServer ¶
func NewOAuthServer() *Server
func SetupPasswordAuthServer ¶
func SetupPasswordAuthServer(client ClientInfo, pwdHandler func(username, password string) (string, error), tokenStore oauth2.TokenStore, opts ...AuthOption) *Server
export nolint[lll]
func (*Server) HandleTokenRequest ¶
func (as *Server) HandleTokenRequest(w http.ResponseWriter, r *http.Request)
func (*Server) RemoveAccessToken ¶
func (*Server) RemoveRefreshToken ¶
func (*Server) SetClientStore ¶
func (as *Server) SetClientStore(clientStore oauth2.ClientStore)
func (*Server) SetClients ¶
func (as *Server) SetClients(clients ...ClientInfo)
func (*Server) SetExtensionFieldsHandler ¶
func (*Server) SetPasswordAuthorizationHandler ¶
func (*Server) SetPasswordTokenCfg ¶
func (*Server) SetRefreshTokenCfg ¶
func (as *Server) SetRefreshTokenCfg(accessTokenExp, refreshTokenExp time.Duration, isGenerateRefresh, isRemoveAccess, isRemoveRefreshing bool, isResetRefreshTime bool)
nolint[lll]
func (*Server) SetTokenStorage ¶
func (as *Server) SetTokenStorage(tokenStore oauth2.TokenStore)
func (*Server) ValidateToken ¶
type TokenExtension ¶
type TokenExtension func(map[string]interface{}, oauth2.TokenInfo)
Click to show internal directories.
Click to hide internal directories.