[PD2] Code almost all done. Need to add logout and change help message
Co-authored-by: tsousa111 <tiagao2001@hotmail.com>
This commit is contained in:
parent
e2c3d75223
commit
6f8219d991
12 changed files with 123 additions and 212 deletions
|
@ -52,11 +52,11 @@ func ValidateJWT(tokenString string) (string, error) {
|
|||
return "", errors.New("invalid token")
|
||||
}
|
||||
if claims, ok := token.Claims.(jwt.MapClaims); ok && token.Valid {
|
||||
if time.Now().Unix() > claims["exp"].(int64) {
|
||||
if float64(time.Now().Unix()) > claims["exp"].(float64) {
|
||||
return "", errors.New("JWT token has expired")
|
||||
}
|
||||
return claims["sub"].(string),nil
|
||||
} else {
|
||||
return "",errors.New("Failed to get jwt claims")
|
||||
return "",errors.New("failed to get jwt claims")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue