Skip to content

Commit

Permalink
Revert "Default AuthenticatedPrincipal.getName implementation"
Browse files Browse the repository at this point in the history
This reverts commit 25f8bec.
  • Loading branch information
andreblanke committed Dec 8, 2024
1 parent 25f8bec commit 88b0d4d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public DefaultOAuth2AuthenticatedPrincipal(String name, Map<String, Object> attr
this.attributes = Collections.unmodifiableMap(attributes);
this.authorities = (authorities != null) ? Collections.unmodifiableCollection(authorities)
: AuthorityUtils.NO_AUTHORITIES;
this.name = (name != null) ? name : (String) this.attributes.get("sub");
this.name = (name != null) ? name : (String) this.attributes.get(this.getNameAttributeKey());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,4 @@ default <A> A getAttribute(String name) {
*/
String getNameAttributeKey();

@Override
default String getName() {
return getAttribute(getNameAttributeKey()).toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public DefaultOAuth2User(Collection<? extends GrantedAuthority> authorities, Map
this.nameAttributeKey = nameAttributeKey;
}

@Override
public String getName() {
return this.getAttribute(this.nameAttributeKey).toString();
}

@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return this.authorities;
Expand Down

0 comments on commit 88b0d4d

Please sign in to comment.