authorizer

package
v0.0.0-...-c283e9f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("invalid authorization")

Functions

func ParseTokenKey

func ParseTokenKey(tk string) (*ecdsa.PublicKey, error)

func ParseTokenMaxValidity

func ParseTokenMaxValidity(tv string) (time.Duration, error)

Types

type Authorizer

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

func New

func New(authKeys, authIDs []string, tokenKey *ecdsa.PublicKey, tokenMaxValidity time.Duration) *Authorizer

func (*Authorizer) AuthorizeKey

func (a *Authorizer) AuthorizeKey(key string) (*Token, error)

func (*Authorizer) AuthorizeRequest

func (a *Authorizer) AuthorizeRequest(req *http.Request) (*Token, error)

func (*Authorizer) AuthorizeToken

func (a *Authorizer) AuthorizeToken(token string) (*Token, error)

type Token

type Token struct {
	ID   string
	User string
}

Jump to

Keyboard shortcuts

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