parent
3531cc93c2
commit
8ad0003456
|
@ -54,7 +54,7 @@ public class CasAuthenticationTokenMixinTests {
|
|||
public static final String AUTHORITY_JSON = "{\"@class\": \"org.springframework.security.core.authority.SimpleGrantedAuthority\", \"authority\": \"ROLE_USER\"}";
|
||||
|
||||
public static final String AUTHORITIES_SET_JSON = "[\"java.util.Collections$UnmodifiableSet\", [" + AUTHORITY_JSON + "]]";
|
||||
|
||||
|
||||
public static final String AUTHORITIES_ARRAYLIST_JSON = "[\"java.util.ArrayList\", [" + AUTHORITY_JSON + "]]";
|
||||
|
||||
// @formatter:off
|
||||
|
@ -64,15 +64,15 @@ public class CasAuthenticationTokenMixinTests {
|
|||
+ " \"password\": " + PASSWORD + ", "
|
||||
+ "\"accountNonExpired\": true, "
|
||||
+ "\"accountNonLocked\": true, "
|
||||
+ "\"credentialsNonExpired\": true, "
|
||||
+ "\"credentialsNonExpired\": true, "
|
||||
+ "\"enabled\": true, "
|
||||
+ "\"authorities\": " + AUTHORITIES_SET_JSON
|
||||
+ "\"authorities\": " + AUTHORITIES_SET_JSON
|
||||
+ "}";
|
||||
// @formatter:on
|
||||
|
||||
|
||||
private static final String CAS_TOKEN_JSON = "{"
|
||||
+ "\"@class\": \"org.springframework.security.cas.authentication.CasAuthenticationToken\", "
|
||||
+ "\"keyHash\": " + KEY.hashCode() + ","
|
||||
+ "\"keyHash\": " + KEY.hashCode() + ","
|
||||
+ "\"principal\": " + USER_JSON + ", "
|
||||
+ "\"credentials\": " + PASSWORD + ", "
|
||||
+ "\"authorities\": " + AUTHORITIES_ARRAYLIST_JSON + ","
|
||||
|
@ -87,7 +87,7 @@ public class CasAuthenticationTokenMixinTests {
|
|||
+ "\"attributes\": {\"@class\": \"java.util.Collections$EmptyMap\"}, "
|
||||
+ "\"proxyGrantingTicket\": null, "
|
||||
+ "\"proxyRetriever\": null"
|
||||
+ "}, "
|
||||
+ "}, "
|
||||
+ "\"validFromDate\": [\"java.util.Date\", " + START_DATE.getTime() + "], "
|
||||
+ "\"validUntilDate\": [\"java.util.Date\", " + END_DATE.getTime() + "],"
|
||||
+ "\"authenticationDate\": [\"java.util.Date\", " + START_DATE.getTime() + "], "
|
||||
|
|
|
@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
public class AnonymousAuthenticationTokenMixinTests extends AbstractMixinTests {
|
||||
|
||||
private static final String HASH_KEY = "key";
|
||||
|
||||
|
||||
// @formatter:off
|
||||
private static final String ANONYMOUS_JSON = "{"
|
||||
+ "\"@class\": \"org.springframework.security.authentication.AnonymousAuthenticationToken\", "
|
||||
|
@ -49,7 +49,6 @@ public class AnonymousAuthenticationTokenMixinTests extends AbstractMixinTests {
|
|||
+ "}";
|
||||
// @formatter:on
|
||||
|
||||
|
||||
@Test
|
||||
public void serializeAnonymousAuthenticationTokenTest() throws JsonProcessingException, JSONException {
|
||||
User user = createDefaultUser();
|
||||
|
|
|
@ -47,9 +47,9 @@ public class UserDeserializerTests extends AbstractMixinTests {
|
|||
+ " \"password\": "+ USER_PASSWORD +", "
|
||||
+ "\"accountNonExpired\": true, "
|
||||
+ "\"accountNonLocked\": true, "
|
||||
+ "\"credentialsNonExpired\": true, "
|
||||
+ "\"credentialsNonExpired\": true, "
|
||||
+ "\"enabled\": true, "
|
||||
+ "\"authorities\": " + SimpleGrantedAuthorityMixinTests.AUTHORITIES_SET_JSON
|
||||
+ "\"authorities\": " + SimpleGrantedAuthorityMixinTests.AUTHORITIES_SET_JSON
|
||||
+ "}";
|
||||
// @formatter:on
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class UserDeserializerTests extends AbstractMixinTests {
|
|||
@Test
|
||||
public void deserializeUserWithNullPasswordNoAuthorityTest() throws Exception {
|
||||
String userJsonWithoutPasswordString = removeNode(userWithNoAuthoritiesJson(), mapper, "password");
|
||||
|
||||
|
||||
User user = mapper.readValue(userJsonWithoutPasswordString, User.class);
|
||||
assertThat(user).isNotNull();
|
||||
assertThat(user.getUsername()).isEqualTo("admin");
|
||||
|
@ -113,7 +113,7 @@ public class UserDeserializerTests extends AbstractMixinTests {
|
|||
public static String userJson() {
|
||||
return USER_JSON;
|
||||
}
|
||||
|
||||
|
||||
public static String userWithPasswordJson(String password) {
|
||||
return userJson().replaceAll(Pattern.quote(USER_PASSWORD), "\""+ password +"\"");
|
||||
}
|
||||
|
|
|
@ -36,12 +36,12 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
public class UsernamePasswordAuthenticationTokenMixinTests extends AbstractMixinTests {
|
||||
// @formatter:off
|
||||
private static final String AUTHENTICATED_JSON = "{"
|
||||
+ "\"@class\": \"org.springframework.security.authentication.UsernamePasswordAuthenticationToken\","
|
||||
+ "\"@class\": \"org.springframework.security.authentication.UsernamePasswordAuthenticationToken\","
|
||||
+ "\"principal\": "+ UserDeserializerTests.USER_JSON + ", "
|
||||
+ "\"credentials\": \"1234\", "
|
||||
+ "\"authenticated\": true, "
|
||||
+ "\"details\": null, "
|
||||
+ "\"authorities\": "+ SimpleGrantedAuthorityMixinTests.AUTHORITIES_ARRAYLIST_JSON
|
||||
+ "\"authorities\": "+ SimpleGrantedAuthorityMixinTests.AUTHORITIES_ARRAYLIST_JSON
|
||||
+ "}";
|
||||
// @formatter:on
|
||||
|
||||
|
@ -120,4 +120,4 @@ public class UsernamePasswordAuthenticationTokenMixinTests extends AbstractMixin
|
|||
UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(user, user.getPassword(), user.getAuthorities());
|
||||
return token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
public class DefaultSavedRequestMixinTests extends AbstractMixinTests {
|
||||
|
||||
|
||||
|
||||
// @formatter:off
|
||||
private static final String COOKIES_JSON = "[\"java.util.ArrayList\", [{"
|
||||
+ "\"@class\": \"org.springframework.security.web.savedrequest.SavedCookie\", "
|
||||
|
|
|
@ -52,8 +52,8 @@ public class SavedCookieMixinTests extends AbstractMixinTests {
|
|||
// @formatter:on
|
||||
|
||||
// @formatter:off
|
||||
private static final String COOKIES_JSON = "[\"java.util.ArrayList\", ["
|
||||
+ COOKIE_JSON
|
||||
private static final String COOKIES_JSON = "[\"java.util.ArrayList\", ["
|
||||
+ COOKIE_JSON
|
||||
+ "]]";
|
||||
// @formatter:on
|
||||
|
||||
|
|
Loading…
Reference in New Issue