policy

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 4 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" validate:"notempty"`
	Function   string    `json:"function" validate:"notempty"`
	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 transformation policy

func (*AccessPolicy) Equals added in v0.6.0

func (a *AccessPolicy) Equals(other *AccessPolicy) bool

Equals returns true if the two policies are equal, ignoring the ID field

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 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

type TransformationPolicy added in v0.6.0

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

TransformationPolicy describes a token transformation policy

func (*TransformationPolicy) Equals added in v0.6.0

Equals returns true if the two policies are equal, ignoring the ID field

Jump to

Keyboard shortcuts

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