auth

package
v0.0.0-...-d8099e1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CredentialCache = Cache{
	// contains filtered or unexported fields
}

CredentialCache represents the cached users/credentials where key is `username`

View Source
var CurrentProcessMutex = sync.RWMutex{}

CurrentProcessMutex to stop concurrent writes on map

View Source
var UserToPasswordCache = make(map[string]string)

UserToPasswordCache represents a map of bcrypt validated users

Functions

func BasicAuth

func BasicAuth() middleware.Middleware

BasicAuth middleware authenticates each requests against the basic auth credentials.

func ClearLocalUser

func ClearLocalUser(username string)

deletes the user record from local state

func ClearPassword

func ClearPassword(username string)

ClearPassword clears the password in the cache

func GetCachedCredential

func GetCachedCredential(username string) (credential.AuthCredential, bool)

GetCachedCredential returns the cached credential

func GetCachedCredentials

func GetCachedCredentials() []credential.AuthCredential

GetCachedCredentials returns the cached credentials

func IsPasswordExist

func IsPasswordExist(username string, password string) bool

IsPasswordExist checks whether the password in the cache or not

func RemoveCredentialFromCache

func RemoveCredentialFromCache(username string)

RemoveCredentialFromCache removes the credential from the cache

func SaveCredentialToCache

func SaveCredentialToCache(username string, c credential.AuthCredential)

SaveCredentialToCache saves the credential to the cache

func SavePassword

func SavePassword(username string, password string)

SavePassword saved the password in the cache

Types

type Auth

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

func Instance

func Instance() *Auth

Instance returns the singleton instance of the auth plugin. Instance should be the only way (both within or outside the package) to fetch the instance of the plugin, in order to avoid stateless duplicates.

func (*Auth) ESMiddleware

func (a *Auth) ESMiddleware() []middleware.Middleware

Default empty middleware array function

func (*Auth) InitFunc

func (a *Auth) InitFunc() error

InitFunc initializes the dao, i.e. elasticsearch client, and should be executed only once in the lifetime of the plugin.

func (*Auth) Name

func (a *Auth) Name() string

Name returns the name of the plugin: auth

func (*Auth) RSMiddleware

func (a *Auth) RSMiddleware() []middleware.Middleware

Default empty middleware array function

func (*Auth) Routes

func (a *Auth) Routes() []plugins.Route

Routes returns an empty slices since the plugin solely acts as a middleware.

type Cache

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

Cache represents the struct for CredentialCache

type CacheSyncScript

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

func (CacheSyncScript) Index

func (s CacheSyncScript) Index() string

func (CacheSyncScript) PluginName

func (s CacheSyncScript) PluginName() string

func (CacheSyncScript) SetCache

func (s CacheSyncScript) SetCache(response *elastic.SearchResult) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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