8000 [BE] 테스트 서버 배포 by koust6u · Pull Request #732 · woowacourse-teams/2024-coduo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[BE] 테스트 서버 배포 #732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 8, 2024
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package site.coduo.member.controller;


import static site.coduo.common.config.web.filter.StateSessionFilter.STATE_SESSION_EXPIRE_IN_SECOND;
import static site.coduo.common.config.web.filter.StateSessionFilter.STATE_SESSION_NAME;
import static site.coduo.member.controller.AuthController.PRODUCT_DOMAIN;

import java.net.URI;
Expand All @@ -26,7 +24,6 @@
import site.coduo.member.service.dto.oauth.GithubAuthQuery;
import site.coduo.member.service.dto.oauth.GithubAuthUri;
import site.coduo.member.service.dto.oauth.GithubCallbackQuery;
import site.coduo.member.service.dto.oauth.GithubOAuthEndpoint;

@Slf4j
@RequiredArgsConstructor
Expand All @@ -39,14 +36,13 @@ public class GithubOAuthController implements GithubOAuthControllerDocs {
private String frontUrl;

@GetMapping("/sign-in/oauth/github")
public ResponseEntity<GithubOAuthEndpoint> getGithubAuthCode(final HttpSession session) {
public ResponseEntity<Void> getGithubAuthCode(final HttpSession session) {
final GithubAuthQuery query = githubOAuthService.createAuthorizationContent();
final GithubAuthUri githubAuthUri = new GithubAuthUri(query);

session.setAttribute(STATE_SESSION_NAME, query.state());
session.setMaxInactiveInterval(STATE_SESSION_EXPIRE_IN_SECOND);
return ResponseEntity.ok()
.body(new GithubOAuthEndpoint(githubAuthUri.toPlainText()));
return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT)
.location(URI.create(githubAuthUri.toPlainText()))
.build();
}

@GetMapping("/github/callback")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import site.coduo.common.controller.response.ApiErrorResponse;
import site.coduo.member.service.dto.oauth.GithubCallbackQuery;
import site.coduo.member.service.dto.oauth.GithubOAuthEndpoint;

@Tag(name = "깃허브 OAuth API")
public interface GithubOAuthControllerDocs {

@Operation(summary = "깃허브 인가엔드 포인트 URI 호출",
responses = {
@ApiResponse(responseCode = "200", description = "깃허브 측 인가 엔드포인트 및 관련 Query 담은 URI",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = GithubOAuthEndpoint.class))),
@ApiResponse(responseCode = "307", description = "깃허브 측 인가 엔드 포인트로 redirect"),
@ApiResponse(responseCode = "401", description = "인증 실패",
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = ApiErrorResponse.class)))
}
)
ResponseEntity<GithubOAuthEndpoint> getGithubAuthCode(@Parameter(hidden = true) HttpSession session);
ResponseEntity<Void> getGithubAuthCode(@Parameter(hidden = true) HttpSession session);

@ApiResponse(responseCode = "200")
@ApiResponse(responseCode = "401", description = "인증 실패",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package site.coduo.acceptance;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;

import static site.coduo.common.config.web.filter.AccessTokenCookieFilter.TEMPORARY_ACCESS_TOKEN_COOKIE_NAME;

import java.util.Map;

import org.apache.http.HttpStatus;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;

import io.restassured.RestAssured;
import site.coduo.fake.FakeGithubApiClient;
Expand Down Expand Up @@ -51,9 +47,9 @@ void request_to_github_authorization_end_point() {

.then().log().all()
.assertThat()
.statusCode(HttpStatus.SC_OK)
.body("endpoint",
is("https://www.github.com/login/oauth/authorize?client_id=test&state=randomNumber&redirect_uri=http://test.test"));
.statusCode(307)
.header("Location",
"https://www.github.com/login/oauth/authorize?client_id=test&state=randomNumber&redirect_uri=http://test.test");
}

@Test
Expand All @@ -68,8 +64,7 @@ void call_github_authorize_endpoint() {
.get("/api/sign-in/oauth/github")

.then().log().all()
.statusCode(HttpStatus.SC_OK)
.header(HttpHeaders.SET_COOKIE, containsString("JSESSIONID"));
.statusCode(307);
}

@Test
Expand Down
0