authenticator

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNonceNotInRange = errors.New("submitted nonce is not in acceptable range")

ErrNonceNotInRange error when nonce not in acceptable range.

Functions

func NewAuthenticator

func NewAuthenticator(keyPairs ...KeyPair) (*httpsign.Authenticator, error)

NewAuthenticator create a httpsign.Authenticator to check the message signing is valid or not

Types

type KeyPair added in v0.1.1

type KeyPair struct {
	AccessKeyID     string
	SecretAccessKey string
}

KeyPair difine AccessKeyID and SecretAccessKey

type NonceValidator

type NonceValidator struct {
	// MaxTimeGap is max time different between client submit timestamp
	// and server time that considered valid. The time precision is millisecond.
	MaxTimeGap time.Duration
}

NonceValidator checking validate by time range

func NewNonceValidator

func NewNonceValidator(options ...NonceValidatorOption) *NonceValidator

NewNonceValidator return NonceValidator with default value (30 second)

func (*NonceValidator) Validate

func (v *NonceValidator) Validate(r *http.Request) error

Validate return error when checking if header date is valid or not

type NonceValidatorOption

type NonceValidatorOption func(*NonceValidator)

NonceValidatorOption is the option of Nonce Validator constructor.

func NonceValidatorWithMaxTimeGap

func NonceValidatorWithMaxTimeGap(gap time.Duration) NonceValidatorOption

NonceValidatorWithMaxTimeGap is the option to create NonceValidator with custom time gap.

Jump to

Keyboard shortcuts

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