Add authentication function

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2025-12-24 20:43:19 +08:00
parent fd4da4f1a1
commit cd2bcd597c
11 changed files with 290 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ type Claims struct {
}
func JWTAuth() gin.HandlerFunc {
var JwtSecret = []byte(viper.GetString("server.jwt_secret"))
var JwtSecret = []byte(viper.GetString("secrets.jwt"))
return func(c *gin.Context) {
auth := c.GetHeader("Authorization")
if auth == "" {