Documentation ¶
Index ¶
- Constants
- type Authentication
- type CacheAuthBackend
- func (b *CacheAuthBackend) AddUser(username, password string, admin bool) error
- func (b *CacheAuthBackend) GetAllUsers() (users []User, err error)
- func (b *CacheAuthBackend) GetUser(username string) (user *User, err error)
- func (b *CacheAuthBackend) InvalidateToken(token string) error
- func (b *CacheAuthBackend) IsTokenBlacklisted(token string) (bool, error)
- type User
Constants ¶
View Source
const TokenBucketName = "tokenbucket"
TokenBucketName
View Source
const UserBucketName = "authbucket"
UserBucketName - default name for BoltDB bucket that stores user info
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authentication ¶ added in v0.5.17
type Authentication interface { AddUser(username, password string, admin bool) (err error) GetUser(username string) (user *User, err error) GetAllUsers() (users []User, err error) InvalidateToken(token string) (err error) IsTokenBlacklisted(token string) (blacklisted bool, err error) }
Authentication - generic interface for authentication backend
type CacheAuthBackend ¶ added in v0.5.17
CacheAuthBackend - container to implement Cache instance with i.e. BoltDB backend for storage
func NewCacheBasedAuthBackend ¶ added in v0.5.17
func NewCacheBasedAuthBackend(tokenCache, userCache cache.Cache) *CacheAuthBackend
NewCacheBasedAuthBackend - takes two caches - one for token and one for users
func (*CacheAuthBackend) AddUser ¶ added in v0.5.17
func (b *CacheAuthBackend) AddUser(username, password string, admin bool) error
AddUser - adds user with provided username, password and admin parameters
func (*CacheAuthBackend) GetAllUsers ¶ added in v0.5.17
func (b *CacheAuthBackend) GetAllUsers() (users []User, err error)
func (*CacheAuthBackend) GetUser ¶ added in v0.5.17
func (b *CacheAuthBackend) GetUser(username string) (user *User, err error)
func (*CacheAuthBackend) InvalidateToken ¶ added in v0.5.17
func (b *CacheAuthBackend) InvalidateToken(token string) error
func (*CacheAuthBackend) IsTokenBlacklisted ¶ added in v0.5.17
func (b *CacheAuthBackend) IsTokenBlacklisted(token string) (bool, error)
IsTokenBlacklisted - checks if token is blacklisted.
Click to show internal directories.
Click to hide internal directories.