Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Add ability to specify other headers when generating a token #17

Merged

Conversation

petedmarsh
Copy link
Contributor

The RFC7519 spec defines the following headers:

typ
cty
alg

alg and typ are set appropriately by generate_token, however there
hasn't been a way to specify cty or any other headers defined by
later standards (i.e. by JWE and JWS).

This adds a new optional parameter to generate_token: other_headers.
If specified the key/values will be included with the headers in
the token. To avoid misue, if other_headers specifies 'typ' or
'alg' a ValueError will be raised.

@petedmarsh
Copy link
Contributor Author

I wasn't able to get the tests running locally and I'm unfamiliar with the test framework, apologies for not adding tests. I recently had to generate a token with a kid in the header and it would be great to be able to do so with generate_token.

The RFC7519 spec defines the following headers:

   typ
   cty
   alg

alg and typ are set appropriately by generate_token, however there
hasn't been a way to specify cty or any other headers defined by
later standards (i.e. by JWE and JWS).

This adds a new optional parameter to generate_token: other_headers.
If specified the key/values will be included with the headers in
the token. To avoid misue, if other_headers specifies 'typ' or
'alg' a ValueError will be raised.
@davedoesdev
Copy link
Owner

@petedmarsh appreciate this. I'll merge it and add tests.
(I chose PyVows way back when but it's been unmaintained for a while now so adding tests isn't as simple as it used to be).

@davedoesdev davedoesdev merged commit df1ceec into davedoesdev:master Apr 24, 2018
@petedmarsh petedmarsh deleted the add-optional-other-headers branch April 24, 2018 21:36
@davedoesdev
Copy link
Owner

@petedmarsh now available as version 3.1.0.
Thanks again.

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

Successfully merging this pull request may close these issues.

None yet

2 participants