Skip to content

Commit a0418b6

Browse files
committed
removed keycloak support from custom oauth2 user service
1 parent 63e8315 commit a0418b6

1 file changed

Lines changed: 0 additions & 22 deletions

File tree

src/main/java/com/digitalsanctuary/spring/user/service/DSOAuth2UserService.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public User handleOAuthLoginSuccess(String registrationId, OAuth2User oAuth2User
5858
} else if (registrationId.equalsIgnoreCase("facebook")) {
5959
user = getUserFromFacebookOAuth2User(oAuth2User);
6060
} else if (registrationId.equalsIgnoreCase("keycloak")) {
61-
user = getUserFromKeycloakOAuth2User(oAuth2User);
6261
} else {
6362
log.error("Sorry! Login with " + registrationId + " is not supported yet.");
6463
throw new OAuth2AuthenticationException(new OAuth2Error("Login Exception"),
@@ -143,27 +142,6 @@ public User getUserFromGoogleOAuth2User(OAuth2User principal) {
143142
return user;
144143
}
145144

146-
/**
147-
*
148-
* Retrieves user information from a Keycloak OAuth2User object.
149-
*
150-
* @param principal The OAuth2User object containing information about the authenticated user.
151-
* @return A User object representing the authenticated user.
152-
*/
153-
public User getUserFromKeycloakOAuth2User(OAuth2User principal) {
154-
log.debug("Getting user info from Keycloak OAuth2 provider with principal: {}", principal);
155-
if (principal == null) {
156-
return null;
157-
}
158-
log.debug("Principal attributes: {}", principal.getAttributes());
159-
User user = new User();
160-
user.setEmail(principal.getAttribute("email"));
161-
user.setFirstName(principal.getAttribute("given_name"));
162-
user.setLastName(principal.getAttribute("family_name"));
163-
user.setProvider(User.Provider.KEYCLOAK);
164-
return user;
165-
}
166-
167145
/**
168146
* Retrieves user information from a Facebook OAuth2User object.
169147
*

0 commit comments

Comments
 (0)