π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
Clean code
Smaug6739ac907dbb9fe7
diff --git a/backend/middlewares/authentification.go b/backend/middlewares/authentification.goindex 658556c0..5f50d772 100644--- a/backend/middlewares/authentification.go+++ b/backend/middlewares/authentification.go@@ -12,6 +12,11 @@ import ("github.com/golang-jwt/jwt/v5")+type AuthClaims struct {+ Role string `json:"role"`+ jwt.RegisteredClaims+}+func Auth() gin.HandlerFunc {return func(c *gin.Context) {tokenString, err := c.Cookie("Authorization")@@ -22,7 +27,7 @@ func Auth() gin.HandlerFunc {}// Parse the token- claims := utils.AuthClaims{}+ claims := AuthClaims{}token, err := jwt.ParseWithClaims(tokenString, &claims, func(token *jwt.Token) (interface{}, error) {if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {return nil, http.ErrAbortHandlerdiff --git a/backend/utils/constants.go b/backend/utils/constants.godeleted file mode 100644index 6783b8a6..00000000--- a/backend/utils/constants.go+++ /dev/null@@ -1,8 +0,0 @@-package utils--import "github.com/golang-jwt/jwt/v5"--type AuthClaims struct {- Role string `json:"role"`- jwt.RegisteredClaims-}