adminapi

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package adminapi exposes reusable HTTP handlers for authz administration UIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(options Options) (http.Handler, error)

Types

type AttributePolicy

type AttributePolicy struct {
	ID       string `json:"id"`
	Resource string `json:"resource,omitempty"`
	Action   string `json:"action,omitempty"`
	Effect   string `json:"effect,omitempty"`
}

type Authorizer

type Authorizer interface {
	Authorize(context.Context, Principal, string, string) error
}

type Capability

type Capability struct {
	Name      string `json:"name"`
	Supported bool   `json:"supported"`
	Reason    string `json:"reason,omitempty"`
}

type Decision

type Decision struct {
	Allowed bool   `json:"allowed"`
	Reason  string `json:"reason,omitempty"`
}

type DecisionRequest

type DecisionRequest struct {
	Subject  string `json:"subject"`
	Resource string `json:"resource"`
	Action   string `json:"action"`
	Context  string `json:"context,omitempty"`
	Scope    string `json:"scope,omitempty"`
}

type Declarations

type Declarations struct {
	Resources []ResourceDeclaration `json:"resources,omitempty"`
}

type Model

type Model struct {
	Provider string   `json:"provider,omitempty"`
	Modes    []string `json:"modes,omitempty"`
}

type Options

type Options struct {
	BasePath          string
	PrincipalResolver PrincipalResolver
	Authorizer        Authorizer
	Provider          Provider
}

type Policy

type Policy struct {
	ID       string `json:"id"`
	Resource string `json:"resource,omitempty"`
	Action   string `json:"action,omitempty"`
	Effect   string `json:"effect,omitempty"`
}

type PolicyRule

type PolicyRule struct {
	Subject string `json:"subject"`
	Object  string `json:"object"`
	Action  string `json:"action"`
}

type Principal

type Principal struct {
	Subject string
	Email   string
	Role    string
}

type PrincipalResolver

type PrincipalResolver interface {
	CurrentPrincipal(*http.Request) (Principal, bool)
}

type ProjectionInputs

type ProjectionInputs struct {
	Subject  string   `json:"subject,omitempty"`
	Contexts []string `json:"contexts,omitempty"`
}

type RelationCheck

type RelationCheck struct {
	Subject  string `json:"subject"`
	Relation string `json:"relation"`
	Object   string `json:"object"`
}

type RelationTuple

type RelationTuple struct {
	Subject  string `json:"subject"`
	Relation string `json:"relation"`
	Object   string `json:"object"`
}

type ResourceDeclaration

type ResourceDeclaration struct {
	Name    string   `json:"name"`
	Actions []string `json:"actions,omitempty"`
}

type Role

type Role struct {
	Name   string   `json:"name"`
	Scopes []string `json:"scopes,omitempty"`
}

type RoleAssignment

type RoleAssignment struct {
	User    string   `json:"user"`
	Role    string   `json:"role"`
	Context string   `json:"context,omitempty"`
	Scopes  []string `json:"scopes,omitempty"`
}

type Route

type Route struct {
	Name     string
	Method   string
	Path     string
	Resource string
	Action   string
}

type RouteCatalog

type RouteCatalog struct {
	ByPath map[string]Route
}

func DefaultRoutes

func DefaultRoutes() RouteCatalog

func RoutesForBasePath

func RoutesForBasePath(basePath string) RouteCatalog

type Scope

type Scope struct {
	Name     string `json:"name"`
	Context  string `json:"context,omitempty"`
	Resource string `json:"resource,omitempty"`
	Action   string `json:"action,omitempty"`
}

Jump to

Keyboard shortcuts

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