Skip to content

Commit a2f482b

Browse files
committed
Merge pull request spring-projects#5053 from spauk/master
* pull5053: Make UserInfoTokenServices.getPrincipal protected
2 parents b1656be + 8542f4f commit a2f482b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/UserInfoTokenServices.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ private OAuth2Authentication extractAuthentication(Map<String, Object> map) {
9999
return new OAuth2Authentication(request, token);
100100
}
101101

102-
private Object getPrincipal(Map<String, Object> map) {
102+
/**
103+
* Return the principal that should be used for the token. The default implementation
104+
* looks for well know {@code user*} keys in the map.
105+
* @param map the source map
106+
* @return the principal or {@literal "unknown"}
107+
*/
108+
protected Object getPrincipal(Map<String, Object> map) {
103109
for (String key : PRINCIPAL_KEYS) {
104110
if (map.containsKey(key)) {
105111
return map.get(key);

0 commit comments

Comments
 (0)