policy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessPolicy

type AccessPolicy struct {
	ID         uuid.UUID `json:"id"`
	Name       string    `json:"name"`
	Function   string    `json:"function"`
	Parameters string    `json:"parameters"`
	Version    int       `json:"version"` // NB: this is currently emitted by the server, but not read by the server (for UI only)
}

AccessPolicy describes a token generation policy

func (AccessPolicy) Validate

func (g AccessPolicy) Validate() error

Validate implements Validateable

type AccessPolicyContext

type AccessPolicyContext struct {
	Server ServerContext `json:"server"`
	Client ClientContext `json:"client"`
}

AccessPolicyContext gets passed to the access policy's function(context, params) at resolution time

type Action

type Action string

Action identifies the reason access policy is being invoked

const (
	ActionResolve Action = "Resolve"
	ActionInspect Action = "Inspect"
	ActionLookup  Action = "Lookup"
	ActionDelete  Action = "Delete"
	ActionExecute Action = "Execute" // TODO: should this be a unique action?
)

Different reasons for running access policy

type ClientContext

type ClientContext map[string]interface{}

ClientContext is passed by the client at resolution time

type GenerationPolicy

type GenerationPolicy struct {
	ID         uuid.UUID `json:"id"`
	Name       string    `json:"name"`
	Function   string    `json:"function"`
	Parameters string    `json:"parameters"`
}

GenerationPolicy describes a token generation policy

func (GenerationPolicy) Validate

func (g GenerationPolicy) Validate() error

Validate implements Validateable

type ResolverContext

type ResolverContext struct {
	Username string `json:"username"`
}

ResolverContext contains automatic data about the authenticated user/system at resolution time

type ServerContext

type ServerContext struct {
	// TODO: add token creation time
	IPAddress string          `json:"ip_address"`
	Resolver  ResolverContext `json:"resolver"`
	Action    Action          `json:"action"`
}

ServerContext is automatically injected by the server at resolution time

Jump to

Keyboard shortcuts

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