diff --git a/jwt.go b/jwt.go index e36534e..fcf2baf 100644 --- a/jwt.go +++ b/jwt.go @@ -147,7 +147,7 @@ func Verify(c *gin.Context) { func GetClaims(c *gin.Context) Claims { if claims, ok := c.Get("claims"); ok { - return claims.(Claims) + return claims.(map[string]interface{}) } else { return nil } diff --git a/jwt_test.go b/jwt_test.go index 0d02cef..35a409c 100644 --- a/jwt_test.go +++ b/jwt_test.go @@ -56,12 +56,12 @@ func TestVerifyValidToken(t *testing.T) { c.Request, _ = http.NewRequest("GET", "/", nil) - token, err := GetToken(map[string]interface{}{}) + token, err := GetToken(Claims{}) c.Request.Header.Add("Authorization", "bearer "+string(token)) Verify(c) assert.Equal(t, res.Code, http.StatusOK) - assert.Equal(t, GetClaims(c), map[string]interface{}{}) + assert.Equal(t, GetClaims(c), Claims{}) }