Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var HashIterations = 100000
HashIterations defines the number of hash iterations.
Functions ¶
This section is empty.
Types ¶
type AclRecord ¶
type AclRecord struct {
Topic string
Acc byte //None 0x00, Read 0x01, Write 0x02, ReadWrite: Read | Write : 0x03
}
AclRecord holds a topic and access privileges.
type Claims ¶
type Claims struct {
jwt.StandardClaims
// Username defines the identity of the user.
Username string `json:"username"`
}
Claims defines the struct containing the token claims.
type Files ¶
type Files struct {
PasswordPath string
AclPath string
CheckAcls bool
Users map[string]*FileUser //Users keeps a registry of username/FileUser pairs, holding a user's password and Acl records.
AclRecords []AclRecord
}
FileBE holds paths to files, list of file users and general (no user or pattern) acl records.
func (Files) CheckAcl ¶
CheckAcl checks that the topic may be read/written by the given user/clientid.
func (Files) GetSuperuser ¶
GetSuperuser returns false for files backend.
type HTTP ¶
type HTTP struct {
UserUri string
SuperuserUri string
AclUri string
Host string
Port string
WithTLS bool
VerifyPeer bool
ParamsMode string
ResponseMode string
}
func (HTTP) GetSuperuser ¶
type HTTPResponse ¶
type JWT ¶
type JWT struct {
Remote bool
LocalDB string
Postgres Postgres
Mysql Mysql
Secret string
UserQuery string
SuperuserQuery string
AclQuery string
UserUri string
SuperuserUri string
AclUri string
Host string
Port string
WithTLS bool
VerifyPeer bool
ParamsMode string
ResponseMode string
}
func (JWT) GetSuperuser ¶
type Mongo ¶
type Mongo struct {
Host string
Port string
Username string
Password string
DBName string
UsersCollection string
AclsCollection string
Conn *mgo.Session
}
func (Mongo) CheckAcl ¶
CheckAcl gets all acls for the username and tries to match against topic, acc, and username/clientid if needed.
func (Mongo) GetSuperuser ¶
GetSuperuser checks that the key username:su exists and has value "true".
type Mysql ¶
type Mysql struct {
DB *sqlx.DB
Host string
Port string
DBName string
User string
Password string
UserQuery string
SuperuserQuery string
AclQuery string
SSLMode string
SSLCert string
SSLKey string
SSLRootCert string
Protocol string
SocketPath string
}
Mysql holds all fields of the Mysql db connection.
func (Mysql) CheckAcl ¶
CheckAcl gets all acls for the username and tries to match against topic, acc, and username/clientid if needed.
func (Mysql) GetSuperuser ¶
GetSuperuser checks that the username meets the superuser query.
type Postgres ¶
type Postgres struct {
DB *sqlx.DB
Host string
Port string
DBName string
User string
Password string
UserQuery string
SuperuserQuery string
AclQuery string
SSLMode string
SSLCert string
SSLKey string
SSLRootCert string
}
Postgres holds all fields of the postgres db connection.
func NewPostgres ¶
func (Postgres) CheckAcl ¶
CheckAcl gets all acls for the username and tries to match against topic, acc, and username/clientid if needed.
func (Postgres) GetSuperuser ¶
GetSuperuser checks that the username meets the superuser query.
type Redis ¶
func (Redis) CheckAcl ¶
CheckAcl gets all acls for the username and tries to match against topic, acc, and username/clientid if needed.
func (Redis) GetSuperuser ¶
GetSuperuser checks that the key username:su exists and has value "true".
type Sqlite ¶
type Sqlite struct {
DB *sqlx.DB
Source string
UserQuery string
SuperuserQuery string
AclQuery string
}
Sqlite holds all fields of the sqlite db connection.
func (Sqlite) CheckAcl ¶
CheckAcl gets all acls for the username and tries to match against topic, acc, and username/clientid if needed.
func (Sqlite) GetSuperuser ¶
GetSuperuser checks that the username meets the superuser query.