Fix claims
This commit is contained in:
parent
038976ca4d
commit
f62ba4a20e
11
main.go
11
main.go
@ -70,12 +70,11 @@ func loginPost(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create token
|
// Create token
|
||||||
token := jwt.New(jwt.SigningMethodHS256)
|
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
||||||
|
"usr": "jan",
|
||||||
// Set claims
|
"name": "Jan Bader",
|
||||||
//token.Claims["name"] = "Jan Bader"
|
"exp": time.Now().Add(time.Hour * expiration).Unix(),
|
||||||
//token.Claims["admin"] = true
|
})
|
||||||
//token.Claims["exp"] = time.Now().Add(time.Hour * expiration).Unix()
|
|
||||||
|
|
||||||
// Generate encoded token and send it as response.
|
// Generate encoded token and send it as response.
|
||||||
t, err := token.SignedString([]byte(secret))
|
t, err := token.SignedString([]byte(secret))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user