repo

package
v0.0.0-...-6aa0337 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DataplaneName ...
	DataplaneName = "dataplane"

	// ControlplaneName ...
	ControlplaneName = "controlplane"

	// ProxyplaneName ...
	ProxyplaneName = "proxyplane"
)

Variables

This section is empty.

Functions

func NewRepoEnforcer

func NewRepoEnforcer(logger echo.Logger) (Repo, Enforcer, error)

NewRepoEnforcer creates a new RepoEnforcer

Types

type APIAuditRepo

type APIAuditRepo interface {
	CreateAPIAudit(ctx context.Context, opt *CreateAPIAuditOption) (*ent.APIAudit, error)
	QueryAPIAudits(ctx context.Context, opt *QueryAPIAuditOption) ([]*ent.APIAudit, error)
}

APIAuditRepo is a repository for APIAudit

type AuthzGroupingPolicy

type AuthzGroupingPolicy struct {
	Subject string
	Domain  string
	Group   string
}

type AuthzPolicy

type AuthzPolicy struct {
	Subject string
	Domain  string
	Object  string
	Action  string
	Effect  string
}

type AuthzRequest

type AuthzRequest struct {
	Subject string
	Domain  string
	Object  string
	Action  string
}

type CreateAPIAuditOption

type CreateAPIAuditOption struct {
	Plane            string
	HashedGrantToken *string
	Domain           *string
	HTTPMethod       *string
	HTTPPath         *string
	SentHTTPStatus   *int
}

CreateAPIAuditOption ...

type CreateFactOption

type CreateFactOption struct {
	Domain         string
	HashedValue    string
	EncryptedValue string
	Collection     string
	Key            string
	BlindIndexes   []string
	Scope          *ent.Scope
}

CreateFactOption ...

type CreateGrantOption

type CreateGrantOption struct {
	HashedGrantToken   string
	Domain             string
	Version            string
	AllowedHTTPMethods []string
	Paths              []string
}

CreateGrantOption ...

type CreateScopeOption

type CreateScopeOption struct {
	ScopeCustomID string
	Domain        string
}

CreateScopeOption ...

type Enforcer

type Enforcer interface {
	AddPolicy(AuthzPolicy) (bool, error)
	Enforce(AuthzRequest) (bool, error)
	AddGroupingPolicy(AuthzGroupingPolicy) (bool, error)
}

Enforcer is an interface that enforces the authz access e.g. Enforce(sub, dom, obj, act)

type FactRepo

type FactRepo interface {
	CreateFact(ctx context.Context, opt *CreateFactOption) (*ent.Fact, error)
	GetFact(ctx context.Context, opt *GetFactOption) (*ent.Fact, error)
	GetFactBlindIndexes(ctx context.Context, opt *GetFactBlindIndexesOption) ([]string, error)
	GetFactExactMatch(ctx context.Context, opt *GetFactSearchOption) ([]string, error)
	GetFactPartialMatch(ctx context.Context, opt *GetFactSearchOption) (f []string, err error)
	DestroyFact(ctx context.Context, opt *GetFactOption) error
}

FactRepo is a repository for Fact

type GetFactBlindIndexesOption

type GetFactBlindIndexesOption struct {
	BlindIndexes []string
}

GetFactBlindIndexesOption ...

type GetFactOption

type GetFactOption struct {
	FactID string
	Domain string
}

GetFactOption ...

type GetFactSearchOption

type GetFactSearchOption struct {
	BlindIndex  string
	Domain      string
	HashedValue string
	Collection  string
	Key         string
}

GetFactBlindIndexesOption ...

type GetScopeOption

type GetScopeOption struct {
	ScopeCustomID string
	Domain        string
}

GetScopeOption ...

type GrantRepo

type GrantRepo interface {
	CreateGrant(ctx context.Context, opt *CreateGrantOption) (*ent.Grant, error)
}

GrantRepo is a repository for Grant

type NotFoundError

type NotFoundError struct {
	Err error
}

NotFoundError ...

func (NotFoundError) Error

func (err NotFoundError) Error() string

type QueryAPIAuditOption

type QueryAPIAuditOption struct {
	Plane            *string
	HashedGrantToken *string
	Domain           *string
	HTTPMethod       *string
	HTTPPath         *string
	SentHTTPStatus   *int

	Limit     *int
	Offset    *int
	OrderBy   *string
	OrderDesc bool // default is false, which means Asc
}

QueryAPIAuditOption ...

type Repo

type Repo interface {
	FactRepo
	ScopeRepo
	GrantRepo
	APIAuditRepo

	HandleError(err error) error
	Close()
}

Repo is a set of repositories

type ScopeRepo

type ScopeRepo interface {
	CreateScope(ctx context.Context, opt *CreateScopeOption) (*ent.Scope, error)
	GetScope(ctx context.Context, opt *GetScopeOption) (*ent.Scope, error)
}

ScopeRepo is a repository for Scope

type UnauthorizedError

type UnauthorizedError struct {
	Err error
}

UnauthorizedError ...

func (UnauthorizedError) Error

func (err UnauthorizedError) Error() string

type ValidationError

type ValidationError struct {
	Err     error
	Message string
}

ValidationError ...

func (ValidationError) Error

func (err ValidationError) Error() string

Jump to

Keyboard shortcuts

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