auth

package
v0.0.201 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultGroupMetrics = NewGroupMetrics("xatu_event_ingester")
)

Functions

func ComputeClientName

func ComputeClientName(user, group, clientName, salt string) string

Types

type Authorization

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

func NewAuthorization

func NewAuthorization(log logrus.FieldLogger, config AuthorizationConfig) (*Authorization, error)

func (*Authorization) FilterAndRedactEvents

func (a *Authorization) FilterAndRedactEvents(user *User, group *Group, events []*xatu.DecoratedEvent) ([]*xatu.DecoratedEvent, error)

func (*Authorization) FilterEvents

func (a *Authorization) FilterEvents(user *User, group *Group, events []*xatu.DecoratedEvent) ([]*xatu.DecoratedEvent, error)

func (*Authorization) GetUserAndGroup

func (a *Authorization) GetUserAndGroup(username string) (*User, *Group, error)

func (*Authorization) IsAuthorized

func (a *Authorization) IsAuthorized(token string) (string, error)

func (*Authorization) IsAuthorizedBasic

func (a *Authorization) IsAuthorizedBasic(username, password string) (bool, error)

func (*Authorization) RedactEvents

func (a *Authorization) RedactEvents(group *Group, events []*xatu.DecoratedEvent) ([]*xatu.DecoratedEvent, error)

func (*Authorization) Start

func (a *Authorization) Start(ctx context.Context) error

type AuthorizationConfig

type AuthorizationConfig struct {
	Enabled bool

	Groups GroupsConfig
}

func (*AuthorizationConfig) Validate

func (a *AuthorizationConfig) Validate() error

type Group

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

func NewGroup

func NewGroup(name string, c GroupConfig) (*Group, error)

func (*Group) ApplyFilter

func (g *Group) ApplyFilter(events []*xatu.DecoratedEvent) ([]*xatu.DecoratedEvent, error)

func (*Group) ApplyRedacter

func (g *Group) ApplyRedacter(events []*xatu.DecoratedEvent) ([]*xatu.DecoratedEvent, error)

func (*Group) ComputeClientName

func (g *Group) ComputeClientName(user, salt, clientName string) string

func (*Group) EventFilter

func (g *Group) EventFilter() xatu.EventFilter

func (*Group) Name

func (g *Group) Name() string

func (*Group) ShouldObscureClientName

func (g *Group) ShouldObscureClientName() bool

func (*Group) Start

func (g *Group) Start(ctx context.Context)

func (*Group) Users

func (g *Group) Users() *Users

func (*Group) ValidUser

func (g *Group) ValidUser(username, password string) bool

type GroupConfig

type GroupConfig struct {
	Users              UsersConfig
	EventFilter        *xatu.EventFilterConfig `yaml:"eventFilter"`
	Redacter           *xatu.RedacterConfig    `yaml:"redacter"`
	ObscureClientNames bool                    `yaml:"obscureClientNames"`
}

func (*GroupConfig) Validate

func (g *GroupConfig) Validate() error

type GroupMetrics

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

func NewGroupMetrics

func NewGroupMetrics(namespace string) *GroupMetrics

func (*GroupMetrics) IncFieldsRedacted

func (m *GroupMetrics) IncFieldsRedacted(group, path string)

type Groups

type Groups map[string]*Group

type GroupsConfig

type GroupsConfig map[string]GroupConfig

type User

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

func NewUser

func NewUser(username string, u UserConfig) (*User, error)

func (*User) ApplyFilter

func (u *User) ApplyFilter(events []*xatu.DecoratedEvent) ([]*xatu.DecoratedEvent, error)

func (*User) Password

func (u *User) Password() string

func (*User) Username

func (u *User) Username() string

func (*User) ValidClientName

func (u *User) ValidClientName(clientName string) bool

type UserConfig

type UserConfig struct {
	Password    string                  `yaml:"password"`
	EventFilter *xatu.EventFilterConfig `yaml:"eventFilter"`
}

func (*UserConfig) Validate

func (u *UserConfig) Validate() error

type Users

type Users map[string]*User

func (*Users) GetUser

func (u *Users) GetUser(username string) (*User, bool)

func (*Users) Usernames

func (u *Users) Usernames() []string

func (*Users) ValidUser

func (u *Users) ValidUser(username, password string) bool

type UsersConfig

type UsersConfig map[string]UserConfig

Jump to

Keyboard shortcuts

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