authz

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Overview

Package authz maps external groups, the Rauthy clients of calling applications, and the personal keys people make, 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, clients map[string][]string, delegable []string) (*Policy, error)

New validates and copies the application's role definitions, the external groups that grant them to people, the Rauthy client IDs that grant them to calling applications, and the permissions a person may give a key. An application nobody calls passes nil clients; one that issues no keys passes nil delegable. A delegable permission must be one some role grants.

func (*Policy) Delegable added in v0.11.0

func (policy *Policy) Delegable() []string

Delegable returns the permissions a key may carry, sorted.

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.

func (*Policy) ResolveClient added in v0.5.0

func (policy *Policy) ResolveClient(clientID string) Actor

ResolveClient returns what a calling application, named by its Rauthy client ID, may do. An unlisted client gets nothing.

func (*Policy) ResolveKey added in v0.11.0

func (policy *Policy) ResolveKey(groups, scopes []string) Actor

ResolveKey returns what a key may do: the scopes it was given that are delegable and that the policy grants to its holder's groups. Roles are the holder's, as Resolve gives them; a key with no permission left gets nothing.

Jump to

Keyboard shortcuts

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