apiusers

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const ApiUserKey = "api-user"

Variables

View Source
var NoUser = &noUser{}

Functions

func SetApiUser

func SetApiUser(ctx context.Context, user ApiUser) context.Context

Types

type AccountApiKey

type AccountApiKey interface {
	GetHash() string
}

type AccountApiKeyGenerator

type AccountApiKeyGenerator interface {
	NewAccountApiKey(value string) (AccountApiKey, error)
}

type ApiUser

type ApiUser interface {
	Id() ID
	AccountId() string
	HasKey(apiKey AccountApiKey) bool
	HasPermission(permission string) bool
	Permissions() []string
}

ApiUser is a user of the API

func GetApiUser

func GetApiUser(ctx context.Context) ApiUser

type ID

type ID = string

type Repository

type Repository interface {
	FindByHash(apiKey AccountApiKey) (ApiUser, error)
	FindById(accountId ID) (ApiUser, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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