authmapping

package
v2.11.3 Latest Latest
Warning

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

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

Documentation

Overview

Package authmapping maps external group memberships to Dagu authorization.

Index

Constants

View Source
const (
	// DefaultWorkspaceAccessAll grants the fallback role in every workspace.
	DefaultWorkspaceAccessAll = "all"
	// DefaultWorkspaceAccessNone grants no named workspaces on fallback.
	DefaultWorkspaceAccessNone = "none"
)

Variables

View Source
var ErrNoMatch = errors.New("no authorization mapping matched")

ErrNoMatch is returned when strict mapping finds no matching group.

Functions

This section is empty.

Types

type Config

type Config struct {
	DefaultRole            auth.Role
	GroupMappings          map[string]auth.Role
	WorkspaceMappings      map[string][]WorkspaceGrantConfig
	DefaultWorkspaceAccess string
	Strict                 bool
}

Config defines group-based authorization mapping.

type Mapper

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

Mapper is an immutable, compiled group authorization mapper.

func New

func New(config Config) (*Mapper, error)

New compiles group-based authorization configuration.

func (*Mapper) Map

func (m *Mapper) Map(groups []string) (Result, error)

Map selects global and workspace authorization for groups.

func (*Mapper) MapRole

func (m *Mapper) MapRole(groups []string) (auth.Role, error)

MapRole selects only the global role for groups.

func (*Mapper) WorkspaceAccessPolicyActive

func (m *Mapper) WorkspaceAccessPolicyActive() bool

WorkspaceAccessPolicyActive reports whether mapping controls workspace access.

type Result

type Result struct {
	Role            auth.Role
	WorkspaceAccess *auth.WorkspaceAccess
	MatchCount      int
}

Result is the authorization selected for a set of groups.

type WorkspaceGrantConfig

type WorkspaceGrantConfig struct {
	Workspace string
	Role      auth.Role
}

WorkspaceGrantConfig maps a group membership to a role in one workspace.

Jump to

Keyboard shortcuts

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