Skip to content

Commit

Permalink
Redirect when Microsoft User already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima committed Apr 4, 2024
1 parent 85e1280 commit bfb307c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ public Authentication attemptAuthentication(HttpServletRequest request,
final UserDetails user = userDetailsService.loadUserByMicrosoftUserId(microsoftUserId);
invalidateAccessToken();
if (user != null) {
return new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities());
if (request.getAttribute("redirectUrl").toString().contains("join")) {
response.sendRedirect("/join/microsoftUserAlreadyExists");
return null;
} else {
return new UsernamePasswordAuthenticationToken(user, null, user.getAuthorities());
}
} else {
throw new MicrosoftUserNotFoundException("Microsoft user not found", authInfo);
}
Expand Down

0 comments on commit bfb307c

Please sign in to comment.