Document Jackson serialization support for OAuth 2.0 Client

Fixes gh-8075
This commit is contained in:
Joe Grandja 2020-03-18 13:59:40 -04:00
parent 2d8c65db56
commit 06fdb83fb8
1 changed files with 12 additions and 2 deletions

View File

@ -1,10 +1,10 @@
[[jackson]]
== Jackson Support
Spring Security has added Jackson Support for persisting Spring Security related classes.
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 (i.e. session replication, Spring Session, etc).
To use it, register the `SecurityJackson2Modules.getModules(ClassLoader)` as https://wiki.fasterxml.com/JacksonFeatureModules[Jackson Modules].
To use it, register the `SecurityJackson2Modules.getModules(ClassLoader)` with `ObjectMapper` (https://github.com/FasterXML/jackson-databind[jackson-databind]):
[source,java]
----
@ -18,3 +18,13 @@ SecurityContext context = new SecurityContextImpl();
// ...
String json = mapper.writeValueAsString(context);
----
[NOTE]
====
The following Spring Security modules provide Jackson support:
- spring-security-core (`CoreJackson2Module`)
- spring-security-web (`WebJackson2Module`, `WebServletJackson2Module`, `WebServerJackson2Module`)
- <<oauth2client, spring-security-oauth2-client>> (`OAuth2ClientJackson2Module`)
- spring-security-cas (`CasJackson2Module`)
====