Skip to content

Replace improper JsonNode.toString() in Jackson support #4759

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 2 commits into from
Oct 31, 2017

Conversation

fpavageau
Copy link
Contributor

This is #4253 reported on 4.2.x to fix #4252 on that branch as well, for people that won't be able to upgrade to 5.0 right away.

Not only is it more efficient without converting to an intermediate String,
using JsonNode.toString() may not even produce valid JSON according to its
Javadoc (ObjectMapper.writeValueAsString() should be used).
When the principal of the Authentication is an object, it is not necessarily
an User: it could be another implementation of UserDetails, or even a
completely unrelated type. Since the type of the object is serialized as a
property and used by the deserialization anyway, there's no point in
enforcing a stricter type.
@rwinch rwinch self-assigned this Oct 31, 2017
@rwinch rwinch added this to the 4.2.4 milestone Oct 31, 2017
@rwinch rwinch added type: bug A general bug in: core An issue in spring-security-core labels Oct 31, 2017
@rwinch rwinch merged commit 6cc0f6c into spring-projects:4.2.x Oct 31, 2017
@rwinch
Copy link
Member

rwinch commented Oct 31, 2017

Thanks for the PR @fpavageau! This is now in 4.2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core An issue in spring-security-core type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants