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
|
||||
token := jwt.New(jwt.SigningMethodHS256)
|
||||
|
||||
// Set claims
|
||||
//token.Claims["name"] = "Jan Bader"
|
||||
//token.Claims["admin"] = true
|
||||
//token.Claims["exp"] = time.Now().Add(time.Hour * expiration).Unix()
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
||||
"usr": "jan",
|
||||
"name": "Jan Bader",
|
||||
"exp": time.Now().Add(time.Hour * expiration).Unix(),
|
||||
})
|
||||
|
||||
// Generate encoded token and send it as response.
|
||||
t, err := token.SignedString([]byte(secret))
|
||||
|
Loading…
x
Reference in New Issue
Block a user