Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Allow setting audience and issuer #77

Merged
merged 3 commits into from
Feb 21, 2015
Merged

Conversation

cancan101
Copy link
Contributor

Right now there is no way to pass in the audience to validate which causes the following to fail:
https://github.com/jpadilla/pyjwt/blob/5f9bc05803508b844d3fd9c61cd5210af06eecd8/jwt/api.py#L169

closes #79
closes #81

@jpadilla
Copy link
Owner

@cancan101 this is good, thanks! Could you update any docs with this new setting? Also, might be a good idea to include a simple test since this is adding a new "feature".

@cancan101 cancan101 changed the title Allow setting audience Allow setting audience and issuer Feb 18, 2015
@cancan101
Copy link
Contributor Author

How do I run tests locally? This ./runtests.py --fast fails with:

E       OperationalError: no such table: auth_user

@jpadilla
Copy link
Owner

@cancan101 that's strange, still running into issues running tests?

@cancan101
Copy link
Contributor Author

This command still has the same error: ./runtests.py --fast but the tox commands work fine: tox -e py27-django1.7-drf3.0.0

@jpadilla
Copy link
Owner

@cancan101 hmm weird, works fine here. I'll look into what might be going on. The only things I think is missing is the test case for this, everything else looks fine.

@cancan101
Copy link
Contributor Author

Suggestion where to put the test? https://github.com/GetBlimp/django-rest-framework-jwt/blob/master/tests/test_utils.py seems like the right place.

How do I test changing the settings?

@jpadilla
Copy link
Owner

Yeah that seems right.

There's an example here..

@cancan101
Copy link
Contributor Author

Tests uploaded.

### JWT_ISSUER
This is a string that will be checked against the `iss` field of the token.

Default is `None`(do not check `iss` on JWT).
Copy link
Owner

Choose a reason for hiding this comment

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

(do not check iss on JWT)

Do you mean that if JWT_ISSUER is None and iss is present on the JWT it won't be checked? This bit could be a little more clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just trying to interpret this code which checks the iss on the token only if issuer is not None:

    if issuer is not None:
        if payload.get('iss') != issuer:
            raise InvalidIssuerError('Invalid issuer')

jpadilla added a commit that referenced this pull request Feb 21, 2015
Allow setting audience and issuer
@jpadilla jpadilla merged commit d5311bf into jpadilla:master Feb 21, 2015
@jpadilla
Copy link
Owner

@cancan101 thanks!

@jpadilla jpadilla modified the milestone: 1.3.0 Release Mar 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow passing in an audience to verify_signature. Allow setting issuer
2 participants