hawk

package
Version: v0.0.0-...-f3817b1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2014 License: MPL-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MalformedCredentialsErr = errors.New("Malformed Credentials")
View Source
var MalformedParametersErr = errors.New("Malformed Parameters")

Functions

func NewClosingBytesReader

func NewClosingBytesReader(buffer []byte) *closingBytesReader

Types

type Algorithm

type Algorithm string
const (
	SHA256Algorithm  Algorithm = "sha256"
	DefaultAlgorithm           = SHA256Algorithm
)

func (*Algorithm) Scan

func (a *Algorithm) Scan(src interface{}) error

type Authenticator

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

func NewAuthenticator

func NewAuthenticator(credentialsStore CredentialsStore, replayChecker ReplayChecker) *Authenticator

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate(w http.ResponseWriter, r *http.Request) (Credentials, bool)

type BasicCredentials

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

func NewBasicCredentials

func NewBasicCredentials(identifier string, secret []byte, algorithm Algorithm) *BasicCredentials

func NewBasicCredentialsWithKey

func NewBasicCredentialsWithKey(key Key) *BasicCredentials

func (*BasicCredentials) Key

func (c *BasicCredentials) Key() Key

type Credentials

type Credentials interface {
	Key() Key
}

type CredentialsStore

type CredentialsStore interface {
	CredentialsForKeyIdentifier(keyIdentifier string) (Credentials, error)
}

type Key

type Key struct {
	Identifier string
	Secret     []byte
	Algorithm  Algorithm
}

type MemoryBackedReplayChecker

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

func NewMemoryBackedReplayChecker

func NewMemoryBackedReplayChecker() *MemoryBackedReplayChecker

func (*MemoryBackedReplayChecker) Check

func (rc *MemoryBackedReplayChecker) Check(id string) (bool, error)

func (*MemoryBackedReplayChecker) Remember

func (rc *MemoryBackedReplayChecker) Remember(id string) error

type Parameters

type Parameters struct {
	Id        string
	Timestamp int64
	Nonce     string
	Ext       string
	Mac       []byte
	Hash      []byte
}

type ReplayChecker

type ReplayChecker interface {
	Remember(id string) error
	Check(id string) (bool, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL