authz

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package authz maps external groups to application-defined roles and permissions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

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

Actor is a permission snapshot. Its zero value grants nothing.

func (Actor) Can

func (actor Actor) Can(permission string) bool

func (Actor) Permissions

func (actor Actor) Permissions() []string

func (Actor) Roles

func (actor Actor) Roles() []string

type Policy

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

Policy is immutable after construction and safe for concurrent use.

func New

func New(roles, groups map[string][]string) (*Policy, error)

New validates and copies application role definitions and external group mappings.

func (*Policy) Resolve

func (policy *Policy) Resolve(groups []string, localRoles ...string) Actor

Resolve ignores unmapped groups. Identity.Roles are deliberately not trusted as application roles. Additional local role assignments must come from trusted code.

Jump to

Keyboard shortcuts

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