Browse Source
This commit refines the documentation by: - Updating Jackson documentation for Jackson 3 - Removing the outdated documentation in servlet - Adding migration guidelines Closes gh-17832 Signed-off-by: Sébastien Deleuze <sdeleuze@users.noreply.github.com>pull/18079/head
4 changed files with 66 additions and 37 deletions
@ -1,30 +0,0 @@ |
|||||||
[[jackson]] |
|
||||||
= Jackson Support |
|
||||||
|
|
||||||
Spring Security provides Jackson support for persisting Spring Security-related classes. |
|
||||||
This can improve the performance of serializing Spring Security-related classes when working with distributed sessions (session replication, Spring Session, and so on). |
|
||||||
|
|
||||||
To use it, register the `SecurityJacksonModules.getModules(ClassLoader)` with `JsonMapper.Builder` (https://github.com/FasterXML/jackson-databind[jackson-databind]): |
|
||||||
|
|
||||||
[source,java] |
|
||||||
---- |
|
||||||
ClassLoader loader = getClass().getClassLoader(); |
|
||||||
JsonMapper mapper = JsonMapper.builder() |
|
||||||
.addModules(SecurityJacksonModules.getModules(loader)) |
|
||||||
.build(); |
|
||||||
|
|
||||||
// ... use JsonMapper as normally ... |
|
||||||
SecurityContext context = new SecurityContextImpl(); |
|
||||||
// ... |
|
||||||
String json = mapper.writeValueAsString(context); |
|
||||||
---- |
|
||||||
|
|
||||||
[NOTE] |
|
||||||
==== |
|
||||||
The following Spring Security modules provide Jackson support: |
|
||||||
|
|
||||||
- spring-security-core (javadoc:org.springframework.security.jackson.CoreJacksonModule[]) |
|
||||||
- spring-security-web (javadoc:org.springframework.security.web.jackson.WebJacksonModule[], javadoc:org.springframework.security.web.jackson.WebServletJacksonModule[], javadoc:org.springframework.security.web.server.jackson.WebServerJacksonModule[]) |
|
||||||
- <<oauth2client, spring-security-oauth2-client>> (javadoc:org.springframework.security.oauth2.client.jackson.OAuth2ClientJacksonModule[]) |
|
||||||
- spring-security-cas (javadoc:org.springframework.security.cas.jackson.CasJacksonModule[]) |
|
||||||
==== |
|
||||||
Loading…
Reference in new issue