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

In setup.py merge "signedtoken" extras into "rsa" extras so RSA features work #721

Open
hoylen opened this issue Mar 24, 2020 · 0 comments

Comments

@hoylen
Copy link
Contributor

hoylen commented Mar 24, 2020

Describe the bug

The setup.py install script currently defines two "extras" that can be installed:

  • rsa which only installs PyCA's cryptography package, and
  • signedtoken which installs both cryptography and pyjwt packages.

oauthlib/setup.py

Lines 21 to 23 in d4716eb

rsa_require = ['cryptography']
signedtoken_require = ['cryptography', 'pyjwt>=1.0.0']
signals_require = ['blinker']

oauthlib/setup.py

Lines 40 to 44 in d4716eb

extras_require={
'rsa': rsa_require,
'signedtoken': signedtoken_require,
'signals': signals_require,
},

There are two problems with this.

Firstly, with the RSA-SHA1 signature method in OAuth 1.0a, having just cryptography without pyjwt does not work. It needs both. It is also needed for RS256 tokens in OAuth 2.0 too: JWT is needed/imported by oauth2/rfc6749/clients/service_application.py, common.py and oauth1/rfc5849/signature.py.

Secondly, the "signedtoken" extras is not documented (except buried in a section about errors in the FAQ). The "rsa" extras is partially documented, and that would mislead users into thinking all they need to do is install the "rsa" extras and RSA-SHA1 and RS256 will work.

How to reproduce

Install using pip install oauthlib[rsa] and try using the OAuth 1.0a RSA-SHA1 signature method. It fails with an exception, because pyjwt has not been installed.

ModuleNotFoundError: No module named 'jwt'

Expected behavior

Expect installing "rsa" will make the OAuth 1.0a RSA-SHA1 signature method work.

Proposed solution

Is there a reason why someone would what to install cryptography installed for RSA support, but cannot (or must not) install pyjwt?

Can both installation extras be merged into a single "rsa" extras? Having one option makes installing less complicated, and less things that need to be documented.

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

No branches or pull requests

3 participants