Documentation ¶
Index ¶
- type AuthError
- type AuthFunc
- type Authenticator
- type Module
- func (m *Module) Authenticate(rw http.ResponseWriter, req *http.Request) (handled bool, userToken *string, err error)
- func (m *Module) AuthenticateWithList(authenticators []Authenticator, rw http.ResponseWriter, req *http.Request) (handled bool, userToken *string, err error)
- func (m *Module) Init(c *service.Config)
- func (m *Module) Logout(rw http.ResponseWriter, req *http.Request)
- func (m *Module) MustWithAuth(next router.Handle) router.Handle
- func (m *Module) MustWithAuthList(authenticators []Authenticator, next router.Handle) router.Handle
- func (m *Module) RegisterAuthenticator(a Authenticator)
- func (m *Module) WithAuth(next router.Handle) router.Handle
- func (m *Module) WithAuthList(authenticators []Authenticator, next router.Handle) router.Handle
- type UserTokenKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthError ¶
AuthError implements Error q: who should control the response? should it be json? html? what is the status code? should this be described in protobuf?
type Authenticator ¶
type Authenticator interface { // Authenticate returns true if the authenticator was used. // userToken is empty if not authenticated Authenticate(rw http.ResponseWriter, req *http.Request) (handled bool, userToken *string, err error) // Logout the given request Logout(rw http.ResponseWriter, req *http.Request) }
type Module ¶
type Module struct { Logger *logger.Module BaseAuthenticator Authenticator // defaults to MultiAuthenticate Authenticators []Authenticator }
func (*Module) Authenticate ¶
func (*Module) AuthenticateWithList ¶
func (m *Module) AuthenticateWithList(authenticators []Authenticator, rw http.ResponseWriter, req *http.Request) (handled bool, userToken *string, err error)
func (*Module) MustWithAuthList ¶
func (*Module) RegisterAuthenticator ¶
func (m *Module) RegisterAuthenticator(a Authenticator)
RegisterAuthenticator registers a new authenticator
func (*Module) WithAuthList ¶
type UserTokenKey ¶
type UserTokenKey struct{}
Click to show internal directories.
Click to hide internal directories.