|
@@ -16,23 +16,17 @@
|
|
|
|
|
|
package org.springframework.security.web.jackson2;
|
|
package org.springframework.security.web.jackson2;
|
|
|
|
|
|
-import javax.servlet.http.Cookie;
|
|
|
|
-
|
|
|
|
import org.springframework.security.jackson2.SecurityJackson2Modules;
|
|
import org.springframework.security.jackson2.SecurityJackson2Modules;
|
|
-import org.springframework.security.web.authentication.WebAuthenticationDetails;
|
|
|
|
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
|
|
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken;
|
|
import org.springframework.security.web.csrf.DefaultCsrfToken;
|
|
import org.springframework.security.web.csrf.DefaultCsrfToken;
|
|
-import org.springframework.security.web.savedrequest.DefaultSavedRequest;
|
|
|
|
-import org.springframework.security.web.savedrequest.SavedCookie;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.core.Version;
|
|
import com.fasterxml.jackson.core.Version;
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Jackson module for spring-security-web. This module register {@link CookieMixin},
|
|
|
|
- * {@link DefaultCsrfTokenMixin}, {@link DefaultSavedRequestMixin} and {@link WebAuthenticationDetailsMixin}. If no
|
|
|
|
- * default typing enabled by default then it'll enable it because typing info is needed to properly serialize/deserialize objects.
|
|
|
|
|
|
+ * Jackson module for spring-security-web. This module register {@link DefaultCsrfTokenMixin} and
|
|
|
|
+ * {@link PreAuthenticatedAuthenticationTokenMixin}. If no default typing enabled by default then it'll enable
|
|
|
|
+ * it because typing info is needed to properly serialize/deserialize objects.
|
|
* In order to use this module just add this module into your ObjectMapper configuration.
|
|
* In order to use this module just add this module into your ObjectMapper configuration.
|
|
*
|
|
*
|
|
* <pre>
|
|
* <pre>
|
|
@@ -53,12 +47,8 @@ public class WebJackson2Module extends SimpleModule {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void setupModule(SetupContext context) {
|
|
public void setupModule(SetupContext context) {
|
|
- SecurityJackson2Modules.enableDefaultTyping((ObjectMapper) context.getOwner());
|
|
|
|
- context.setMixInAnnotations(Cookie.class, CookieMixin.class);
|
|
|
|
- context.setMixInAnnotations(SavedCookie.class, SavedCookieMixin.class);
|
|
|
|
|
|
+ SecurityJackson2Modules.enableDefaultTyping(context.getOwner());
|
|
context.setMixInAnnotations(DefaultCsrfToken.class, DefaultCsrfTokenMixin.class);
|
|
context.setMixInAnnotations(DefaultCsrfToken.class, DefaultCsrfTokenMixin.class);
|
|
- context.setMixInAnnotations(DefaultSavedRequest.class, DefaultSavedRequestMixin.class);
|
|
|
|
- context.setMixInAnnotations(WebAuthenticationDetails.class, WebAuthenticationDetailsMixin.class);
|
|
|
|
context.setMixInAnnotations(PreAuthenticatedAuthenticationToken.class, PreAuthenticatedAuthenticationTokenMixin.class);
|
|
context.setMixInAnnotations(PreAuthenticatedAuthenticationToken.class, PreAuthenticatedAuthenticationTokenMixin.class);
|
|
}
|
|
}
|
|
}
|
|
}
|