auth

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPermissionDenied = errors.New("permission denied")

Functions

func NewAuthInterceptor

func NewAuthInterceptor(opts ...Option) *authInterceptor

Types

type AuthHolder

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

type Authentication

type Authentication interface {
	Principal() Principal
	Roles() []Role
}

func FromContext

func FromContext(ctx *context.Context) *Authentication

type Option

type Option func(*authInterceptor)

func WithAuthToken

func WithAuthToken(token string) Option

func WithProviderToken

func WithProviderToken(token string) Option

type Principal

type Principal interface {
	Name() string
}

type Role

type Role int
const (
	RoleAdmin Role = iota
	RoleProvider
)

type SimpleAuth

type SimpleAuth struct {
	Authentication
	// contains filtered or unexported fields
}

func (*SimpleAuth) Principal

func (s *SimpleAuth) Principal() Principal

func (*SimpleAuth) Roles

func (s *SimpleAuth) Roles() []Role

type SimplePrincipal

type SimplePrincipal struct {
	Principal
	// contains filtered or unexported fields
}

func (*SimplePrincipal) Name

func (s *SimplePrincipal) Name() string

Jump to

Keyboard shortcuts

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