Documentation
¶
Index ¶
- func SaveOAuthState(w http.ResponseWriter, r *http.Request, config *server.Config) (string, error)
- func SaveUserAuthenticated(w http.ResponseWriter, r *http.Request, config *server.Config, ...) (string, error)
- func SaveUserUnauthenticated(w http.ResponseWriter, r *http.Request, config *server.Config) error
- func ValidateOAuthState(w http.ResponseWriter, r *http.Request, config *server.Config) (isValidated bool, isOAuthTriggered bool, err error)
- type AuthN
- type AuthNBasic
- type AuthNBasicFactory
- type AuthNFactory
- type NoAuthN
- type NoAuthNFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveOAuthState ¶
func SaveUserAuthenticated ¶
func SaveUserUnauthenticated ¶
Types ¶
type AuthN ¶
type AuthN struct {
// contains filtered or unexported fields
}
AuthN implements the authentication middleware
type AuthNBasic ¶
type AuthNBasic struct {
// contains filtered or unexported fields
}
AuthNBasic implements the authentication middleware
func (*AuthNBasic) ServeHTTP ¶
func (authn *AuthNBasic) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP attaches an authenticated subject to the request context, or serves a forbidden error. If authenticated, it calls the next handler.
type AuthNBasicFactory ¶
type AuthNBasicFactory struct {
// contains filtered or unexported fields
}
AuthNBasicFactory generates a middleware handler `AuthNBasic`
func NewAuthNBasicFactory ¶
func NewAuthNBasicFactory( config *server.Config, ) *AuthNBasicFactory
NewAuthNBasicFactory returns an `AuthNBasicFactory` that uses the passed-in server config
func (*AuthNBasicFactory) NewAuthenticated ¶
func (f *AuthNBasicFactory) NewAuthenticated(next http.Handler) http.Handler
NewAuthenticated creates a new instance of `AuthNBasic` that implements the http.Handler interface.
func (*AuthNBasicFactory) NewAuthenticatedWithRedirect ¶
func (f *AuthNBasicFactory) NewAuthenticatedWithRedirect(requireEmailVerification bool, next http.Handler) http.Handler
NewAuthenticatedWithRedirect creates a new instance of `AuthNBasic` that implements the http.Handler interface. This handler redirects the user to login if the user is not attached, and stores a redirect URI in the session, if the session exists.
func (*AuthNBasicFactory) NewAuthenticatedWithoutEmailVerification ¶
func (f *AuthNBasicFactory) NewAuthenticatedWithoutEmailVerification(next http.Handler) http.Handler
type AuthNFactory ¶
type AuthNFactory struct {
// contains filtered or unexported fields
}
AuthNFactory generates a middleware handler `AuthN`
func NewAuthNFactory ¶
func NewAuthNFactory( config *server.Config, ) *AuthNFactory
NewAuthNFactory returns an `AuthNFactory` that uses the passed-in server config
func (*AuthNFactory) NewAuthenticated ¶
func (f *AuthNFactory) NewAuthenticated(next http.Handler) http.Handler
NewAuthenticated creates a new instance of `AuthN` that implements the http.Handler interface.
func (*AuthNFactory) NewAuthenticatedWithRedirect ¶
func (f *AuthNFactory) NewAuthenticatedWithRedirect(requireEmailVerification bool, next http.Handler) http.Handler
NewAuthenticatedWithRedirect creates a new instance of `AuthN` that implements the http.Handler interface. This handler redirects the user to login if the user is not attached, and stores a redirect URI in the session, if the session exists.
func (*AuthNFactory) NewAuthenticatedWithoutEmailVerification ¶
func (f *AuthNFactory) NewAuthenticatedWithoutEmailVerification(next http.Handler) http.Handler
type NoAuthN ¶
type NoAuthN struct {
// contains filtered or unexported fields
}
NoAuthN implements the authentication middleware
type NoAuthNFactory ¶
type NoAuthNFactory struct {
// contains filtered or unexported fields
}
NoAuthNFactory generates a middleware handler `NoAuthN` which verifies that there are NO valid auth credentials attached to this request. This is useful for things like creating a new user or logging in.
func NewNoAuthNFactory ¶
func NewNoAuthNFactory( config *server.Config, ) *NoAuthNFactory
NewNoAuthNFactory returns an `AuthNFactory` that uses the passed-in server config
func (*NoAuthNFactory) NewNotAuthenticated ¶
func (f *NoAuthNFactory) NewNotAuthenticated(next http.Handler) http.Handler
NewNotAuthenticated creates a new instance of `NoAuthN` that implements the http.Handler interface.