|
@@ -1,5 +1,5 @@
|
|
/*
|
|
/*
|
|
- * Copyright 2002-2018 the original author or authors.
|
|
|
|
|
|
+ * Copyright 2002-2019 the original author or authors.
|
|
*
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* you may not use this file except in compliance with the License.
|
|
@@ -61,6 +61,7 @@ import static org.springframework.security.oauth2.core.TestOAuth2AccessTokens.sc
|
|
* Tests for {@link DefaultOAuth2UserService}.
|
|
* Tests for {@link DefaultOAuth2UserService}.
|
|
*
|
|
*
|
|
* @author Joe Grandja
|
|
* @author Joe Grandja
|
|
|
|
+ * @author Eddú Meléndez
|
|
*/
|
|
*/
|
|
public class DefaultOAuth2UserServiceTests {
|
|
public class DefaultOAuth2UserServiceTests {
|
|
private ClientRegistration.Builder clientRegistrationBuilder;
|
|
private ClientRegistration.Builder clientRegistrationBuilder;
|
|
@@ -146,12 +147,12 @@ public class DefaultOAuth2UserServiceTests {
|
|
|
|
|
|
assertThat(user.getName()).isEqualTo("user1");
|
|
assertThat(user.getName()).isEqualTo("user1");
|
|
assertThat(user.getAttributes().size()).isEqualTo(6);
|
|
assertThat(user.getAttributes().size()).isEqualTo(6);
|
|
- assertThat(user.getAttributes().get("user-name")).isEqualTo("user1");
|
|
|
|
- assertThat(user.getAttributes().get("first-name")).isEqualTo("first");
|
|
|
|
- assertThat(user.getAttributes().get("last-name")).isEqualTo("last");
|
|
|
|
- assertThat(user.getAttributes().get("middle-name")).isEqualTo("middle");
|
|
|
|
- assertThat(user.getAttributes().get("address")).isEqualTo("address");
|
|
|
|
- assertThat(user.getAttributes().get("email")).isEqualTo("user1@example.com");
|
|
|
|
|
|
+ assertThat((String) user.getAttribute("user-name")).isEqualTo("user1");
|
|
|
|
+ assertThat((String) user.getAttribute("first-name")).isEqualTo("first");
|
|
|
|
+ assertThat((String) user.getAttribute("last-name")).isEqualTo("last");
|
|
|
|
+ assertThat((String) user.getAttribute("middle-name")).isEqualTo("middle");
|
|
|
|
+ assertThat((String) user.getAttribute("address")).isEqualTo("address");
|
|
|
|
+ assertThat((String) user.getAttribute("email")).isEqualTo("user1@example.com");
|
|
|
|
|
|
assertThat(user.getAuthorities().size()).isEqualTo(1);
|
|
assertThat(user.getAuthorities().size()).isEqualTo(1);
|
|
assertThat(user.getAuthorities().iterator().next()).isInstanceOf(OAuth2UserAuthority.class);
|
|
assertThat(user.getAuthorities().iterator().next()).isInstanceOf(OAuth2UserAuthority.class);
|