authsvc

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: AGPL-3.0 Imports: 16 Imported by: 0

README

authsvc

Authentication Service

Developing

GoDoc

This project is written in Go, and follows standard Go development practices.

Vendoring of dependencies is done with the dep tool.

There is a git pre-push hook for running some basic sanity tests before pushing. Please run .bin/install-pre-push-hook to install the hook.

Typical deployment of this service will be done with docker. The Dockerfile and related files are in docker/api/.

Documentation

Overview

Package authsvc provides an OAuth2 server wrapping LDAP backend

Index

Constants

View Source
const (
	// HashKeySize is optimally 64 bytes
	HashKeySize = 64
	// BlockKeySize is optimally 32 bytes
	BlockKeySize = 32
)

Variables

View Source
var (
	ErrInvalidRequest    = errors.New("invalid_request")
	ErrInvalidToken      = errors.New("invalid_token")
	ErrInsufficientScope = errors.New("insufficient_scope")
	ErrNoAuthToken       = errors.New("no_auth")
)

Exported Errors

Functions

func Decode added in v0.0.2

func Decode(hash string) ([]byte, error)

Decode extracts a byte slice from a base64 encoded string.

func Generate added in v0.0.2

func Generate(keysize int) string

Generate creates a random key of keysize length, and returns it in base64 encoded text.

func RegisterAPI

func RegisterAPI(root string, verbose bool) http.Handler

RegisterAPI returns a router for the api.

func RegisterOAuth added in v0.0.2

func RegisterOAuth(root string) http.Handler

RegisterOAuth returns a router that handles OAuth routes.

Types

type AuthenticationMiddleware added in v0.0.2

type AuthenticationMiddleware struct {
	// contains filtered or unexported fields
}

AuthenticationMiddleware enforces authentication on protected routes.

func NewAuthenticationMiddleware added in v0.0.2

func NewAuthenticationMiddleware(realm string, root string, seeder Seeder) (*AuthenticationMiddleware, error)

NewAuthenticationMiddleware returns a middlware suitable for authentication.

func (*AuthenticationMiddleware) LoginHandler added in v0.0.2

func (m *AuthenticationMiddleware) LoginHandler() http.Handler

LoginHandler returns a router that handles the login and logout routes.

func (*AuthenticationMiddleware) ServeHTTP added in v0.0.2

type DebugMiddleware added in v0.0.2

type DebugMiddleware struct {
	// contains filtered or unexported fields
}

DebugMiddleware provides request/response logging.

func NewDebugMiddleware added in v0.0.2

func NewDebugMiddleware(w io.Writer, verbose bool) *DebugMiddleware

NewDebugMiddleware provides middleware suitable for exhaustive request/response logging.

func (*DebugMiddleware) ServeHTTP added in v0.0.2

func (l *DebugMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type Seeder

type Seeder interface {
	HashKey() []byte
	BlockKey() []byte
}

Seeder describes functions needed for encrypted cookies.

func NewSeeder added in v0.0.2

func NewSeeder(hash string, block string) (Seeder, error)

NewSeeder creates a default Seeder from base64 encoded seed values.

Directories

Path Synopsis
cmd
api

Jump to

Keyboard shortcuts

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