authz

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Authorized = "Authorized"
View Source
const NotAuthorized = "Not Authorized"

Variables

This section is empty.

Functions

func AuthorizeHandler added in v0.11.0

func AuthorizeHandler(svc CheckService, w http.ResponseWriter, r *http.Request) error

Types

type CheckManySpec

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

func (CheckManySpec) ToMap

func (spec CheckManySpec) ToMap() map[string]interface{}

type CheckResultSpec

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

type CheckService

type CheckService struct {
	service.BaseService
	WarrantRepository warrant.WarrantRepository
	EventSvc          event.EventService
	CtxSvc            wntContext.ContextService
	ObjectTypeSvc     objecttype.ObjectTypeService
}

func NewService

func NewService(env service.Env, warrantRepo warrant.WarrantRepository, ctxSvc wntContext.ContextService, eventSvc event.EventService, objectTypeSvc objecttype.ObjectTypeService) CheckService

func (CheckService) Check

func (svc CheckService) Check(ctx context.Context, authInfo *service.AuthInfo, warrantCheck CheckSpec) (match bool, decisionPath []warrant.WarrantSpec, err 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 CheckSpec

type CheckSpec struct {
	warrant.WarrantSpec
	ConsistentRead bool `json:"consistentRead"`
	Debug          bool `json:"debug"`
}

func (CheckSpec) ToMap

func (spec CheckSpec) ToMap() map[string]interface{}

type SessionCheckManySpec added in v0.7.0

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

Jump to

Keyboard shortcuts

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