security

package
v0.0.0-...-8f3712b Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package security contains implementation of an API security validators.

Index

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.

func (*ErrIncorrectHeader) Error

func (*ErrIncorrectHeader) Error() string

Error formats output.

type ErrNoHeader

type ErrNoHeader struct {
}

ErrNoHeader defines absence of basic auth header.

func (*ErrNoHeader) Error

func (*ErrNoHeader) Error() string

Error formats output.

type ErrUserNotFound

type ErrUserNotFound struct {
	User string
}

ErrUserNotFound defines unknown user.

func (*ErrUserNotFound) Error

func (e *ErrUserNotFound) Error() string

Error formats output.

Jump to

Keyboard shortcuts

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