|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 |
|
17 | | -package org.springframework.security.oauth2.server.authorization.jackson; |
| 17 | +package org.springframework.security.jackson; |
18 | 18 |
|
19 | | -import java.util.List; |
| 19 | +import java.util.Collection; |
20 | 20 |
|
21 | 21 | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
22 | 22 | import com.fasterxml.jackson.annotation.JsonCreator; |
23 | | -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
24 | 23 | import com.fasterxml.jackson.annotation.JsonProperty; |
25 | 24 | import com.fasterxml.jackson.annotation.JsonTypeInfo; |
26 | 25 |
|
27 | | -import org.springframework.security.authentication.TestingAuthenticationToken; |
28 | 26 | import org.springframework.security.core.GrantedAuthority; |
29 | 27 |
|
30 | 28 | /** |
31 | | - * This mixin class is used to serialize/deserialize {@link TestingAuthenticationToken}. |
| 29 | + * This is a Jackson mixin class helps in serialize/deserialize |
| 30 | + * {@link org.springframework.security.authentication.AnonymousAuthenticationToken} class. |
32 | 31 | * |
33 | | - * @author Steve Riesenberg |
| 32 | + * @author Sebastien Deleuze |
| 33 | + * @author Jitendra Singh |
34 | 34 | * @since 7.0 |
35 | | - * @see TestingAuthenticationToken |
| 35 | + * @see CoreJacksonModule |
| 36 | + * @see SecurityJacksonModules |
36 | 37 | */ |
37 | 38 | @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) |
38 | | -@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, |
39 | | - isGetterVisibility = JsonAutoDetect.Visibility.NONE) |
40 | | -@JsonIgnoreProperties(value = { "authenticated" }, ignoreUnknown = true) |
41 | | -public class TestingAuthenticationTokenMixin { |
| 39 | +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, isGetterVisibility = JsonAutoDetect.Visibility.NONE, |
| 40 | + getterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.ANY) |
| 41 | +class TestingAuthenticationTokenMixin { |
42 | 42 |
|
| 43 | + /** |
| 44 | + * Constructor used by Jackson to create object of |
| 45 | + * {@link org.springframework.security.authentication.AnonymousAuthenticationToken}. |
| 46 | + * {@link org.springframework.security.authentication.AnonymousAuthenticationToken#AnonymousAuthenticationToken(String, Object, Collection)} |
| 47 | + * @param principal the principal (typically a <code>UserDetails</code>) |
| 48 | + * @param credentials the credentials |
| 49 | + * @param authorities the authorities granted to the principal |
| 50 | + */ |
43 | 51 | @JsonCreator |
44 | 52 | TestingAuthenticationTokenMixin(@JsonProperty("principal") Object principal, |
45 | 53 | @JsonProperty("credentials") Object credentials, |
46 | | - @JsonProperty("authorities") List<GrantedAuthority> authorities) { |
| 54 | + @JsonProperty("authorities") Collection<? extends GrantedAuthority> authorities) { |
47 | 55 | } |
48 | 56 |
|
49 | 57 | } |
0 commit comments