repo

package
v0.0.0-...-b7d53eb Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 24 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
	Scope          *ent.Scope
	FactType       *ent.FactType
}

CreateFactOption ...

type CreateFactTypeOption

type CreateFactTypeOption struct {
	FactTypeSlug       string
	FactTypeValidation string
	BuiltIn            bool
}

CreateFactTypeOption ...

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

FactRepo is a repository for Fact

type FactTypeRepo

type FactTypeRepo interface {
	CreateFactType(ctx context.Context, opt *CreateFactTypeOption) (*ent.FactType, error)
	GetFactTypeBySlug(ctx context.Context, slug string) (*ent.FactType, error)
}

FactTypeRepo is a repository for FactType

type GetFactOption

type GetFactOption struct {
	FactID string
	Domain string
}

GetFactOption ...

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