Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Diagnostic
- type Privilege
- type Service
- func (s *Service) Authenticate(username, password string) (auth.User, error)
- func (s *Service) Close() error
- func (s *Service) CreateUser(username, password string, admin bool, privileges map[string][]Privilege) (User, error)
- func (s *Service) DeleteUser(username string)
- func (s *Service) GrantSubscriptionAccess(token, db, rp string) error
- func (s *Service) ListSubscriptionTokens() ([]string, error)
- func (s *Service) Open() error
- func (s *Service) RevokeSubscriptionAccess(token string) error
- func (s *Service) SubscriptionUser(token string) (auth.User, error)
- func (s *Service) User(username string) (auth.User, error)
- type ServiceOption
- type User
- type UserCache
- type UserDAO
Constants ¶
View Source
const ( // Default cost is 10 DefaultBcryptCost = bcrypt.DefaultCost DefaultCacheExpiration = 10 * time.Minute )
Variables ¶
View Source
var ( ErrUserExists = errors.New("user already exists") ErrNoUserExists = errors.New("no user exists") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Enabled bool `toml:"enabled"`
CacheExpiration toml.Duration `toml:"cache-expiration"`
BcryptCost int `toml:"bcrypt-cost"`
MetaAddr string `toml:"meta-addr"`
MetaUsername string `toml:"meta-username"`
MetaPassword string `toml:"meta-password"`
MetaUseTLS bool `toml:"meta-use-tls"`
MetaCA string `toml:"meta-ca"`
MetaCert string `toml:"meta-cert"`
MetaKey string `toml:"meta-key"`
MetaInsecureSkipVerify bool `toml:"meta-insecure-skip-verify"`
}
func NewDisabledConfig ¶
func NewDisabledConfig() Config
func NewEnabledConfig ¶
func NewEnabledConfig() Config
type Diagnostic ¶
type Service ¶
type Service struct {
StorageService interface {
Store(namespace string) storage.Interface
}
HTTPDService interface {
AddRoutes([]httpd.Route) error
DelRoutes([]httpd.Route)
}
// contains filtered or unexported fields
}
func NewService ¶
func NewService(c Config, d Diagnostic, opts ...interface{}) (*Service, error)
func (*Service) Authenticate ¶
func (*Service) CreateUser ¶
func (*Service) DeleteUser ¶
func (*Service) GrantSubscriptionAccess ¶
func (*Service) ListSubscriptionTokens ¶
func (*Service) RevokeSubscriptionAccess ¶
func (*Service) SubscriptionUser ¶
Return a user based on the subscription token
type ServiceOption ¶ added in v1.6.6
type User ¶
A user with is set of permissions
func (User) MarshalBinary ¶
func (*User) UnmarshalBinary ¶
type UserDAO ¶
type UserDAO interface {
// Retrieve a user
Get(username string) (User, error)
// Create a user.
// ErrUserExists is returned if a user already exists with the same username.
Create(u User) error
// Replace an existing user.
// ErrNoUserExists is returned if the user does not exist.
Replace(u User) error
// Delete a user.
// It is not an error to delete an non-existent user.
Delete(username string) error
// List users matching a pattern on username.
// The pattern is shell/glob matching see https://golang.org/pkg/path/#Match
// Offset and limit are pagination bounds. Offset is inclusive starting at index 0.
// More results may exist while the number of returned items is equal to limit.
List(pattern string, offset, limit int) ([]User, error)
}
Click to show internal directories.
Click to hide internal directories.