From fb08171b899f65eac9cdb40ef5111a6048f73436 Mon Sep 17 00:00:00 2001 From: hyena Date: Thu, 3 Aug 2023 14:22:28 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20Oauth=20API=20prefix=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EA=B9=83=ED=97=88=EB=B8=8C=20=EC=86=8C?= =?UTF-8?q?=EC=85=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20Http=20Method=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../touch/baton/domain/oauth/controller/OauthController.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/baton/src/main/java/touch/baton/domain/oauth/controller/OauthController.java b/backend/baton/src/main/java/touch/baton/domain/oauth/controller/OauthController.java index 29bcf7b29..82211532d 100644 --- a/backend/baton/src/main/java/touch/baton/domain/oauth/controller/OauthController.java +++ b/backend/baton/src/main/java/touch/baton/domain/oauth/controller/OauthController.java @@ -5,7 +5,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -18,7 +17,7 @@ import static org.springframework.http.HttpStatus.FOUND; @RequiredArgsConstructor -@RequestMapping("/oauth") +@RequestMapping("/api/v1/oauth") @RestController public class OauthController { @@ -34,7 +33,7 @@ public ResponseEntity redirectAuthCode(@PathVariable("oauthType") final Oa return ResponseEntity.status(FOUND).build(); } - @PostMapping("/login/{oauthType}") + @GetMapping("/login/{oauthType}") public ResponseEntity login(@PathVariable final OauthType oauthType, @RequestParam final String code ) { From 475242e9508836672952f1219e701580b0cee238 Mon Sep 17 00:00:00 2001 From: hyena Date: Thu, 3 Aug 2023 14:29:01 +0900 Subject: [PATCH 2/2] =?UTF-8?q?test:=20Oauth=20Api=20Test=20prefix=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../baton/document/oauth/github/GithubOauthApiTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/baton/src/test/java/touch/baton/document/oauth/github/GithubOauthApiTest.java b/backend/baton/src/test/java/touch/baton/document/oauth/github/GithubOauthApiTest.java index 3fc2dd30c..dd0e3c89c 100644 --- a/backend/baton/src/test/java/touch/baton/document/oauth/github/GithubOauthApiTest.java +++ b/backend/baton/src/test/java/touch/baton/document/oauth/github/GithubOauthApiTest.java @@ -18,7 +18,6 @@ import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName; import static org.springframework.restdocs.headers.HeaderDocumentation.responseHeaders; import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName; import static org.springframework.restdocs.request.RequestDocumentation.pathParameters; import static org.springframework.restdocs.request.RequestDocumentation.queryParameters; @@ -46,7 +45,7 @@ void github_redirect_auth_code() throws Exception { .thenReturn(githubOauthConfig.redirectUri()); // then - mockMvc.perform(get("/oauth/{oauthType}", "github")) + mockMvc.perform(get("/api/v1/oauth/{oauthType}", "github")) .andExpect(status().is3xxRedirection()) .andExpect(redirectedUrl(githubOauthConfig.redirectUri())) .andDo(restDocs.document( @@ -65,7 +64,7 @@ void github_login() throws Exception { .thenReturn("Bearer Jwt"); // then - mockMvc.perform(post("/oauth/login/{oauthType}", "github") + mockMvc.perform(get("/api/v1/oauth/login/{oauthType}", "github") .queryParam("code", "authcode") .contentType(APPLICATION_JSON) .characterEncoding(UTF_8)