dbhandler

package module
v0.0.0-...-1be267e Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: GPL-3.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateOidcState

func GenerateOidcState() string

func HashPassword

func HashPassword(password string) (string, error)

Types

type CallbackRequest

type CallbackRequest struct {
	Code string `json:"code"`
}

type InviteToken

type InviteToken struct {
	Email       string
	Permissions models.Permission
	Token       string
}

type InviteTokenDbHandler

type InviteTokenDbHandler interface {
	SaveInviteToken(ctx context.Context, email string, permissions models.Permission) (string, error)
	GetInviteToken(ctx context.Context, token string) (*InviteToken, error)
}

type OidcAuthenticationDbHandler

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

func NewOidcAuthenticationDbHamdler

func NewOidcAuthenticationDbHamdler(config models.OidcAuthConfig) (*OidcAuthenticationDbHandler, error)

func (*OidcAuthenticationDbHandler) AuthenticateUser

func (self *OidcAuthenticationDbHandler) AuthenticateUser(ctx context.Context, request CallbackRequest) (models.Permission, error)

type OidcClaims

type OidcClaims struct {
	Email       string
	Profile     string
	Permissions models.Permission
}

type Server

type Server struct {
	Id       string
	Owner    string
	Image    *models.Image
	Nickname string
	Command  string
	Ports    []models.Port
}

type ServerUpdateRequest

type ServerUpdateRequest struct {
	Owner    string
	Image    *models.Image
	Nickname string
	Command  string
	Ports    []models.Port
}

type ServersAuthorizationDbHandler

type ServersAuthorizationDbHandler interface {
	AddPermissions(ctx context.Context, username string, server_id string, permissions models.Permission) error
	RemovePermissions(ctx context.Context, string, server_id string, permissions models.Permission) error
	SetPermissions(ctx context.Context, username string, server_id string, permissions models.Permission) error
	GetPermissions(ctx context.Context, username string, server_id string) (models.Permission, error)
	RemoveUser(ctx context.Context, username string) error
	RemoveServer(ctx context.Context, server_id string) error
}

type ServersDbHandler

type ServersDbHandler interface {
	ListServers(ctx context.Context) ([]Server, error)
	GetServer(ctx context.Context, serverId string) (*Server, error)
	CreateServer(ctx context.Context, server Server) error
	DeleteServer(ctx context.Context, serverId string) error
	UpdateServer(ctx context.Context, serverId string, updateParams ServerUpdateRequest) error
}

type UserPassAuthanticationDbHandler

type UserPassAuthanticationDbHandler interface {
	// Read Only
	AuthenticateUser(ctx context.Context, username string, password string) (*models.User, error)
	ListUsers(ctx context.Context) ([]models.User, error)
	CountUsers(ctx context.Context) (uint, error)

	// Write
	CreateUser(ctx context.Context, username string, password string, permissions models.Permission, email string, maxOwnedServers uint) error
	RemoveUser(ctx context.Context, username string) error
	SetPermissions(ctx context.Context, username string, permissions models.Permission) error
	SetPassword(ctx context.Context, username string, password string) error
}

type UserSignupRequest

type UserSignupRequest struct {
	Token    InviteToken
	Username string
	Password string
}

Directories

Path Synopsis
mongo module

Jump to

Keyboard shortcuts

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