Documentation ¶
Index ¶
- Variables
- func AuthRequired() gin.HandlerFunc
- func ExtractClaims(c *gin.Context) *types.User
- func IsAppOwner(c *gin.Context)
- func IsDatabaseOwner(c *gin.Context)
- func LoginHandler(c *gin.Context)
- func RefreshHandler(c *gin.Context)
- func ValidateApplicationRequest(c *gin.Context)
- func ValidateDatabaseRequest(c *gin.Context)
- func ValidateRegistration(c *gin.Context)
- func VerifyAdmin(c *gin.Context)
Constants ¶
This section is empty.
Variables ¶
var JWT = &jwt.GinJWTMiddleware{ Realm: "Gasper", Key: []byte(configs.GasperConfig.Secret), Timeout: configs.JWTConfig.Timeout * time.Second, MaxRefresh: configs.JWTConfig.MaxRefresh * time.Second, TokenLookup: "header: Authorization", TokenHeadName: "Bearer", TimeFunc: time.Now, Authenticator: authenticator, PayloadFunc: payloadFunc, IdentityHandler: identityHandler, Authorizator: authorizator, Unauthorized: unauthorized, }
JWT handles the auth through JWT token
var JWTGctl = &jwt.GinJWTMiddleware{ Realm: "Gasper", Key: []byte(configs.GasperConfig.Secret), Timeout: configs.JWTConfig.Timeout * time.Second, MaxRefresh: configs.JWTConfig.MaxRefresh * time.Second, TokenLookup: "header: Authorization", TokenHeadName: "gctlToken", TimeFunc: time.Now, Authenticator: authenticator, PayloadFunc: payloadFuncForGctl, IdentityHandler: identityHandlerForGctl, Authorizator: authorizatorForGctl, Unauthorized: unauthorized, }
JWTGctl handles the auth through JWT token for gctl
Functions ¶
func AuthRequired ¶
func AuthRequired() gin.HandlerFunc
AuthRequired returns middleware according to type of request
func ExtractClaims ¶
ExtractClaims takes the gin context and returns the User
func IsAppOwner ¶
IsAppOwner checks if a user is entitled to perform operations on an application
func IsDatabaseOwner ¶
IsDatabaseOwner checks if a user is entitled to perform operations on a database
func LoginHandler ¶
LoginHandler takes the gin context and executes LoginHandler function according to authorization type
func RefreshHandler ¶
RefreshHandler takes the gin context and executes RefreshHandler function according to authorization type
func ValidateApplicationRequest ¶
ValidateApplicationRequest validates the request for creating applications
func ValidateDatabaseRequest ¶
ValidateDatabaseRequest validates the request for creating databases
func ValidateRegistration ¶
ValidateRegistration validates the user registration request
func VerifyAdmin ¶
VerifyAdmin allows the request to proceed only if the user has admin privileges
Types ¶
This section is empty.