access

package
v0.0.0-...-8791696 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccess

func GetAccess(ctx context.Context) []address.Address

func GetGlobalRead

func GetGlobalRead(ctx context.Context) bool

func HasAccess

func HasAccess(ctx context.Context, addr address.Address) bool

func WithAccess

func WithAccess(ctx context.Context, addrs []address.Address) context.Context

func WithGlobalRead

func WithGlobalRead(ctx context.Context, globalRead bool) context.Context

Types

type ApiSecretDecoder

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

func NewApiSecretDecoder

func NewApiSecretDecoder(secretLoader SecretLoader) *ApiSecretDecoder

func (*ApiSecretDecoder) Get

func (sd *ApiSecretDecoder) Get() (bool, *dtypes.APIAlg, error)

type FileSecretLoader

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

func NewSecretLoader

func NewSecretLoader(secretPath string, expiryPeriod time.Duration) *FileSecretLoader

func (*FileSecretLoader) Get

func (sl *FileSecretLoader) Get() (bool, []byte, error)

type Handler

type Handler struct {
	Verify func(ctx context.Context, token string) (JwtPayload, error)
	Next   http.HandlerFunc
}

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type JwtPayload

type JwtPayload struct {
	GlobalRead bool
	Access     []address.Address
	Allow      []auth.Permission
}

type SecretLoader

type SecretLoader interface {
	Get() (bool, []byte, error)
}

Jump to

Keyboard shortcuts

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