1
0
mirror of synced 2026-08-05 09:47:05 +00:00

Polish JSON warnings / javadoc

Issue gh-3736
This commit is contained in:
Rob Winch
2016-09-01 14:50:42 -05:00
parent 6d2003722e
commit 6f2b24a62b
9 changed files with 20 additions and 23 deletions
@@ -38,7 +38,7 @@ import java.util.Collections;
* ObjectMapper mapper = new ObjectMapper();
* mapper.registerModule(new CoreJackson2Module());
* </pre>
* <b>Note: use {@link SecurityJacksonModules#getModules()} to get list of all security modules.</b>
* <b>Note: use {@link SecurityJacksonModules#getModules(ClassLoader)} to get list of all security modules.</b>
*
* @author Jitendra Singh.
* @see SecurityJacksonModules
@@ -56,7 +56,7 @@ public class CoreJackson2Module extends SimpleModule {
context.setMixInAnnotations(AnonymousAuthenticationToken.class, AnonymousAuthenticationTokenMixin.class);
context.setMixInAnnotations(RememberMeAuthenticationToken.class, RememberMeAuthenticationTokenMixin.class);
context.setMixInAnnotations(SimpleGrantedAuthority.class, SimpleGrantedAuthorityMixin.class);
context.setMixInAnnotations(Collections.unmodifiableSet(Collections.EMPTY_SET).getClass(), UnmodifiableSetMixin.class);
context.setMixInAnnotations(Collections.<Object>unmodifiableSet(Collections.emptySet()).getClass(), UnmodifiableSetMixin.class);
context.setMixInAnnotations(User.class, UserMixin.class);
context.setMixInAnnotations(UsernamePasswordAuthenticationToken.class, UsernamePasswordAuthenticationTokenMixin.class);
}
@@ -40,8 +40,8 @@ class UnmodifiableSetMixin {
/**
* Mixin Constructor
* @param s
* @param s the Set
*/
@JsonCreator
UnmodifiableSetMixin(Set s) {}
UnmodifiableSetMixin(Set<?> s) {}
}
@@ -46,11 +46,11 @@ class UserDeserializer extends JsonDeserializer<User> {
* serialized json, because credentials may be removed from the {@link User} by invoking {@link User#eraseCredentials()}.
* In that case there won't be any password key in serialized json.
*
* @param jp
* @param ctxt
* @return
* @throws IOException
* @throws JsonProcessingException
* @param jp the JsonParser
* @param ctxt the DeserializationContext
* @return the user
* @throws IOException if a exception during IO occurs
* @throws JsonProcessingException if an error during JSON processing occurs
*/
@Override
public User deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
@@ -47,11 +47,11 @@ class UsernamePasswordAuthenticationTokenDeserializer extends JsonDeserializer<U
/**
* This method construct {@link UsernamePasswordAuthenticationToken} object from serialized json.
* @param jp
* @param ctxt
* @return
* @throws IOException
* @throws JsonProcessingException
* @param jp the JsonParser
* @param ctxt the DeserializationContext
* @return the user
* @throws IOException if a exception during IO occurs
* @throws JsonProcessingException if an error during JSON processing occurs
*/
@Override
public UsernamePasswordAuthenticationToken deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
@@ -18,12 +18,8 @@ package org.springframework.security.jackson2;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.json.JSONException;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.security.core.authority.SimpleGrantedAuthority;