auth

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 8 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) connect.Interceptor

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 AuthenticationProvider added in v0.30.0

type AuthenticationProvider interface {
	Authenticate(ctx context.Context, h http.Header) (Authentication, error)
}

type Option

type Option func(*authInterceptor)

func WithAuthToken

func WithAuthToken(token string) Option

func WithProviderToken

func WithProviderToken(token string) Option

func WithTenantCache added in v0.30.0

func WithTenantCache(arg cache.Cache[string, model.Tenant]) Option

type Principal

type Principal interface {
	Name() string
}

type Role

type Role string
const (
	RoleAdmin            Role = "admin"
	RoleRaceDataProvider Role = "racedata-provider"
	RoleTenantManager    Role = "tenant-manager"
	RoleTrackManager     Role = "track-manager"
)

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

type TenantAuth added in v0.31.0

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

func (*TenantAuth) GetId added in v0.31.0

func (s *TenantAuth) GetId() uint32

func (*TenantAuth) Principal added in v0.31.0

func (s *TenantAuth) Principal() Principal

func (*TenantAuth) Roles added in v0.31.0

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

type TenantAuthentication added in v0.31.0

type TenantAuthentication interface {
	Authentication
	GetId() uint32 // returns the tenant id
}

Jump to

Keyboard shortcuts

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