Documentation ¶
Index ¶
- Constants
- Variables
- func Describe(ctx context.Context) string
- func Do(ctx context.Context, fn func(ctx context.Context), opts ...Options) error
- func FxManagerCustomizer(constructor interface{}) fx.Annotated
- func Use()
- type ManagerCustomizer
- type ManagerCustomizerFunc
- type ManagerOptions
- type Options
- type Scope
- type ScopeManager
- type ScopeOperationHook
Constants ¶
View Source
const (
FxGroup = "security-scope"
)
Variables ¶
View Source
var ( ErrNotInitialized = fmt.Errorf("security scope manager is not initialied yet") ErrMissingDefaultSysAccount = fmt.Errorf("unable to switch security scope: default system account is not configured") ErrMissingUser = fmt.Errorf("unable to switch security scope: either username or user ID is required when not using default system account") ErrNotCurrentlyAuthenticated = fmt.Errorf("unable to switch security scope without system account: current context is not authenticated") ErrUserIdAndUsernameExclusive = fmt.Errorf("invalid security scope option: username and user ID are exclusive") ErrTenantIdAndNameExclusive = fmt.Errorf("invalid security scope option: tenant name and tenant ID are exclusive") )
Functions ¶
func Do ¶
Do invoke given function in a security scope specified by Options e.g.:
scope.Do(ctx, func(ctx context.Context) { // do something with ctx }, scope.WithUsername("a-user"), scope.UseSystemAccount())
func FxManagerCustomizer ¶ added in v0.14.0
FxManagerCustomizer takes providers of ManagerCustomizer and wrap them with FxGroup
Types ¶
type ManagerCustomizer ¶
type ManagerCustomizer interface {
Customize() []ManagerOptions
}
type ManagerCustomizerFunc ¶
type ManagerCustomizerFunc func() []ManagerOptions
func (ManagerCustomizerFunc) Customize ¶
func (fn ManagerCustomizerFunc) Customize() []ManagerOptions
type ManagerOptions ¶
type ManagerOptions func(opt *managerOption)
func AfterEndHook ¶
func AfterEndHook(hook ScopeOperationHook) ManagerOptions
func BeforeStartHook ¶
func BeforeStartHook(hook ScopeOperationHook) ManagerOptions
type Options ¶
type Options func(*Scope)
func UseSystemAccount ¶
func UseSystemAccount() Options
func WithTenantExternalId ¶
func WithTenantId ¶
func WithUserId ¶
func WithUsername ¶
type ScopeManager ¶
Click to show internal directories.
Click to hide internal directories.