read role every refresh
This commit is contained in:
@@ -164,9 +164,8 @@ func (aH *AccessHandler) Refresh(c *gin.Context) {
|
||||
|
||||
username := claims["username"].(string)
|
||||
id := int(claims["id"].(float64))
|
||||
role := claims["role"].(string)
|
||||
|
||||
_, hasError := aH.getUserFromDB(c, username)
|
||||
user, hasError := aH.getUserFromDB(c, username)
|
||||
if hasError {
|
||||
return
|
||||
}
|
||||
@@ -177,7 +176,7 @@ func (aH *AccessHandler) Refresh(c *gin.Context) {
|
||||
newAccess := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
|
||||
"id": id,
|
||||
"username": username,
|
||||
"role": role,
|
||||
"role": user.Role,
|
||||
"exp": accessExp.Unix(),
|
||||
})
|
||||
accessString, _ := newAccess.SignedString(ACCESS_SECRET)
|
||||
|
||||
Reference in New Issue
Block a user