added login and test admin page

This commit is contained in:
2023-03-29 14:44:50 +11:00
parent f561f466a2
commit 66983fa59d
9 changed files with 282 additions and 9 deletions

View File

@@ -0,0 +1,21 @@
package middlewares
import (
"net/http"
"ccsecrets/utils/token"
"github.com/gin-gonic/gin"
)
func JwtAuthMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
err := token.TokenValid(c)
if err != nil {
c.String(http.StatusUnauthorized, "Unauthorized")
c.Abort()
return
}
c.Next()
}
}