Documentation ¶
Index ¶
- func GenerateApplicationToken() string
- func GenerateClientToken() string
- func GenerateImageName() string
- func GetTokenID(ctx *gin.Context) string
- func GetUserID(ctx *gin.Context) uint
- func RegisterAuthentication(ctx *gin.Context, user *model.User, userID uint, tokenID string)
- type Auth
- type Database
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateApplicationToken ¶
func GenerateApplicationToken() string
GenerateApplicationToken generates an application token.
func GenerateClientToken ¶
func GenerateClientToken() string
GenerateClientToken generates a client token.
func GenerateImageName ¶ added in v1.1.3
func GenerateImageName() string
GenerateImageName generates an image name.
Types ¶
type Auth ¶
type Auth struct {
DB Database
}
Auth is the provider for authentication middleware
func (*Auth) RequireAdmin ¶
func (a *Auth) RequireAdmin() gin.HandlerFunc
RequireAdmin returns a gin middleware which requires a client token or basic authentication header to be supplied with the request. Also the authenticated user must be an administrator.
func (*Auth) RequireApplicationToken ¶
func (a *Auth) RequireApplicationToken() gin.HandlerFunc
RequireApplicationToken returns a gin middleware which requires an application token to be supplied with the request.
func (*Auth) RequireClient ¶
func (a *Auth) RequireClient() gin.HandlerFunc
RequireClient returns a gin middleware which requires a client token or basic authentication header to be supplied with the request.
Click to show internal directories.
Click to hide internal directories.