Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveUserAuthenticated ¶
func SaveUserUnauthenticated ¶
Types ¶
type AuthN ¶
type AuthN struct {
// contains filtered or unexported fields
}
AuthN implements the authentication middleware
func (*AuthN) ServeHTTP ¶
func (authn *AuthN) 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.
A token can either be issued for a specific project id or for a user. In the case of a project id, we attach a service account to the context. In the case of a user, we attach that user to the context.
type AuthNFactory ¶
type AuthNFactory struct {
// contains filtered or unexported fields
}
AuthNFactory generates a middleware handler `AuthN`
func NewAuthNFactory ¶
func NewAuthNFactory( config *config.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(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.