auth

package
v3.10.8 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrapper

func Wrapper(r resolver.Resolver, prefix string) api.Wrapper

Wrapper wraps a handler and authenticates requests

Types

type BlockList

type BlockList interface {
	// IsBlocked returns true if the id is blocked
	IsBlocked(ctx context.Context, id, namespace string) (bool, error)
	// Add adds an ID to the blocklist
	Add(ctx context.Context, id, namespace string) error
	// Remove removes an ID from the blocklist
	Remove(ctx context.Context, id, namespace string) error
	// List returns the entire list of blocked IDs
	List(ctx context.Context) ([]string, error)
}

BlockList manages a list of blocked IDs.

var DefaultBlockList BlockList = &InMemoryBlockList{
	blocked: map[string]bool{},
}

type InMemoryBlockList

type InMemoryBlockList struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

InMemoryBlockList is an implementation of BlockList that maintains the list in memory only.

func (*InMemoryBlockList) Add

func (i *InMemoryBlockList) Add(ctx context.Context, id, namespace string) error

func (*InMemoryBlockList) IsBlocked

func (i *InMemoryBlockList) IsBlocked(ctx context.Context, id, namespace string) (bool, error)

func (*InMemoryBlockList) List

func (i *InMemoryBlockList) List(ctx context.Context) ([]string, error)

func (*InMemoryBlockList) Remove

func (i *InMemoryBlockList) Remove(ctx context.Context, id, namespace string) error

Jump to

Keyboard shortcuts

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