Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/CICD_DEVELOP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
echo "spring.security.oauth2.client.registration.google.client-id=${{ secrets.OAUTH2_GOOGLE_CLIENT_ID }}" >> ./src/main/resources/application-oauth2.properties
echo "spring.security.oauth2.client.registration.google.client-secret=${{ secrets.OAUTH2_GOOGLE_CLIENT_SECRET }}" >> ./src/main/resources/application-oauth2.properties
echo "spring.security.oauth2.client.registration.google.scope=${{ secrets.OAUTH2_GOOGLE_SCOPE }}" >> ./src/main/resources/application-oauth2.properties
printf "%s\n" "${{ secrets.OAUTH2_NAVER_PROPERTIES }}" >> ./src/main/resources/application-oauth2.properties

- name: Build with Gradle Wrapper
# run: ./gradlew test -i
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/CI_TEST.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
echo "spring.security.oauth2.client.registration.google.client-id=${{ secrets.OAUTH2_GOOGLE_CLIENT_ID }}" >> ./src/main/resources/application-oauth2.properties
echo "spring.security.oauth2.client.registration.google.client-secret=${{ secrets.OAUTH2_GOOGLE_CLIENT_SECRET }}" >> ./src/main/resources/application-oauth2.properties
echo "spring.security.oauth2.client.registration.google.scope=${{ secrets.OAUTH2_GOOGLE_SCOPE }}" >> ./src/main/resources/application-oauth2.properties
printf "%s\n" "${{ secrets.OAUTH2_NAVER_PROPERTIES }}" >> ./src/main/resources/application-oauth2.properties

- name: Build with Gradle Wrapper
run: ./gradlew build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import org.fontory.fontorybe.provide.domain.Provide;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.core.user.OAuth2User;
import org.springframework.security.web.DefaultRedirectStrategy;
import org.springframework.security.web.RedirectStrategy;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.stereotype.Component;

Expand All @@ -25,6 +27,7 @@ public class CustomOauth2SuccessHandler implements AuthenticationSuccessHandler
private final ObjectMapper objectMapper;
private final AuthService authService;
private final JwtTokenProvider jwtTokenProvider;
// private final RedirectStrategy redirectStrategy = new DefaultRedirectStrategy();

@Override
public void onAuthenticationSuccess(HttpServletRequest request,
Expand All @@ -43,6 +46,7 @@ public void onAuthenticationSuccess(HttpServletRequest request,
attributes.put("refreshToken", tokens.getRefreshToken());
}

// redirectStrategy.sendRedirect(request, response, "");
response.setContentType("application/json");
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().write(objectMapper.writeValueAsString(attributes));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public static Auth2UserInfo getOAuth2UserInfo(Provider provider, Map<String, Obj
case GOOGLE -> {
return new Auth2UserInfo((String) attributes.get(pk), Provider.GOOGLE, (String) attributes.get("email"));
}
case NAVER -> {
Map<String, Object> naverAttributes = (Map<String, Object>) attributes.get(pk);
return new Auth2UserInfo((String) naverAttributes.get("id"), Provider.NAVER, (String) naverAttributes.get("email"));
}
}
throw new ProviderNotFoundException(String.valueOf(provider));
}
Expand Down