authdb

package
v1.0.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package authdb provides a standard interface to an authentication user store to be used by AuthHandlers.

Index

Constants

View Source
const PBKDF2KeyLength = 20

PBKDF2KeyLength is the key length, in bytes, of the PBKDF2 keys used by CouchDB.

View Source
const SchemePBKDF2 = "pbkdf2"

SchemePBKDF2 is the default CouchDB password scheme.

Variables

This section is empty.

Functions

func ValidatePBKDF2

func ValidatePBKDF2(password, salt, derivedKey string, iterations int) bool

ValidatePBKDF2 returns true if the calculated hash matches the derivedKey.

Types

type UserContext

type UserContext struct {
	Database string   `json:"db,omitempty"`
	Name     string   `json:"name"`
	Roles    []string `json:"roles"`
	// Salt is needed to calculate cookie tokens.
	Salt string `json:"-"`
}

UserContext represents a CouchDB UserContext object. See http://docs.couchdb.org/en/2.0.0/json-structure.html#userctx-object.

func (*UserContext) MarshalJSON

func (c *UserContext) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaler interface.

type UserStore

type UserStore interface {
	// Validate returns a user context object if the credentials are valid. An
	// error must be returned otherwise. A Not Found error must not be returned.
	// Not Found should be treated identically to Unauthorized.
	Validate(ctx context.Context, username, password string) (user *UserContext, err error)
	// UserCtx returns a user context object if the user exists. It is used by
	// AuthHandlers that don't validate the password (e.g. Cookie auth).
	UserCtx(ctx context.Context, username string) (user *UserContext, err error)
}

A UserStore provides an AuthHandler with access to a user store for.

Directories

Path Synopsis
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.
Package confadmin provides an authentication service for admins configured in server configuration.
Package confadmin provides an authentication service for admins configured in server configuration.
Package couchauth provides auth services to a remote CouchDB server.
Package couchauth provides auth services to a remote CouchDB server.
Package usersdb provides auth facilities from a CouchDB _users database.
Package usersdb provides auth facilities from a CouchDB _users database.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL