Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

[WEAV-70] 소셜 로그인 API, 회원가입 필요 응답 상태코드 401 명세 #22

Merged
merged 2 commits into from
Jan 27, 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
Expand Up @@ -6,8 +6,13 @@ import com.studentcenter.weave.bootstrap.adapter.dto.SocialLoginRequest
import com.studentcenter.weave.bootstrap.adapter.dto.SocialLoginResponse
import com.studentcenter.weave.domain.enum.SocialLoginProvider
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.media.Content
import io.swagger.v3.oas.annotations.media.Schema
import io.swagger.v3.oas.annotations.responses.ApiResponse
import io.swagger.v3.oas.annotations.responses.ApiResponses
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
Expand All @@ -20,11 +25,38 @@ interface AuthApi {

@Operation(summary = "Social Login")
@PostMapping("/login/{provider}")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(
value = [
ApiResponse(
responseCode = "200",
description = "로그인 성공",
content = [
Content(
mediaType = "application/json",
schema = Schema(
implementation = SocialLoginResponse.Success::class
)
),
]
),
ApiResponse(
responseCode = "401",
description = "회원가입 필요",
content = [
Content(
mediaType = "application/json",
schema = Schema(
implementation = SocialLoginResponse.UserNotRegistered::class
)
),
]
),
]
)
fun socialLogin(
@PathVariable provider: SocialLoginProvider,
@RequestBody request: SocialLoginRequest,
): SocialLoginResponse
): ResponseEntity<SocialLoginResponse>

@Operation(summary = "Refresh Login Token")
@PostMapping("/refresh")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.studentcenter.weave.bootstrap.adapter.dto.RefreshTokenRequest
import com.studentcenter.weave.bootstrap.adapter.dto.SocialLoginRequest
import com.studentcenter.weave.bootstrap.adapter.dto.SocialLoginResponse
import com.studentcenter.weave.domain.enum.SocialLoginProvider
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.RestController

@RestController
Expand All @@ -14,11 +15,12 @@ class AuthRestController : AuthApi {
override fun socialLogin(
provider: SocialLoginProvider,
request: SocialLoginRequest,
): SocialLoginResponse {
return SocialLoginResponse.Success(
): ResponseEntity<SocialLoginResponse> {
val success = SocialLoginResponse.Success(
accessToken = "test_access_token",
refreshToken = "test_refresh_token",
)
return ResponseEntity.ok(success)
Comment on lines +18 to +23
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UseCase구현 완료되면 의존성 추가하면서 회원가입 필요한 경우 에대한 분기처리 구현 예정이에요

}

override fun refreshLoginToken(
Expand Down
Loading