Documentation ¶
Overview ¶
Package kivikd provides a kivik daemon.
Index ¶
- Constants
- Variables
- func BindParams(r *http.Request, i interface{}) error
- func MustGetSession(ctx context.Context) *auth.Session
- func StringQueryParam(r *http.Request, key string) (string, bool)
- type Service
- func (s *Service) Bind(addr string) error
- func (s *Service) Conf() *conf.Conf
- func (s *Service) CreateAuthToken(name, salt string, time int64) (string, error)
- func (s *Service) Init() (http.Handler, error)
- func (s *Service) Start() error
- func (s *Service) ValidateCookie(user *authdb.UserContext, cookie string) (bool, error)
Constants ¶
const DefaultInsecureSecret = "They're all gonna laugh at you!"
DefaultInsecureSecret is the hash secret used if couch_httpd_auth.secret is unconfigured. Please configure couch_httpd_auth.secret, or they're all gonna laugh at you!
const DefaultSessionTimeout = 600
DefaultSessionTimeout is the default session timeout, in seconds, used if couch_httpd_auth.timeout is inuset.
Variables ¶
var ( // SessionKey is a context key used to access the authenticated session. SessionKey = &contextKey{"session"} // ClientContextKey is a context key used to access the kivik client. ClientContextKey = &contextKey{"client"} // ServiceContextKey is a context key used to access the serve.Service struct. ServiceContextKey = &contextKey{"service"} )
Functions ¶
func BindParams ¶
BindParams binds the request form or JSON body to the provided struct.
func MustGetSession ¶
MustGetSession returns the user context for the currently authenticated user. If no session is set, the function panics.
Types ¶
type Service ¶
type Service struct { // Client is an instance of a driver.Client, which will be served. Client *kivik.Client // UserStore provides access to the user database. This is passed to auth // handlers, and is used to authenticate sessions. If unset, a nil UserStore // will be used which authenticates all uses. PERPETUAL ADMIN PARTY! UserStore authdb.UserStore // AuthHandler is a slice of authentication handlers. If no auth // handlers are configured, the server will operate as a PERPETUAL // ADMIN PARTY! AuthHandlers []auth.Handler // CompatVersion is the compatibility version to report to clients. Defaults // to 1.6.1. CompatVersion string // VendorVersion is the vendor version string to report to clients. Defaults to the library // version. VendorVersion string // VendorName is the vendor name string to report to clients. Defaults to the library // vendor string. VendorName string // Favicon is the path to a file to serve as favicon.ico. If unset, a default // image is used. Favicon string // RequestLogger receives logging information for each request. RequestLogger logger.RequestLogger // ConfigFile is the path to a config file to read during startup. ConfigFile string // Config is a complete config object. If this is set, config loading is // bypassed. Config *conf.Conf // contains filtered or unexported fields }
Service defines a CouchDB-like service to serve. You will define one of these per server endpoint.
func GetService ¶
GetService extracts the Kivik service from the request.
func (*Service) CreateAuthToken ¶
CreateAuthToken hashes a user name, salt, timestamp, and the server secret into an authentication token.
func (*Service) Init ¶
Init initializes a configured server. This is automatically called when Start() is called, so this is meant to be used if you want to bind the server yourself.
func (*Service) ValidateCookie ¶
ValidateCookie validates a cookie against a user context.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package auth manages authorization and authentication for kivikd.
|
Package auth manages authorization and authentication for kivikd. |
basic
Package basic provides HTTP Basic Auth services.
|
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
|
Package cookie provides standard CouchDB cookie auth as described at http://docs.couchdb.org/en/2.0.0/api/server/authn.html#cookie-authentication |
Package authdb provides a standard interface to an authentication user store to be used by AuthHandlers.
|
Package authdb provides a standard interface to an authentication user store to be used by AuthHandlers. |
authgroup
Package authgroup groups two or more authentication backends together, trying one, then falling through to the others.
|
Package authgroup groups two or more authentication backends together, trying one, then falling through to the others. |
confadmin
Package confadmin provides an authentication service for admins configured in server configuration.
|
Package confadmin provides an authentication service for admins configured in server configuration. |
couchauth
Package couchauth provides auth services to a remote CouchDB server.
|
Package couchauth provides auth services to a remote CouchDB server. |
usersdb
Package usersdb provides auth facilities from a CouchDB _users database.
|
Package usersdb provides auth facilities from a CouchDB _users database. |
Package conf manages configuration for kivikd.
|
Package conf manages configuration for kivikd. |
Package cookies provides cookies utilities.
|
Package cookies provides cookies utilities. |
Package couchserver aims to provide a CouchDB-compatible HTTP server interface to a kivik.Client.
|
Package couchserver aims to provide a CouchDB-compatible HTTP server interface to a kivik.Client. |
Package logger defines the logger used by kivikd.
|
Package logger defines the logger used by kivikd. |
Package test configures the integration test suite for kivikd.
|
Package test configures the integration test suite for kivikd. |