Create a request extractor API to replace the static method for extracting the refresh token from the request #256
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.
Fixes #95
RequestRefreshToken::getRefreshToken()
is a static method which makes it pretty difficult to customize the behavior for extracting the refresh token from the request data (as essentially you need to replace all services calling it with a custom implementation of those services then add a custom handler for pulling data from the request). To get around this limitation, a new request extractor API (inspired by the similar API inLexikJWTAuthenticationBundle
) is introduced with this PR and the current static method removed.The default implementation that is aliased to the new interface is a chain extractor that will iterate over all extractors until finding a token. Similar to the current behavior, null is returned from the extractor API if a token can't be found.
Extractors can be added in applications by implementing
Gesdinet\JWTRefreshTokenBundle\Request\Extractor\ExtractorInterface
(which is configured to support autowiring and automatically tagging the class with thegesdinet_jwt_refresh_token.request_extractor
container tag). The tag also supports priorities, so applications can prioritize the extractors as desired.