clientsauth

package
v0.0.0-...-b33ff70 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SupportedFilters = map[string]bool{
	"id": true,
}
View Source
var SupportedSorts = map[string]bool{}

Functions

This section is empty.

Types

type ClientAuth

type ClientAuth struct {
	ID       string `json:"id" db:"id"`
	Password string `json:"password" db:"password"`
}

ClientAuth represents rport client authentication credentials.

type DatabaseProvider

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

func NewDatabaseMockProvider

func NewDatabaseMockProvider(clients []*ClientAuth, t *testing.T) *DatabaseProvider

NewDatabaseMockProvider creates a clients auth database for testing and returns the DatabaseProvider

func NewDatabaseProvider

func NewDatabaseProvider(DB *sqlx.DB, tableName string) *DatabaseProvider

func (*DatabaseProvider) Add

func (c *DatabaseProvider) Add(client *ClientAuth) (bool, error)

func (*DatabaseProvider) Delete

func (c *DatabaseProvider) Delete(id string) error

func (*DatabaseProvider) Get

func (c *DatabaseProvider) Get(id string) (*ClientAuth, error)

func (*DatabaseProvider) GetFiltered

func (c *DatabaseProvider) GetFiltered(filter *query.ListOptions) ([]*ClientAuth, int, error)

func (*DatabaseProvider) IsWriteable

func (c *DatabaseProvider) IsWriteable() bool

func (*DatabaseProvider) Source

type FileProvider

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

FileProvider is file based client provider. It is not thread save so should be surrounded by CachedProvider.

func NewFileProvider

func NewFileProvider(fileName string, cache *cache.Cache) *FileProvider

func NewMockFileProvider

func NewMockFileProvider(clients []*ClientAuth, t *testing.T) *FileProvider

NewMockFileProvider creates a clients auth file for testing and returns the FileProvider

func (*FileProvider) Add

func (c *FileProvider) Add(clientAuth *ClientAuth) (bool, error)

func (*FileProvider) CacheKey

func (c *FileProvider) CacheKey(id string) string

func (*FileProvider) Delete

func (c *FileProvider) Delete(id string) error

func (*FileProvider) Get

func (c *FileProvider) Get(id string) (*ClientAuth, error)

func (*FileProvider) GetFiltered

func (c *FileProvider) GetFiltered(filter *query.ListOptions) ([]*ClientAuth, int, error)

func (*FileProvider) IsWriteable

func (c *FileProvider) IsWriteable() bool

func (*FileProvider) SortByID

func (c *FileProvider) SortByID(a []*ClientAuth, desc bool)

func (*FileProvider) Source

func (c *FileProvider) Source() enums.ProviderSource

type Provider

type Provider interface {
	// Get returns client authentication credentials from provider or nil
	Get(id string) (*ClientAuth, error)
	// GetFiltered returns authentication credentials and total count filtered
	GetFiltered(filter *query.ListOptions) ([]*ClientAuth, int, error)
	// Add returns true if the client auth was added and false if it already exists
	Add(client *ClientAuth) (bool, error)
	// Delete returns client auth by id
	Delete(id string) error
	// IsWriteable returns true if provider is writeable
	IsWriteable() bool
	// Source returns a provider source
	Source() enums.ProviderSource
}

type SingleProvider

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

func NewSingleProvider

func NewSingleProvider(id, password string) *SingleProvider

func (*SingleProvider) Add

func (c *SingleProvider) Add(*ClientAuth) (bool, error)

func (*SingleProvider) Delete

func (c *SingleProvider) Delete(string) error

func (*SingleProvider) Get

func (c *SingleProvider) Get(id string) (*ClientAuth, error)

func (*SingleProvider) GetFiltered

func (c *SingleProvider) GetFiltered(filter *query.ListOptions) ([]*ClientAuth, int, error)

func (*SingleProvider) IsWriteable

func (c *SingleProvider) IsWriteable() bool

func (*SingleProvider) Source

func (c *SingleProvider) Source() enums.ProviderSource

Jump to

Keyboard shortcuts

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