Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

numeric values not found #14

Closed
fitzyjoe opened this issue Sep 14, 2016 · 2 comments
Closed

numeric values not found #14

fitzyjoe opened this issue Sep 14, 2016 · 2 comments

Comments

@fitzyjoe
Copy link
Contributor

fitzyjoe commented Sep 14, 2016

When I try to get the "exp" or "iat" grant (created by other jwt libraries), NULL is returned. This is because those values are not stored as strings (and should not be stored as strings according to the spec.)

jwt_get_grant calls get_js_string which calls json_string_value

I made functions

jwt_get_grant_int which calls get_js_int which calls json_integer_value

Here's the JWT that I was parsing. I printed this via jwt_dump_str:

{
    "typ": "JWT",
    "alg": "HS256"
}
.
{
    "emailAddress": "joefitz@teslagov.com",
    "exp": 1473905589,
    "firstName": "Joe",
    "iat": 1473819189,
    "iss": "RAMPART",
    "lastName": "Fitz",
    "personId": "0f416f7c-da9e-4fe6-8447-9a5b3b6d79c5",
    "roles": [
        "rampartadmin",
        "someappuser"
    ],
    "sub": "0f416f7c-da9e-4fe6-8447-9a5b3b6d79c5"
}

But I was unable to get the "exp" or "iat" values with jwt_get_grant. I think that jwt_set_grant will not be compliant for "exp" and "iat" values because it will set them as strings.

I have a branch if you'd like a pull request.

@fitzyjoe
Copy link
Contributor Author

Looks like there is a pull request to address this problem, but in a more broad way - to support JSON. Doesn't this seem like a critical piece? How else can you validate expiration dates of tokens (that were made as integers by other spec compliant libraries)? Last movement on that pull request was in April. Is this dead?

@benmcollins
Copy link
Owner

Fixed in cd227d7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants