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

Use sub claim instead of identity for interoperatibility #65

Closed
psafont opened this issue Jul 12, 2017 · 2 comments
Closed

Use sub claim instead of identity for interoperatibility #65

psafont opened this issue Jul 12, 2017 · 2 comments

Comments

@psafont
Copy link
Contributor

psafont commented Jul 12, 2017

Hello!

The library uses the claim identity for identifying the subject. This makes the library a bit awkard to interop with external identity providers or client implementations.

The JWT RFC recommends using sub for identifying the principal:

4.1.2. "sub" (Subject) Claim
The "sub" (subject) claim identifies the principal that is the
subject of the JWT. The claims in a JWT are normally statements
about the subject. The subject value MUST either be scoped to be
locally unique in the context of the issuer or be globally unique.
The processing of this claim is generally application specific. The
"sub" value is a case-sensitive string containing a StringOrURI
value. Use of this claim is OPTIONAL.

I was thinking about making the "identity" claim to be changeable with a config key. This would allow for several pro:

  • Interoperability: allows the user to select a claim for "identity", allowing users of the library to interop with opinionated code.
  • Smooth deprecation policy: default value can be left to be the same as now, while allowing users to change it; the default value can be changed whenever backwards-compatibility isn't a concern.

As for the cons, while decoding should be easy to change, encoding is another matter.

Thoughts?

psafont added a commit to psafont/flask-jwt-extended that referenced this issue Jul 12, 2017
psafont added a commit to psafont/flask-jwt-extended that referenced this issue Jul 12, 2017
psafont added a commit to psafont/flask-jwt-extended that referenced this issue Jul 12, 2017
@vimalloc
Copy link
Owner

Got this merged. Pypi changed how packages are uploaded out from under me, so I need to figure that out later tonight, then I'll get it setup there.

Cheers.

@vimalloc
Copy link
Owner

Released in 3.1.0

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

2 participants