auth

package
v0.0.0-...-c0686e8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UNDEFINED is the undefined type which would behave the same as NOOP
	UNDEFINED = Type("")
	// NOOP would effectively disable security feature
	NOOP = Type("NOOP")
	// BASIC would use username and password for auth
	BASIC = Type("BASIC")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// AuthType is the type of auth
	AuthType Type `yaml:"auth_type"`
	// Path is the path to the config file for auth
	Path string `yaml:"path"`
}

Config is auth specific configuration

type SecurityClient

type SecurityClient interface {
	// GetToken returns the token needed by internal component
	// for communication
	GetToken() Token
}

SecurityClient is the internal client used by each of the peloton components to talk to each other. For each SecurityManager there should be a corresponding SecurityClient, which helps components communication.

type SecurityManager

type SecurityManager interface {
	// Authenticate with the token provided,
	// return User if authentication succeeds
	Authenticate(token Token) (User, error)
	// RedactToken redact token passed in by
	// removing sensitive info, so the info would
	// not be leaked into other components and get
	// leaked/logged accidentally.
	// It would be called after auth is done, before
	// passing the token to other components
	RedactToken(token Token)
}

SecurityManager includes authentication related methods

type Token

type Token interface {
	Get(k string) (string, bool)
	Del(k string)
	// Items returns all of the items in the token.
	// The returned map should not be modified, it is
	// the caller's responsibility to copy before write.
	Items() map[string]string
}

Token is used by SecurityManager to authenticate a user

type Type

type Type string

Type is the auth type used

type User

type User interface {
	// IsPermitted returns whether user can
	// access the specified procedure
	IsPermitted(procedure string) bool
}

User includes authorization related methods

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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