authorizer

package
v0.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	GLOBAL_DEFAULT_ORG_ID = "_GlobalDefaultOrg"

	METADATA_KEY_ORGID            = "orgid"
	METADATA_KEY_ROLE             = "role"
	METADATA_ROLE_SERVICE_ADMIN   = "service_admin"
	METADATA_ROLE_SERVICE_AUDITOR = "service_auditor"
	METADATA_ROLE_ADMIN           = "admin"   // can be tenant_admin, *_admin
	METADATA_ROLE_AUDITOR         = "auditor" // can be tenant_auditor, *_auditor
)
View Source
const (
	INSTANCE_ID = ContextKey("multiinstance.id")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer interface {
	Tenancer
	Configure(tableName string, roleMapping map[string]dbrole.DbRole)
	GetAuthContext(orgId string, roles ...string) context.Context
	GetDefaultOrgAdminContext() context.Context
	GetMatchingDbRole(ctx context.Context, tableNames ...string) (dbrole.DbRole, error)
}

Authorizer Interface defines the methods required for datastore to restrict access based on roles configured in context.

type ContextKey added in v0.0.5

type ContextKey string

type Instancer added in v0.0.5

type Instancer interface {
	GetInstanceId(ctx context.Context) (string, error)
	WithInstanceId(ctx context.Context, instanceId string) context.Context
}

type MetadataBasedAuthorizer

type MetadataBasedAuthorizer struct{}

func (MetadataBasedAuthorizer) Configure

func (s MetadataBasedAuthorizer) Configure(_ string, _ map[string]dbrole.DbRole)

func (MetadataBasedAuthorizer) GetAuthContext

func (s MetadataBasedAuthorizer) GetAuthContext(orgId string, roles ...string) context.Context

func (MetadataBasedAuthorizer) GetDefaultOrgAdminContext

func (s MetadataBasedAuthorizer) GetDefaultOrgAdminContext() context.Context

func (MetadataBasedAuthorizer) GetMatchingDbRole

func (s MetadataBasedAuthorizer) GetMatchingDbRole(ctx context.Context, _ ...string) (dbrole.DbRole, error)

func (MetadataBasedAuthorizer) GetOrgFromContext

func (s MetadataBasedAuthorizer) GetOrgFromContext(ctx context.Context) (string, error)

type SimpleInstancer added in v0.0.5

type SimpleInstancer struct{}

func (SimpleInstancer) GetInstanceId added in v0.0.5

func (s SimpleInstancer) GetInstanceId(ctx context.Context) (string, error)

func (SimpleInstancer) WithInstanceId added in v0.0.5

func (s SimpleInstancer) WithInstanceId(ctx context.Context, instanceId string) context.Context

type Tenancer added in v0.0.5

type Tenancer interface {
	GetOrgFromContext(ctx context.Context) (string, error)
}

Jump to

Keyboard shortcuts

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