Documentation
¶
Index ¶
- func AuthMiddleware(c *gin.Context, db *gorm.DB, cfg *config.Config)
- func AuthorizeUser(c *gin.Context, db *gorm.DB, cfg *config.Config)
- func CreateGroup(c *gin.Context, db *gorm.DB)
- func CreateLink(c *gin.Context, db *gorm.DB)
- func CreateUser(c *gin.Context, db *gorm.DB, cfg *config.Config)
- func DeleteGroup(c *gin.Context, db *gorm.DB)
- func DeleteLink(c *gin.Context, db *gorm.DB)
- func GetGinEngine(cfg *config.Config, db *gorm.DB) *gin.Engine
- func GetJWTToken(cfg *config.Config) (string, error)
- func RequireAuth(c *gin.Context, cfg *config.Config) (*jwt.RegisteredClaims, error)
- func SecurityHeadersMiddleware(c *gin.Context)
- func SetTokenCookie(c *gin.Context, token string)
- func ShowError(c *gin.Context, err error)
- func ShowLoginForm(c *gin.Context)
- func ShowMainPage(c *gin.Context, db *gorm.DB)
- func ShowRegistrationForm(c *gin.Context, db *gorm.DB)
- func ShowSettings(c *gin.Context, db *gorm.DB)
- func UpdateGroup(c *gin.Context, db *gorm.DB)
- func UpdateLink(c *gin.Context, db *gorm.DB)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequireAuth ¶
Requires the user to log in before viewing the page. Returns error if the user is not authorized. If `nil` is returned instead of an error, it is safe to display protected content.
func SecurityHeadersMiddleware ¶
Adds several headers to the response to improve security. For example, headers prevent embedding a site and passing information about the referrer.
func SetTokenCookie ¶
Save token for one day in cookies
func ShowLoginForm ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.