-
Notifications
You must be signed in to change notification settings - Fork 950
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
Rename JWT claims for JWT Access Tokens: #338 #460
Rename JWT claims for JWT Access Tokens: #338 #460
Conversation
// converts a JWT access token into an OAuth2-friendly format | ||
protected function convertJwtToOauth2($tokenData) | ||
{ | ||
$keyMapping = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we will have to use the php5.3-compatible array(...)
syntax here
This is a great change! Thank you for doing this. I have one comment, and it would also be great to write tests for this. Otherwise, 👍 |
Both excellent points. My bad on the array syntax slip. I will make those changes and resubmit. |
I added a test that verifies the JWT claims are set properly in the resulting access token from |
@@ -57,4 +58,23 @@ public function setAccessToken($oauth_token, $client_id, $user_id, $expires, $sc | |||
return $this->tokenStorage->setAccessToken($oauth_token, $client_id, $user_id, $expires, $scope); | |||
} | |||
} | |||
|
|||
// converts a JWT access token into an OAuth2-friendly format | |||
protected function convertJwtToOauth2($tokenData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really picky, but for consistency with the rest of the library, this function should be convertJwtToOAuth2
(uppercase the A in OAuth2)
This PR brings a tear to my eye. If you could fix my single suggestion and rebase it into a single commit for a cleaner commit history (use |
…ovided by the spec
1e71643
to
ee912be
Compare
gah, your only mistake! My name is Brent! :) |
…oken-claims Rename JWT claims for JWT Access Tokens: #338
Ah, sorry Brent! I must have picked up that other name in the issues. |
I forgive you on account of your awesome PR |
This changes need to be forwarded to https://github.com/bshaffer/oauth2-server-php-docs |
Hey all,
Thank you for creating such a fantastic library. It has been very useful to me. This pull request is my attempt to finish addressing #338 for JWT Access Tokens. A couple of notes here:
client_id
toaud
expires
toexp
user_id
tosub
iss
parameter from an optionalissuer
configuration valueiat
parameter for the time the JWT access token was issuedI also added a method that maps the decoded access token from the JWT claims format to the format expected by other parts of this library. Hope this is helpful!