authentication

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: GPL-3.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHTTPStatusCodeIsNotOK = errors.New("HTTP status code is not OK")

ErrHTTPStatusCodeIsNotOK signals that the returned HTTP status code is not OK

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that an invalid value has been provided

View Source
var ErrNilAddress = errors.New("nil token address")

ErrNilAddress signals that the token has a nil address

View Source
var ErrNilBody = errors.New("nil token body")

ErrNilBody signals that the token has a nil body

View Source
var ErrNilCacher = errors.New("nil cacher")

ErrNilCacher signals that a nil cacher has been provided

View Source
var ErrNilCryptoComponentsHolder = errors.New("nil cryptoComponentsHolder")

ErrNilCryptoComponentsHolder signals that a nil cryptoComponentsHolder has been provided

View Source
var ErrNilHttpClientWrapper = errors.New("nil http client wrapper")

ErrNilHttpClientWrapper signals that a nil http client wrapper was provided

View Source
var ErrNilSignature = errors.New("nil token signature")

ErrNilSignature signals that the token has a nil signature

View Source
var ErrNilSigner = errors.New("nil signer")

ErrNilSigner signals that a nil signer has been provided

View Source
var ErrNilTokenHandler = errors.New("nil token handler")

ErrNilTokenHandler signals that a nil token handler has been provided

View Source
var ErrTokenExpired = errors.New("token expired")

ErrTokenExpired signals that the provided token is expired

Functions

func CreateHTTPStatusError added in v1.3.3

func CreateHTTPStatusError(httpStatusCode int, err error) error

CreateHTTPStatusError creates an error with the provided http status code and error

Types

type AuthClient

type AuthClient interface {
	GetAccessToken() (string, error)
	IsInterfaceNil() bool
}

AuthClient defines the behavior of an authentication client

type AuthServer added in v1.3.3

type AuthServer interface {
	Validate(accessToken AuthToken) error
	IsInterfaceNil() bool
}

AuthServer defines the behavior of an authentication server

type AuthToken added in v1.3.3

type AuthToken interface {
	GetTtl() int64
	GetAddress() []byte
	GetHost() []byte
	GetSignature() []byte
	GetBlockHash() string
	GetExtraInfo() []byte
	IsInterfaceNil() bool
}

AuthToken defines the behavior of an authentication token

type AuthTokenHandler added in v1.3.3

type AuthTokenHandler interface {
	Decode(accessToken string) (AuthToken, error)
	Encode(authToken AuthToken) (string, error)
	GetUnsignedToken(authToken AuthToken) []byte
	GetSignableMessage(address, unsignedToken []byte) []byte
	GetSignableMessageLegacy(address, unsignedToken []byte) []byte
	IsInterfaceNil() bool
}

AuthTokenHandler defines the behavior of an authentication token handler

type HttpClientWrapper added in v1.3.3

type HttpClientWrapper interface {
	GetHTTP(ctx context.Context, endpoint string) ([]byte, int, error)
	PostHTTP(ctx context.Context, endpoint string, data []byte) ([]byte, int, error)
	IsInterfaceNil() bool
}

HttpClientWrapper defines the behavior of http client able to make http requests

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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