engine

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	Evaluate(ctx context.Context, query string, env Environment) (bool, error)
}

Engine defines the granted handlers.

type Environment

type Environment struct {
	Stage    Stage     `json:"stage"`
	User     user.User `json:"user"`
	Request  Request   `json:"request"`
	Resource Resource  `json:"resource"`
}

Environment contains every data that is needed to decide if the request should pass or not

func NewEnvironmentFromPB

func NewEnvironmentFromPB(pEnv *v0.Environment) (Environment, error)

NewEnvironmentFromPB converts a PBEnvironment to Environment.

type Request

type Request struct {
	Method string `json:"method"`
	Path   string `json:"path"`
}

Request contains request information and is used as part of the evaluated environment.

type Resource

type Resource struct {
	ID   provider.ResourceId `json:"resource_id"`
	Name string              `json:"name"`
	URL  string              `json:"url"`
	Size uint64              `json:"size"`
}

Resource contains resource information and is used as part of the evaluated environment.

type Stage

type Stage string

Stage defines the used auth stage

var (
	// StagePP defines the post-processing stage
	StagePP Stage = "pp"

	// StageHTTP defines the http stage
	StageHTTP Stage = "http"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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