Ajout d'une route pour vérifier le JWT de l'utilisateur
This commit is contained in:
parent
58444a3c3e
commit
fd3c48d418
2 changed files with 5 additions and 0 deletions
|
@ -114,6 +114,10 @@ func Login(c *gin.Context) {
|
|||
})
|
||||
}
|
||||
|
||||
func ValidateToken(c *gin.Context) {
|
||||
c.AbortWithStatus(http.StatusAccepted)
|
||||
}
|
||||
|
||||
func createToken(userId uuid.UUID) (string, error) {
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
||||
"bearer": userId,
|
||||
|
|
1
main.go
1
main.go
|
@ -31,6 +31,7 @@ func main() {
|
|||
// Auth
|
||||
api.Api.POST("/signup", controllers.Signup)
|
||||
api.Api.POST("/login", controllers.Login)
|
||||
api.Api.GET("/validate", middleware.RequireAuth, controllers.ValidateToken)
|
||||
|
||||
// Users
|
||||
api.Api.GET("/users", controllers.GetUsers)
|
||||
|
|
Loading…
Add table
Reference in a new issue