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

Extend generate_signed_token with extra params #848

Closed
wants to merge 1 commit into from

Conversation

tomek-at-rais
Copy link

Extend generate_signed_token to allow custom algorithm and headers in JWT.

@auvipy auvipy self-requested a review April 15, 2023 06:21
@@ -197,7 +197,7 @@ def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):
return ''.join(rand.choice(chars) for x in range(length))


def generate_signed_token(private_pem, request):
def generate_signed_token(private_pem, request, algorithm='RS256', headers=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need test coverage for this change

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@auvipy I don't see any tests for generate_signed_token so I can't test "this change".

There's signed_token_generator usage in oauthlib/tests/oauth2/rfc6749/test_server.py. It would be easiest to extend signed_token_generator with new parameters and then use SignedTokenEndpointTest to add some tests for those new parameters. But technically speaking this would be testing signed_token_generator not generate_signed_token.

I'm open to suggestion on how to approach this. Also, how do I easily mock request parameter of generate_signed_token without getting into too many oauth details? This is a method from common so I shouldn't have to use any code that's nested under rfc... folders.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there's someone else who can suggest something, @auvipy?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyone? @auvipy?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomek-at-rais
Copy link
Author

I'm very sorry no-one is interested in helping me contribute to this project.

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

Successfully merging this pull request may close these issues.

None yet

2 participants