Skip to content

Commit

Permalink
Merge pull request #132 from dnd-side-project/hotfix/#131
Browse files Browse the repository at this point in the history
Change oauth handling method
  • Loading branch information
miraexhoi authored Sep 15, 2024
2 parents bbda6f2 + 218c3b5 commit 318361c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.springframework.security.oauth2.core.user.OAuth2User;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.util.UriComponentsBuilder;

@RequiredArgsConstructor
public class OAuth2SuccessHandler implements AuthenticationSuccessHandler {
Expand Down Expand Up @@ -85,6 +86,12 @@ private void writeResponse(HttpServletResponse response, String accessToken, boo
response.setCharacterEncoding(StandardCharsets.UTF_8.name());

try {
String redirectUrl = UriComponentsBuilder.fromUriString("http://localhost:3000/home")
.queryParam("accessToken", accessToken)
.queryParam("isSignUp", isSignUp)
.build().toUriString();

response.sendRedirect(redirectUrl);
PrintWriter writer = response.getWriter();

writer.println(objectMapper.writeValueAsString(new LoginResponse(accessToken, isSignUp)));
Expand Down

0 comments on commit 318361c

Please sign in to comment.