Documentation ¶
Index ¶
- Constants
- type Authenticator
- type DefaultClient
- func (c *DefaultClient) AuthorizationMiddleware(next http.Handler) http.Handler
- func (c *DefaultClient) Login(w http.ResponseWriter, r *http.Request)
- func (c *DefaultClient) Logout(w http.ResponseWriter, r *http.Request)
- func (c *DefaultClient) RefreshToken(w http.ResponseWriter, r *http.Request)
- func (c *DefaultClient) Register(w http.ResponseWriter, r *http.Request)
- type TokenExchanger
Constants ¶
View Source
const ( BearerSchema = "Bearer " BasicSchema = "Basic " )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type Authenticator interface { //Login should return an authorization and refresh token to the client Login(w http.ResponseWriter, r *http.Request) //Logout should clear/invalidate the authorization and refresh tokens Logout(w http.ResponseWriter, r *http.Request) //Register should create a new user Register(w http.ResponseWriter, r *http.Request) //RefreshToken receives the refresh token from the client, validates it, removes it and returns a new authorization and refresh token RefreshToken(w http.ResponseWriter, r *http.Request) }
Authenticator is an interface that describes the functionality for authenticating http functions
type DefaultClient ¶
type DefaultClient struct {
// contains filtered or unexported fields
}
func NewDefaultClient ¶
func NewDefaultClient(key []byte, authorizationTokenExpiration time.Duration, refreshTokenExpiration time.Duration, adminEnabled bool, isAllowedAnonymous map[string]bool) *DefaultClient
NewDefaultClient
func (*DefaultClient) AuthorizationMiddleware ¶
func (c *DefaultClient) AuthorizationMiddleware(next http.Handler) http.Handler
func (*DefaultClient) Login ¶
func (c *DefaultClient) Login(w http.ResponseWriter, r *http.Request)
func (*DefaultClient) Logout ¶
func (c *DefaultClient) Logout(w http.ResponseWriter, r *http.Request)
func (*DefaultClient) RefreshToken ¶
func (c *DefaultClient) RefreshToken(w http.ResponseWriter, r *http.Request)
func (*DefaultClient) Register ¶
func (c *DefaultClient) Register(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.