This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 9de51cbd4c ISIS-3113: allow for
AuthenticationConverterOfOAuth2UserPrincipal to be customized by sub-classes
9de51cbd4c is described below
commit 9de51cbd4c563edd9d22cb5c141a855b96331306
Author: Andi Huber <[email protected]>
AuthorDate: Tue Aug 9 18:23:21 2022 +0200
ISIS-3113: allow for AuthenticationConverterOfOAuth2UserPrincipal to be
customized by sub-classes
---
.../AuthenticationConverterOfOAuth2UserPrincipal.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/extensions/security/spring-oauth2/src/main/java/org/apache/isis/extensions/spring/security/oauth2/authconverters/AuthenticationConverterOfOAuth2UserPrincipal.java
b/extensions/security/spring-oauth2/src/main/java/org/apache/isis/extensions/spring/security/oauth2/authconverters/AuthenticationConverterOfOAuth2UserPrincipal.java
index 95f89e6a4b..e1fac2f51c 100644
---
a/extensions/security/spring-oauth2/src/main/java/org/apache/isis/extensions/spring/security/oauth2/authconverters/AuthenticationConverterOfOAuth2UserPrincipal.java
+++
b/extensions/security/spring-oauth2/src/main/java/org/apache/isis/extensions/spring/security/oauth2/authconverters/AuthenticationConverterOfOAuth2UserPrincipal.java
@@ -51,14 +51,16 @@ extends AuthenticationConverter.Abstract<OAuth2User> {
.withRealName(realNameFrom(oAuth2User));
}
- protected static String usernameFrom(final OAuth2User oAuth2User) {
+ // -- HOOKS FOR CUSTOMIZATION
+
+ protected String usernameFrom(final OAuth2User oAuth2User) {
val loginAttr = oAuth2User.getAttributes().get("login");
return loginAttr instanceof CharSequence
? ((CharSequence) loginAttr).toString()
: oAuth2User.getName();
}
- protected static URL avatarUrlFrom(final OAuth2User oAuth2User) {
+ protected URL avatarUrlFrom(final OAuth2User oAuth2User) {
final Object avatarUrlObj =
oAuth2User.getAttributes().get("avatar_url");
if(avatarUrlObj instanceof String) {
try {
@@ -70,7 +72,7 @@ extends AuthenticationConverter.Abstract<OAuth2User> {
return null;
}
- protected static String realNameFrom(final OAuth2User oAuth2User) {
+ protected String realNameFrom(final OAuth2User oAuth2User) {
final Object nameAttr = oAuth2User.getAttributes().get("name");
if(nameAttr instanceof String) {
return (String)nameAttr;