test

package
v0.8.13 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIdentityType = api.IdentityType_IDENTITY_TYPE_SUB

	DefaultUsername = "username"
	DefaultPolicyID = "policyId"
	DefaultDecision = "allowed"

	OverridePolicyPath = "override.policy.path"
)

Variables

This section is empty.

Functions

func Decision

func Decision(authorize bool) *authorizer.Decision

func Policy

func Policy(path string) middleware.Policy

func Request

func Request(o ...Override) *authorizer.IsRequest

Types

type Case added in v0.0.8

type Case struct {
	Name   string
	Client *mock.Authorizer
}

func NewTest

func NewTest(t *testing.T, name string, options *Options) *Case

type Options added in v0.0.8

type Options struct {
	ExpectedRequest *authorizer.IsRequest
	Reject          bool
	PolicyPath      string
}

func (*Options) HasPolicy added in v0.0.8

func (opts *Options) HasPolicy() bool

type Override

type Override func(*Overrides)

func Identity

func Identity(id string) Override

func IdentityType

func IdentityType(idtype api.IdentityType) Override

func PolicyID

func PolicyID(id string) Override

func PolicyPath

func PolicyPath(path string) Override

func Resource

func Resource(resource *structpb.Struct) Override

func WithDecision

func WithDecision(decision string) Override

type Overrides

type Overrides struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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