-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make OAuth2User extends OAuth2AuthenticatedPrincipal
Fixes gh-7378
- Loading branch information
1 parent
aa533c2
commit 91bf1c7
Showing
5 changed files
with
31 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -48,6 +48,7 @@ | |
* Tests for {@link CustomUserTypesOAuth2UserService}. | ||
* | ||
* @author Joe Grandja | ||
* @author Eddú Meléndez | ||
*/ | ||
public class CustomUserTypesOAuth2UserServiceTests { | ||
private ClientRegistration.Builder clientRegistrationBuilder; | ||
|
@@ -134,10 +135,10 @@ public void loadUserWhenUserInfoSuccessResponseThenReturnUser() { | |
|
||
assertThat(user.getName()).isEqualTo("first last"); | ||
assertThat(user.getAttributes().size()).isEqualTo(4); | ||
assertThat(user.getAttributes().get("id")).isEqualTo("12345"); | ||
assertThat(user.getAttributes().get("name")).isEqualTo("first last"); | ||
assertThat(user.getAttributes().get("login")).isEqualTo("user1"); | ||
assertThat(user.getAttributes().get("email")).isEqualTo("[email protected]"); | ||
assertThat((String) user.getAttribute("id")).isEqualTo("12345"); | ||
assertThat((String) user.getAttribute("name")).isEqualTo("first last"); | ||
assertThat((String) user.getAttribute("login")).isEqualTo("user1"); | ||
assertThat((String) user.getAttribute("email")).isEqualTo("[email protected]"); | ||
|
||
assertThat(user.getAuthorities().size()).isEqualTo(1); | ||
assertThat(user.getAuthorities().iterator().next().getAuthority()).isEqualTo("ROLE_USER"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -61,6 +61,7 @@ | |
* Tests for {@link DefaultOAuth2UserService}. | ||
* | ||
* @author Joe Grandja | ||
* @author Eddú Meléndez | ||
*/ | ||
public class DefaultOAuth2UserServiceTests { | ||
private ClientRegistration.Builder clientRegistrationBuilder; | ||
|
@@ -146,12 +147,12 @@ public void loadUserWhenUserInfoSuccessResponseThenReturnUser() { | |
|
||
assertThat(user.getName()).isEqualTo("user1"); | ||
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("[email protected]"); | ||
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("[email protected]"); | ||
|
||
assertThat(user.getAuthorities().size()).isEqualTo(1); | ||
assertThat(user.getAuthorities().iterator().next()).isInstanceOf(OAuth2UserAuthority.class); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
* you may not use this file except in compliance with the License. | ||
|
@@ -61,6 +61,7 @@ | |
|
||
/** | ||
* @author Rob Winch | ||
* @author Eddú Meléndez | ||
* @since 5.1 | ||
*/ | ||
public class DefaultReactiveOAuth2UserServiceTests { | ||
|
@@ -137,12 +138,12 @@ public void loadUserWhenUserInfoSuccessResponseThenReturnUser() throws Exception | |
|
||
assertThat(user.getName()).isEqualTo("user1"); | ||
assertThat(user.getAttributes().size()).isEqualTo(6); | ||
assertThat(user.getAttributes().get("id")).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("[email protected]"); | ||
assertThat((String) user.getAttribute("id")).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("[email protected]"); | ||
|
||
assertThat(user.getAuthorities().size()).isEqualTo(1); | ||
assertThat(user.getAuthorities().iterator().next()).isInstanceOf(OAuth2UserAuthority.class); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters