...

Package auth

import "github.com/go-kivik/kivik/v4/x/kivikd/auth"
Overview
Index
Subdirectories

Overview ▾

Package auth manages authorization and authentication for kivikd.

type Handler

Handler is an auth handler.

type Handler interface {
    // MethodName identifies the handler. It is only called once on server
    // start up.
    MethodName() string
    // Authenticate authenticates the HTTP request. On success, a user context
    // must be returned. Any error will immediately terminate the authentication
    // process, returning an error to the client. In particular, this means that
    // an "unauthorized" error must not be returned if fallthrough is intended.
    // If a response is sent, execution does not continue. This allows handlers
    // to expose their own API endpoints (for example, the default cookie auth
    // handler adds POST /_session and DELETE /_session handlers).
    Authenticate(http.ResponseWriter, *http.Request) (*authdb.UserContext, error)
}

type Session

Session represents an authenticated session.

type Session struct {
    AuthMethod string
    AuthDB     string
    Handlers   []string
    User       *authdb.UserContext
}

func (*Session) MarshalJSON

func (s *Session) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaler interface.

Subdirectories

Name Synopsis
..
basic Package basic provides HTTP Basic Auth services.
cookie Package cookie provides standard CouchDB cookie auth as described at http://docs.couchdb.org/en/2.0.0/api/server/authn.html#cookie-authentication