Skip to content

Commit 9987f97

Browse files
authored
Merge pull request #264 from CSE-Shaco/develop
test: add google login test
2 parents 303b53d + 188ba6a commit 9987f97

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package inha.gdgoc.domain.test.controller;
2+
3+
import inha.gdgoc.global.dto.response.ApiResponse;
4+
import java.util.Map;
5+
import org.springframework.http.ResponseEntity;
6+
import org.springframework.web.bind.annotation.CookieValue;
7+
import org.springframework.web.bind.annotation.GetMapping;
8+
import org.springframework.web.bind.annotation.RequestHeader;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.RestController;
11+
12+
@RestController
13+
@RequestMapping("/api/v1/test")
14+
public class TestController {
15+
16+
@GetMapping("/login_test")
17+
public ResponseEntity<ApiResponse<Map<String, Object>, Void>> loginTest(
18+
@CookieValue(value = "refresh_token", required = false) String refreshToken,
19+
@RequestHeader(value = "Authorization", required = false) String authorization
20+
) {
21+
boolean hasRefreshToken = refreshToken != null && !refreshToken.isBlank();
22+
boolean hasAuthorization = authorization != null && !authorization.isBlank();
23+
24+
Map<String, Object> data = Map.of(
25+
"has_refresh_token", hasRefreshToken,
26+
"has_authorization", hasAuthorization
27+
);
28+
29+
return ResponseEntity.ok(ApiResponse.ok("LOGIN_TEST_OK", data));
30+
}
31+
}

src/main/java/inha/gdgoc/global/security/SecurityConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
4545
"/v3/api-docs/**",
4646
"/swagger-ui.html",
4747
"/api/v1/auth/**",
48+
"/api/v1/test/**",
4849
"/api/v1/game/**",
4950
"/api/v1/apply/**",
5051
"/api/v1/check/**",

0 commit comments

Comments
 (0)