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

Better handling of signature method #10

Open
aezell opened this issue Jul 26, 2011 · 0 comments
Open

Better handling of signature method #10

aezell opened this issue Jul 26, 2011 · 0 comments

Comments

@aezell
Copy link

aezell commented Jul 26, 2011

Currently, flask-oauth is letting oauth2 do whatever it likes with regards to signature method. That means, it's mostly using HMAC_SHA1. However, some oauth servers will only accept PLAINTEXT as the signature method.

It's not too bad to set the signature method right after creating the remote_app, although it does mean accessing the _client which might not be totally obvious to some folks. It looks like this:

from flaskext.oauth import OAuth
from oauth2 import SignatureMethod_PLAINTEXT

oauth = OAuth()
my_api = oauth.remote_app('my_api',
    ...
)
my_api._client.set_signature_method(SignatureMethod_PLAINTEXT())

What doesn't work at all is using the authorized_handler decorator. When it calls make_client, it doesn't care about signature method. I had to add this around line 300 of oauth.py:

client.set_signature_method(oauth2.SignatureMethod_PLAINTEXT())

So, the issue is how to handle signature method better and allow for greater flexibility. Maybe if we just set it in the init() of OAuthRemoteApp(), we could just use it as a class attribute everywhere else. That assumes that a single remote_app always uses the same signature method, but from what I can see, that's a pretty safe assumption.

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

1 participant