Documentation
¶
Index ¶
- Constants
- func ExtractBearerToken(authorization string) string
- func HasAnyScope(scopes []string) bool
- func HasMinimumServiceScope(scopes []string, group, method string) bool
- func HasScope(scopes []string, required string) bool
- func HashToken(token string) string
- func MinimumServiceScope(group, method string) string
- func NewToken() (string, error)
- func ServiceScope(group, action string) string
- func TokenPrefix(token string) string
- type Context
- type ScopeInfo
- type SubjectType
Constants ¶
const ( ScopeAdmin = "admin:*" ScopeAdminMetrics = "admin:metrics" 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" ScopeServiceKarakeepRead = "service:karakeep:read" ScopeServiceKarakeepWrite = "service:karakeep:write" ScopeServiceMinifluxRead = "service:miniflux:read" ScopeServiceMinifluxWrite = "service:miniflux:write" ScopeServiceKanboardRead = "service:kanboard:read" ScopeServiceKanboardWrite = "service:kanboard:write" ScopeServiceTriliumRead = "service:trilium:read" ScopeServiceTriliumWrite = "service:trilium:write" ScopeServiceMemosRead = "service:memos:read" ScopeServiceMemosWrite = "service:memos:write" ScopeServiceFireflyiiiRead = "service:fireflyiii:read" ScopeServiceFireflyiiiWrite = "service:fireflyiii:write" ScopeServiceTransmissionRead = "service:transmission:read" ScopeServiceTransmissionWrite = "service:transmission:write" ScopeServiceNocodbRead = "service:nocodb:read" ScopeServiceNocodbWrite = "service:nocodb:write" ScopeServiceGiteaRead = "service:gitea:read" ScopeServiceGiteaWrite = "service:gitea:write" ScopeServiceGithubRead = "service:github:read" ScopeServiceGithubWrite = "service:github:write" ScopeServiceDevopsRead = "service:devops:read" ScopeServiceDevopsWrite = "service:devops:write" // reserved for future mutations ScopeServiceExampleRead = "service:example:read" ScopeServiceExampleWrite = "service:example:write" // Legacy Go constant aliases (same string as provider scopes). Prefer provider-scoped constants. ScopeServiceBookmarkRead = ScopeServiceKarakeepRead ScopeServiceBookmarkWrite = ScopeServiceKarakeepWrite ScopeServiceReaderRead = ScopeServiceMinifluxRead ScopeServiceReaderWrite = ScopeServiceMinifluxWrite ScopeServiceKanbanRead = ScopeServiceKanboardRead ScopeServiceKanbanWrite = ScopeServiceKanboardWrite ScopeServiceNoteRead = ScopeServiceTriliumRead ScopeServiceNoteWrite = ScopeServiceTriliumWrite ScopeServiceMemoRead = ScopeServiceMemosRead ScopeServiceMemoWrite = ScopeServiceMemosWrite ScopeServiceForgeRead = ScopeServiceGiteaRead ScopeServiceForgeWrite = ScopeServiceGiteaWrite ScopeServiceArchiveRead = "service:archive:read" ScopeServiceArchiveWrite = "service:archive:write" ScopeServiceInfraRead = "service:infra:read" ScopeServiceShellRead = "service:shell-history:read" ScopePipelineRead = "pipeline:read" ScopePipelineRun = "pipeline:run" ScopeWorkflowRun = "workflow:run" ScopeChatAgentChat = "chatagent:chat" )
Variables ¶
This section is empty.
Functions ¶
func ExtractBearerToken ¶
func HasAnyScope ¶ added in v0.97.8
HasAnyScope reports whether scopes is non-empty after trimming blank entries.
func HasMinimumServiceScope ¶ added in v0.97.8
HasMinimumServiceScope reports whether scopes satisfy the default /service/{group} gate. Write scopes satisfy read for the same provider group; pipeline:run satisfies pipeline:read.
func HasScope ¶
HasScope reports whether scopes includes the required scope or admin:*. Legacy domain scope strings (e.g. service:bookmark:read) match their provider equivalents.
func MinimumServiceScope ¶ added in v0.97.8
MinimumServiceScope returns the default minimum scope for /service/{group} routes. Web pipeline routes map to pipeline:*; hub module routes map to hub:capabilities:read; provider modules use service:{group}:read|write.
func ServiceScope ¶ added in v0.97.8
ServiceScope builds the canonical service:{group}:{action} scope string.
func TokenPrefix ¶
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
type SubjectType ¶
type SubjectType string
const ( SubjectUser SubjectType = "user" SubjectToken SubjectType = "token" SubjectCron SubjectType = "cron" SubjectPipeline SubjectType = "pipeline" SubjectWorkflow SubjectType = "workflow" SubjectAgent SubjectType = "agent" )