Skip to content

Re-add Symfony Serializer for JWE/JWS #328

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

Merged
merged 3 commits into from
Feb 3, 2022
Merged

Re-add Symfony Serializer for JWE/JWS #328

merged 3 commits into from
Feb 3, 2022

Conversation

mdeboer
Copy link
Contributor

@mdeboer mdeboer commented Jan 17, 2022

In 665cd89 the Symfony Normalizers were removed because of the more extensive type hinting in Symfony 6.0.

With this PR I restore the compatibility with Symfony Serializer 6.0. By implementing the NormalizationAwareInterface we now instruct the serializer to skip the normalization step normally done when calling serialize(). This fixes the main problem that was faced when type hinting for version 3.0.

There are no separate encoders and normalizers anymore. Both JWS and JWE have their own serializer class now which handles everything. These classes also no longer implement the NormalizerInterface anymore as we completely skip that step. I wish I could do the same for denormalization but we still have to do it the old fashion way, by passing through the data that came in. Luckily the return type is mixed so this doesn't cause any trouble.

Please let me know what you think!

@Spomky Spomky merged commit 3432e1f into web-token:v3.0 Feb 3, 2022
@Spomky
Copy link
Member

Spomky commented Feb 3, 2022

Excellent! Looks good to me.
Many thanks.

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

Successfully merging this pull request may close these issues.

2 participants