azchecker

package
v0.0.0-...-ae65bb6 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdminRelation = authz.AdminRelation
View Source
var CanCreateFeed = authz.CanCreateFeed
View Source
var CanCreateFeedVersion = authz.CanCreateFeedVersion
View Source
var CanCreateOrg = authz.CanCreateOrg
View Source
var CanDeleteFeed = authz.CanDeleteFeed
View Source
var CanDeleteFeedVersion = authz.CanDeleteFeedVersion
View Source
var CanDeleteOrg = authz.CanDeleteOrg
View Source
var CanEdit = authz.CanEdit
View Source
var CanEditMembers = authz.CanEditMembers
View Source
var CanSetGroup = authz.CanSetGroup
View Source
var CanSetTenant = authz.CanSetTenant
View Source
var CanView = authz.CanView
View Source
var EditorRelation = authz.EditorRelation
View Source
var ErrUnauthorized = authz.ErrUnauthorized
View Source
var FeedType = authz.FeedType
View Source
var FeedVersionType = authz.FeedVersionType
View Source
var GroupType = authz.GroupType
View Source
var ManagerRelation = authz.ManagerRelation
View Source
var MemberRelation = authz.MemberRelation
View Source
var ParentRelation = authz.ParentRelation
View Source
var TenantType = authz.TenantType
View Source
var UserType = authz.UserType
View Source
var ViewerRelation = authz.ViewerRelation

Functions

func NewServer

func NewServer(checker authz.CheckerServer) (http.Handler, error)

Types

type Action

type Action = authz.Action

type Checker

type Checker struct {
	authz.UnsafeCheckerServer
	// contains filtered or unexported fields
}

func NewChecker

func NewChecker(n UserProvider, p FGAProvider, db sqlx.Ext) *Checker

func NewCheckerFromConfig

func NewCheckerFromConfig(ctx context.Context, cfg CheckerConfig, db sqlx.Ext) (*Checker, error)

func (*Checker) CheckGlobalAdmin

func (c *Checker) CheckGlobalAdmin(ctx context.Context) (bool, error)

func (*Checker) Feed

func (*Checker) FeedList

func (*Checker) FeedPermissions

func (c *Checker) FeedPermissions(ctx context.Context, req *authz.FeedRequest) (*authz.FeedPermissionsResponse, error)

func (*Checker) FeedSetGroup

func (*Checker) FeedVersion

func (*Checker) FeedVersionList

func (*Checker) FeedVersionPermissions

func (c *Checker) FeedVersionPermissions(ctx context.Context, req *authz.FeedVersionRequest) (*authz.FeedVersionPermissionsResponse, error)

func (*Checker) Group

func (*Checker) GroupAddPermission

func (*Checker) GroupList

func (*Checker) GroupPermissions

func (c *Checker) GroupPermissions(ctx context.Context, req *authz.GroupRequest) (*authz.GroupPermissionsResponse, error)

func (*Checker) GroupRemovePermission

func (c *Checker) GroupRemovePermission(ctx context.Context, req *authz.GroupModifyPermissionRequest) (*authz.GroupSaveResponse, error)

func (*Checker) GroupSave

func (*Checker) GroupSetTenant

func (*Checker) Me

func (c *Checker) Me(ctx context.Context, req *authz.MeRequest) (*authz.MeResponse, error)

func (*Checker) Tenant

func (*Checker) TenantAddPermission

func (*Checker) TenantCreate

func (*Checker) TenantCreateGroup

func (c *Checker) TenantCreateGroup(ctx context.Context, req *authz.TenantCreateGroupRequest) (*authz.GroupSaveResponse, error)

func (*Checker) TenantList

func (*Checker) TenantPermissions

func (c *Checker) TenantPermissions(ctx context.Context, req *authz.TenantRequest) (*authz.TenantPermissionsResponse, error)

func (*Checker) TenantRemovePermission

func (c *Checker) TenantRemovePermission(ctx context.Context, req *authz.TenantModifyPermissionRequest) (*authz.TenantSaveResponse, error)

func (*Checker) TenantSave

func (*Checker) User

func (*Checker) UserList

type CheckerConfig

type CheckerConfig struct {
	Auth0Domain       string
	Auth0ClientID     string
	Auth0ClientSecret string
	Auth0Connection   string
	FGAStoreID        string
	FGAModelID        string
	FGAEndpoint       string
	FGALoadModelFile  string
	FGALoadTestData   []TupleKey
	GlobalAdmin       string
}

type EntityKey

type EntityKey = authz.EntityKey

type FGAProvider

type FGAProvider interface {
	Check(context.Context, TupleKey, ...TupleKey) (bool, error)
	ListObjects(context.Context, TupleKey) ([]TupleKey, error)
	GetObjectTuples(context.Context, TupleKey) ([]TupleKey, error)
	WriteTuple(context.Context, TupleKey) error
	SetExclusiveSubjectRelation(context.Context, TupleKey, ...Relation) error
	SetExclusiveRelation(context.Context, TupleKey) error
	DeleteTuple(context.Context, TupleKey) error
}

type MockFGAClient

type MockFGAClient struct{}

func NewMockFGAClient

func NewMockFGAClient() *MockFGAClient

func (*MockFGAClient) Check

func (*MockFGAClient) DeleteTuple

func (c *MockFGAClient) DeleteTuple(context.Context, TupleKey) error

func (*MockFGAClient) GetObjectTuples

func (c *MockFGAClient) GetObjectTuples(context.Context, TupleKey) ([]TupleKey, error)

func (*MockFGAClient) ListObjects

func (c *MockFGAClient) ListObjects(context.Context, TupleKey) ([]TupleKey, error)

func (*MockFGAClient) SetExclusiveRelation

func (c *MockFGAClient) SetExclusiveRelation(context.Context, TupleKey) error

func (*MockFGAClient) SetExclusiveSubjectRelation

func (c *MockFGAClient) SetExclusiveSubjectRelation(context.Context, TupleKey, ...Relation) error

func (*MockFGAClient) WriteTuple

func (c *MockFGAClient) WriteTuple(context.Context, TupleKey) error

type MockUserProvider

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

func NewMockUserProvider

func NewMockUserProvider() *MockUserProvider

func (*MockUserProvider) AddUser

func (c *MockUserProvider) AddUser(key string, u authn.User)

func (*MockUserProvider) UserByID

func (c *MockUserProvider) UserByID(ctx context.Context, id string) (authn.User, error)

func (*MockUserProvider) Users

func (c *MockUserProvider) Users(ctx context.Context, userQuery string) ([]authn.User, error)

type ObjectType

type ObjectType = authz.ObjectType

type Relation

type Relation = authz.Relation

type TupleKey

type TupleKey = authz.TupleKey

type UserProvider

type UserProvider interface {
	Users(context.Context, string) ([]authn.User, error)
	UserByID(context.Context, string) (authn.User, error)
}

Jump to

Keyboard shortcuts

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