Documentation
¶
Index ¶
- Variables
- func NewCDN(config CDNConfig) (*s3.S3, error)
- func NewDB(config DatabaseConfig) (*sqlx.DB, error)
- func NewMQ(conf MQConfig) (*amqp.Connection, error)
- func NonNil[T any](k T) T
- func PSQL() sq.StatementBuilderType
- func Transact(db *sqlx.DB, txFunc func(*sqlx.Tx) error) (err error)
- type AccessClaims
- type Accesser
- func (a *Accesser) AddUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (a *Accesser) AuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (a *Accesser) GetToken(r *http.Request) (*AccessClaims, int, error)
- func (a *Accesser) GroupAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (a *Accesser) ListUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (a *Accesser) ManageStreamAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (a *Accesser) ModifyUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (a *Accesser) OfficershipAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (a *Accesser) PermissionsAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- func (a *Accesser) SuperUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
- type CDNConfig
- type Config
- type DatabaseConfig
- type HTTPError
- type MQConfig
- type Mail
- type MailConfig
- type Mailer
- type NotInExpr
- type Permission
- type Repo
- type StringSQL
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoToken = errors.New("token not found") ErrInvalidToken = errors.New("invalid token") )
Functions ¶
func NewDB ¶ added in v0.7.0
func NewDB(config DatabaseConfig) (*sqlx.DB, error)
NewDB Initialises the connection to the database
func NewMQ ¶ added in v0.7.0
func NewMQ(conf MQConfig) (*amqp.Connection, error)
NewMQ initialising the AMQP broker
func PSQL ¶ added in v0.9.5
func PSQL() sq.StatementBuilderType
Types ¶
type AccessClaims ¶ added in v0.8.0
type AccessClaims struct {
UserID int `json:"id"`
Permissions []string `json:"perms"`
jwt.RegisteredClaims
}
AccessClaims represents an identifiable JWT
type Accesser ¶ added in v0.8.0
type Accesser struct {
// contains filtered or unexported fields
}
func (*Accesser) AddUserAuthMiddleware ¶ added in v0.9.5
func (a *Accesser) AddUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
AddUserAuthMiddleware checks an HTTP request for a valid token either in the header or cookie, and if the user can add a user
func (*Accesser) AuthMiddleware ¶ added in v0.8.0
func (a *Accesser) AuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
AuthMiddleware checks an HTTP request for a valid token either in the header or cookie
func (*Accesser) GetToken ¶ added in v0.8.0
GetToken will return the claims from an access token JWT
First will check the Authorization header, if unset will check the access cookie
func (*Accesser) GroupAuthMiddleware ¶ added in v0.9.6
func (a *Accesser) GroupAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
GroupAuthMiddleware checks an HTTP request for a valid token either in the header or cookie and if the user can modify groups
func (*Accesser) ListUserAuthMiddleware ¶ added in v0.9.5
func (a *Accesser) ListUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
ListUserAuthMiddleware checks an HTTP request for a valid token either in the header or cookie and if the user can list users
func (*Accesser) ManageStreamAuthMiddleware ¶ added in v0.9.5
func (a *Accesser) ManageStreamAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
ManageStreamAuthMiddleware checks an HTTP request for a valid token either in the header or cookie and if the user can manage streams
func (*Accesser) ModifyUserAuthMiddleware ¶ added in v0.9.5
func (a *Accesser) ModifyUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
ModifyUserAuthMiddleware checks an HTTP request for a valid token either in the header or cookie and if the user can list users
func (*Accesser) OfficershipAuthMiddleware ¶ added in v0.9.6
func (a *Accesser) OfficershipAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
OfficershipAuthMiddleware checks an HTTP request for a valid token either in the header or cookie and if the user can modify permissions
func (*Accesser) PermissionsAuthMiddleware ¶ added in v0.9.6
func (a *Accesser) PermissionsAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
PermissionsAuthMiddleware checks an HTTP request for a valid token either in the header or cookie and if the user can modify permissions
func (*Accesser) SuperUserAuthMiddleware ¶ added in v0.9.8
func (a *Accesser) SuperUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
SuperUserAuthMiddleware checks an HTTP request for a valid token either in the header or cookie and if the user is SuperUser
type CDNConfig ¶ added in v0.7.0
CDNConfig represents a configuration to connect to a CDN / S3 instance
type DatabaseConfig ¶ added in v0.7.0
type DatabaseConfig struct {
Host string
Port string
SSLMode string
Name string
Username string
Password string
}
DatabaseConfig represents a configuration to connect to an SQL database
type Mail ¶ added in v0.7.0
type Mail struct {
Subject string
To string
Cc []string
Bcc []string
From string
// contains filtered or unexported fields
}
Mail represents an email to be sent
type MailConfig ¶ added in v0.7.0
MailConfig represents a configuration to connect to an SMTP server
type Mailer ¶ added in v0.7.0
type Mailer struct {
*mail.SMTPClient
Enabled bool
}
Mailer encapsulates the dependency
func NewMailer ¶ added in v0.7.0
func NewMailer(config MailConfig) (*Mailer, error)
NewMailer creates a new SMTP client
type NotInExpr ¶ added in v0.9.6
type NotInExpr inExpr
NotInExpr helps to use NOT IN in SQL query
type Permission ¶ added in v0.7.0
type Permission struct {
Name string `json:"name"`
}
Permission represents the permissions that a user has
type Repo ¶ added in v0.9.6
type Repo interface {
GetToken(r *http.Request) (*AccessClaims, int, error)
AuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
AddUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
ListUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
GroupAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
PermissionsAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
OfficershipAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
SuperUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
ModifyUserAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
ManageStreamAuthMiddleware(next echo.HandlerFunc) echo.HandlerFunc
}
func NewAccesser ¶ added in v0.8.0
NewAccesser allows the validation of web-auth JWT tokens both as headers and as cookies