auth

package
v0.0.0-...-d437fa4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2014 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package auth provides the authentication methods for the API of the wavepipe media server.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoUsername is returned when no username is provided on login
	ErrNoUsername = errors.New("no username provided")
	// ErrNoPassword is returned when no password is provided on login
	ErrNoPassword = errors.New("no password provided")

	// ErrInvalidPublicKey is returned when an invalid public keyis used to access the API
	ErrInvalidPublicKey = errors.New("no such public key")
	// ErrNoSignature is returned when no API signature is provided on all other API calls
	ErrNoSignature = errors.New("no signature provided")
	// ErrInvalidSignature is returned when a mismatched API signature is provided
	ErrInvalidSignature = errors.New("invalid signature provided")
	// ErrMalformedSignature is returned when a malformed API signature is provided
	ErrMalformedSignature = errors.New("malformed signature provided")
	// ErrRepeatedRequest is returned when an API nonce is re-used
	ErrRepeatedRequest = errors.New("repeated nonce provided")
	// ErrSessionExpired is returned when the session is expired
	ErrSessionExpired = errors.New("session expired")
)
View Source
var NonceFilter = bloom.New(20000, 5)

NonceFilter is a bloom filter containing all nonce values seen in the past 24 hours. The filter is cleared every 24 hours, because this should be a reasonable enough time to prevent replay attacks.

Functions

This section is empty.

Types

type AuthMethod

type AuthMethod interface {
	Authenticate(*http.Request) (*data.User, *data.Session, error, error)
}

AuthMethod represents a method of authenticating with the API

type BcryptAuth

type BcryptAuth struct{}

BcryptAuth represents the bcrypt authentication method, used to log in to the API

func (BcryptAuth) Authenticate

func (a BcryptAuth) Authenticate(req *http.Request) (*data.User, *data.Session, error, error)

Authenticate uses the bcrypt authentication method to log in to the API, returning a session user and a pair of client/server errors

type HMACAuth

type HMACAuth struct{}

HMACAuth represents the standard API authentication method, HMAC-SHA1

func (HMACAuth) Authenticate

func (a HMACAuth) Authenticate(req *http.Request) (*data.User, *data.Session, error, error)

Authenticate uses the HMAC-SHA1 authentication scheme for any calls outside of login

type SimpleAuth

type SimpleAuth struct{}

SimpleAuth represents the simple authentication method, which can be used by local clients

func (SimpleAuth) Authenticate

func (a SimpleAuth) Authenticate(req *http.Request) (*data.User, *data.Session, error, error)

Authenticate uses the simple authentication method to log in to the API, returning a session user and a pair of client/server errors

Jump to

Keyboard shortcuts

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