security

package
v0.0.32 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SecurityRepository

type SecurityRepository interface {
	GetRemoteToken(token string) (*User, error)
	CleanToken(token string)
	GetToken(token string) (*User, bool)
}

func NewSecurityRepository

func NewSecurityRepository(
	log log.LogRusEntry,
	client httpx.HTTPClient,
	authServerUrl string,
) SecurityRepository

type SecurityService

type SecurityService interface {
	Validate(token string) (*User, error)
	Invalidate(token string)
}

func NewSecurityService

func NewSecurityService(
	log log.LogRusEntry,
	repo SecurityRepository,
) SecurityService

type User

type User struct {
	ID          string   `json:"id"  validate:"required"`
	Name        string   `json:"name"  validate:"required"`
	Permissions []string `json:"permissions"`
	Login       string   `json:"login"  validate:"required"`
}

User is the logged-in user

func (*User) HasPermission added in v0.0.8

func (u *User) HasPermission(permission string) bool

Jump to

Keyboard shortcuts

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