auth

package
v0.92.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScopeAdmin = "admin:*"

	ScopeHubAppsRead          = "hub:apps:read"
	ScopeHubAppsStatus        = "hub:apps:status"
	ScopeHubAppsLogs          = "hub:apps:logs"
	ScopeHubAppsStart         = "hub:apps:start"
	ScopeHubAppsStop          = "hub:apps:stop"
	ScopeHubAppsRestart       = "hub:apps:restart"
	ScopeHubAppsPull          = "hub:apps:pull"
	ScopeHubAppsUpdate        = "hub:apps:update"
	ScopeHubCapabilitiesRead  = "hub:capabilities:read"
	ScopeHubHealthRead        = "hub:health:read"
	ScopeServiceBookmarkRead  = "service:bookmark:read"
	ScopeServiceBookmarkWrite = "service:bookmark:write"
	ScopeServiceArchiveRead   = "service:archive:read"
	ScopeServiceArchiveWrite  = "service:archive:write"
	ScopeServiceReaderRead    = "service:reader:read"
	ScopeServiceReaderWrite   = "service:reader:write"
	ScopeServiceKanbanRead    = "service:kanban:read"
	ScopeServiceKanbanWrite   = "service:kanban:write"
	ScopeServiceInfraRead     = "service:infra:read"
	ScopeServiceShellRead     = "service:shell-history:read"
	ScopeServiceExampleRead   = "service:example:read"
	ScopeServiceExampleWrite  = "service:example:write"
	ScopeServiceForgeRead     = "service:forge:read"
	ScopeServiceForgeWrite    = "service:forge:write"
	ScopeServiceNoteRead      = "service:note:read"
	ScopeServiceNoteWrite     = "service:note:write"
	ScopeServiceMemoRead      = "service:memo:read"
	ScopeServiceMemoWrite     = "service:memo:write"
	ScopePipelineRead         = "pipeline:read"
	ScopePipelineRun          = "pipeline:run"
	ScopeWorkflowRun          = "workflow:run"
)

Variables

This section is empty.

Functions

func ExtractBearerToken

func ExtractBearerToken(authorization string) string

func HasScope

func HasScope(scopes []string, required string) bool

func HashToken

func HashToken(token string) string

func NewToken

func NewToken() (string, error)

func TokenPrefix

func TokenPrefix(token string) string

Types

type Context

type Context struct {
	SubjectType SubjectType `json:"subject_type"`
	SubjectID   string      `json:"subject_id"`
	UID         types.Uid   `json:"uid"`
	Topic       string      `json:"topic"`
	Scopes      []string    `json:"scopes"`
	IPAddress   string      `json:"ip_address,omitempty"`
	UserAgent   string      `json:"user_agent,omitempty"`
}

func SystemCronContext

func SystemCronContext() Context

func SystemPipelineContext

func SystemPipelineContext() Context

func SystemWorkflowContext

func SystemWorkflowContext() Context

func (Context) HasScope

func (c Context) HasScope(scope string) bool

type ScopeInfo

type ScopeInfo struct {
	Value       string
	Description string
}

ScopeInfo describes an available scope for token creation.

func AllScopes

func AllScopes() []ScopeInfo

AllScopes returns all scopes available for CLI token creation.

type SubjectType

type SubjectType string
const (
	SubjectUser     SubjectType = "user"
	SubjectToken    SubjectType = "token"
	SubjectCron     SubjectType = "cron"
	SubjectPipeline SubjectType = "pipeline"
	SubjectWorkflow SubjectType = "workflow"
	SubjectAgent    SubjectType = "agent"
)

Jump to

Keyboard shortcuts

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