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 ¶
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 ¶
CacheAuthBackend - container to implement Cache instance with i.e. BoltDB backend for storage
func NewCacheBasedAuthBackend ¶
func NewCacheBasedAuthBackend(tokenCache, userCache cache.Cache) *CacheAuthBackend
NewCacheBasedAuthBackend - takes two caches - one for token and one for users
func (*CacheAuthBackend) AddUser ¶
func (b *CacheAuthBackend) AddUser(username, password string, admin bool) error
AddUser - adds user with provided username, password and admin parameters
func (*CacheAuthBackend) GetAllUsers ¶
func (b *CacheAuthBackend) GetAllUsers() (users []User, err error)
func (*CacheAuthBackend) GetUser ¶
func (b *CacheAuthBackend) GetUser(username string) (user *User, err error)
func (*CacheAuthBackend) InvalidateToken ¶
func (b *CacheAuthBackend) InvalidateToken(token string) error
func (*CacheAuthBackend) IsTokenBlacklisted ¶
func (b *CacheAuthBackend) IsTokenBlacklisted(token string) (bool, error)
IsTokenBlacklisted - checks if token is blacklisted.
Click to show internal directories.
Click to hide internal directories.