Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateApplicationToken ¶
GenerateApplicationToken generates a token for an application.
func GenerateNotExistingToken ¶
func GenerateNotExistingToken(generateToken func(bool) string, compat bool, tokenExists func(token string) bool) string
GenerateNotExistingToken receives a token generation function and a function to check whether the token exists, returns a unique token.
func GetApplication ¶
func GetApplication(ctx *gin.Context) *model.Application
GetApplication returns the application which was previously registered by the authentication middleware.
Types ¶
type Authenticator ¶
type Authenticator struct {
DB Database
}
Authenticator is the provider for authentication middleware.
func (*Authenticator) RequireAdmin ¶
func (a *Authenticator) RequireAdmin() gin.HandlerFunc
RequireAdmin returns a Gin middleware which requires valid admin credentials to be supplied with the request.
func (*Authenticator) RequireApplicationToken ¶
func (a *Authenticator) RequireApplicationToken() gin.HandlerFunc
RequireApplicationToken returns a Gin middleware which requires an application token to be supplied with the request.
func (*Authenticator) RequireUser ¶
func (a *Authenticator) RequireUser() gin.HandlerFunc
RequireUser returns a Gin middleware which requires valid user credentials to be supplied with the request.