authz

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Authorized = "Authorized"
View Source
const (
	MaxWarrants = 10000
)
View Source
const NotAuthorized = "Not Authorized"

Variables

This section is empty.

Functions

func NewPipeline added in v0.31.0

func NewPipeline(maxServiceConcurrency int, maxSubtaskConcurrency int) *pipeline

Types

type CheckContextFunc added in v0.32.2

type CheckContextFunc func(ctx context.Context) (context.Context, error)

type CheckManySpec

type CheckManySpec struct {
	Op       string                `json:"op"`
	Warrants []CheckWarrantSpec    `json:"warrants" validate:"min=1,dive"`
	Context  warrant.PolicyContext `json:"context"`
	Debug    bool                  `json:"debug"`
}

type CheckResultSpec

type CheckResultSpec struct {
	Code           int64                            `json:"code,omitempty"`
	Result         string                           `json:"result"`
	IsImplicit     bool                             `json:"isImplicit"`
	ProcessingTime int64                            `json:"processingTime,omitempty"`
	DecisionPath   map[string][]warrant.WarrantSpec `json:"decisionPath,omitempty"`
}

type CheckService

type CheckService struct {
	service.BaseService
	// contains filtered or unexported fields
}

func NewService

func NewService(env service.Env, warrantSvc warrant.Service, objectTypeSvc objecttype.Service, checkConfig *config.CheckConfig, checkContext CheckContextFunc) *CheckService

func (CheckService) Check

func (svc CheckService) Check(ctx context.Context, authInfo *service.AuthInfo, warrantCheck CheckSpec) (bool, []warrant.WarrantSpec, bool, error)

Check returns true if the subject has a warrant (explicitly or implicitly) for given objectType:objectId#relation and context.

func (CheckService) CheckMany

func (svc CheckService) CheckMany(ctx context.Context, authInfo *service.AuthInfo, warrantCheck *CheckManySpec) (*CheckResultSpec, error)

func (CheckService) Routes added in v0.8.0

func (svc CheckService) Routes() ([]service.Route, error)

type CheckSessionWarrantSpec added in v0.18.0

type CheckSessionWarrantSpec struct {
	ObjectType string                `json:"objectType" validate:"required,valid_object_type"`
	ObjectId   string                `json:"objectId" validate:"required,valid_object_id"`
	Relation   string                `json:"relation" validate:"required,valid_relation"`
	Context    warrant.PolicyContext `json:"context"`
}

type CheckSpec

type CheckSpec struct {
	CheckWarrantSpec
	Debug bool `json:"debug" validate:"boolean"`
}

type CheckWarrantSpec added in v0.18.0

type CheckWarrantSpec struct {
	ObjectType string                `json:"objectType" validate:"required,valid_object_type"`
	ObjectId   string                `json:"objectId" validate:"required,valid_object_id"`
	Relation   string                `json:"relation" validate:"required,valid_relation"`
	Subject    *warrant.SubjectSpec  `json:"subject" validate:"required"`
	Context    warrant.PolicyContext `json:"context"`
}

func (CheckWarrantSpec) String added in v0.18.0

func (spec CheckWarrantSpec) String() string

type SessionCheckManySpec added in v0.7.0

type SessionCheckManySpec struct {
	Op       string                    `json:"op"`
	Warrants []CheckSessionWarrantSpec `json:"warrants" validate:"min=1,dive"`
	Context  warrant.PolicyContext     `json:"context"`
	Debug    bool                      `json:"debug"`
}

Jump to

Keyboard shortcuts

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