Include Client ID (kid) parameter in the JWT header #932
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently,
Oauth2\Encryption\FirebaseJwt::encode
has a different signature fromOAuth2\Encryption\Jwt::encode
; theFirebaseJwt
function has an additional$keyId
parameter. This parameter, when included, is passed into thekid
parameter of the JWT header.Unfortunately, neither of the two classes which use it (
OAuth2\OpenID\ResponseType\IdToken
andOAuth2\ResponseType\JwtAccessToken
) include the parameter by default, so a lot of code is required to get this parameter added into the JWT header.This PR modifies the signature of
OAuth2\Encryption\EncryptionInterface::encode
to include the$keyId
parameter, thus standardizing between the two provided encryption implementations to offer a way to incorporate thekid
parameter. It also modifies the two ResponseTypes which use theencode
method to pass the$client_id
.There is also one more related issue included in this PR: modern versions of firebase/php-jwt use namespaces, while the references in
Oauth2\Encryption\FirebaseJwt
do not. I've modified this class to use the proper namespace parameters, and also upgraded the minimum suggestion of firebase/php-jwt package from ~2.2 (released 2015-06-22) to ~3.0 (released 2015-07-22).