Documentation ¶
Overview ¶
Package security contains implementation of an API security validators.
Index ¶
- func NewSecurityProvider(ctor *ConstructSecurityProvider) providers.ISecurityProvider
- type AuthenticatedUser
- func (u *AuthenticatedUser) DeviceCommand(deviceID string) bool
- func (u *AuthenticatedUser) DeviceGet(deviceID string) bool
- func (u *AuthenticatedUser) DeviceHistory(deviceID string) bool
- func (u *AuthenticatedUser) Entities() bool
- func (u *AuthenticatedUser) Logs() bool
- func (u *AuthenticatedUser) Name() string
- func (u *AuthenticatedUser) TriggerGet(triggerID string) bool
- func (u *AuthenticatedUser) TriggerHistory(triggerID string) bool
- func (u *AuthenticatedUser) Workers() bool
- type ConstructSecurityProvider
- type ErrCorruptedHeader
- type ErrIncorrectHeader
- type ErrNoHeader
- type ErrUserNotFound
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSecurityProvider ¶
func NewSecurityProvider(ctor *ConstructSecurityProvider) providers.ISecurityProvider
NewSecurityProvider constructs new security provider.
Types ¶
type AuthenticatedUser ¶
type AuthenticatedUser struct { Username string Rules map[providers.SecSystem][]*providers.BakedRule }
AuthenticatedUser has data with authenticated user, returned by user store.
func (*AuthenticatedUser) DeviceCommand ¶
func (u *AuthenticatedUser) DeviceCommand(deviceID string) bool
DeviceCommand verifies whether user is allowed to issue a command to a device.
func (*AuthenticatedUser) DeviceGet ¶
func (u *AuthenticatedUser) DeviceGet(deviceID string) bool
DeviceGet verifies whether user is allowed to get a device.
func (*AuthenticatedUser) DeviceHistory ¶
func (u *AuthenticatedUser) DeviceHistory(deviceID string) bool
DeviceHistory verifies whether user is allowed to query a device history.
func (*AuthenticatedUser) Entities ¶
func (u *AuthenticatedUser) Entities() bool
Entities verifies whether user is allowed to get config entities.
func (*AuthenticatedUser) Logs ¶
func (u *AuthenticatedUser) Logs() bool
Logs verifies whether user is allowed to query logs.
func (*AuthenticatedUser) Name ¶
func (u *AuthenticatedUser) Name() string
Name returns the user name.
func (*AuthenticatedUser) TriggerGet ¶
func (u *AuthenticatedUser) TriggerGet(triggerID string) bool
TriggerGet get verifies whether user is allowed to get a trigger.
func (*AuthenticatedUser) TriggerHistory ¶
func (u *AuthenticatedUser) TriggerHistory(triggerID string) bool
TriggerHistory verifies whether user is allowed to query a device history.
func (*AuthenticatedUser) Workers ¶
func (u *AuthenticatedUser) Workers() bool
Workers verifies whether user is allowed to get workers.
type ConstructSecurityProvider ¶
type ConstructSecurityProvider struct { PluginLogger common.ILoggerProvider Secret common.ISecretProvider Loader providers.IPluginLoaderProvider Roles []*providers.SecRole UserRawConfig []byte UserProvider string }
ConstructSecurityProvider has all data required for a new security provider.
type ErrCorruptedHeader ¶
type ErrCorruptedHeader struct {
Header string
}
ErrCorruptedHeader defines corrupted basic auth header.
func (*ErrCorruptedHeader) Error ¶
func (e *ErrCorruptedHeader) Error() string
Error formats output.
type ErrIncorrectHeader ¶
type ErrIncorrectHeader struct { }
ErrIncorrectHeader defines incorrect basic auth header.
type ErrUserNotFound ¶
type ErrUserNotFound struct {
User string
}
ErrUserNotFound defines unknown user.