Skip to content

Commit c92a4a0

Browse files
committed
Default AuthenticatedPrincipal.getName implementation
1 parent 464b078 commit c92a4a0

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/OAuth2AuthenticatedPrincipal.java

+5
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,9 @@ default <A> A getAttribute(String name) {
6464
*/
6565
String getNameAttributeKey();
6666

67+
@Override
68+
default String getName() {
69+
return getAttribute(getNameAttributeKey()).toString();
70+
}
71+
6772
}

oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/user/DefaultOAuth2User.java

-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ public DefaultOAuth2User(Collection<? extends GrantedAuthority> authorities, Map
7979
this.nameAttributeKey = nameAttributeKey;
8080
}
8181

82-
@Override
83-
public String getName() {
84-
return this.getAttribute(this.nameAttributeKey).toString();
85-
}
86-
8782
@Override
8883
public Collection<? extends GrantedAuthority> getAuthorities() {
8984
return this.authorities;

0 commit comments

Comments
 (0)