-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3a8817
commit 2706489
Showing
96 changed files
with
2,460 additions
and
2,070 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[[Auth-API]] | ||
== 인증 관련 API | ||
|
||
[[GGZZ-Signup]] | ||
=== 끄적 회원가입 | ||
|
||
operation::auth/ggzz-signup[snippets='http-request,request-fields,http-response'] | ||
|
||
[[GGZZ-Signin]] | ||
=== 끄적 로그인 | ||
|
||
operation::auth/ggzz-signup[snippets='http-request,request-fields,http-response'] | ||
|
||
[[GGZZ-Refresh]] | ||
=== JWT 토큰 재발급 | ||
|
||
operation::auth/ggzz-refresh[snippets='http-request,request-headers,http-response'] | ||
|
||
[[Provider-Signup]] | ||
=== 소셜 회원가입 | ||
|
||
operation::auth/provider-signup[snippets='http-request,request-fields,http-response'] | ||
|
||
[[Provider-Signin]] | ||
=== 소셜 로그인 | ||
|
||
operation::auth/provider-signin[snippets='http-request,request-fields,http-response'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[[Letter-Interaction-API]] | ||
== 끄적 상호작용 API | ||
|
||
[[Letter-Interaction-Like]] | ||
=== 끄적 좋아요하기 | ||
|
||
operation::letter-interaction/like[snippets='http-request,path-parameters,http-response'] | ||
|
||
[[Letter-Interaction-Delete-Like]] | ||
=== 끄적 좋아요 취소하기 | ||
|
||
operation::letter-interaction/delete-like[snippets='http-request,path-parameters,http-response'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[[My-Letter-API]] | ||
== 내 끄적 API | ||
|
||
[[My-Letter-List]] | ||
=== 내 끄적 목록 조회하기 | ||
|
||
operation::my-letter/list[snippets='http-request,http-response'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[[Letter-API]] | ||
== 끄적 기본 API | ||
|
||
[[Letter-Create]] | ||
=== 끄적 생성하기 | ||
|
||
operation::letter/create[snippets='http-request,request-parts,http-response'] | ||
|
||
[[Letter-List]] | ||
=== 끄적 목록 가져오기 | ||
|
||
operation::letter/list[snippets='http-request,query-parameters,http-response'] | ||
|
||
[[Letter-Detail]] | ||
=== 끄적 상세 가져오기 | ||
|
||
operation::letter/detail[snippets='http-request,query-parameters,http-response'] | ||
|
||
[[Letter-Delete]] | ||
=== 끄적 삭제하기 | ||
|
||
operation::letter/delete[snippets='http-request,path-parameters,http-response'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[[User-API]] | ||
== 회원 API | ||
|
||
[[User-Me]] | ||
=== 내 정보 조회하기 | ||
|
||
operation::user/me[snippets='http-request,http-response'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/controller/AuthController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.wafflestudio.ggzz.domain.auth.controller | ||
|
||
import com.wafflestudio.ggzz.domain.auth.dto.GgzzAuthResponse | ||
import com.wafflestudio.ggzz.domain.auth.dto.GgzzLoginRequest | ||
import com.wafflestudio.ggzz.domain.auth.dto.GgzzSignupRequest | ||
import com.wafflestudio.ggzz.domain.auth.dto.ProviderLoginRequest | ||
import com.wafflestudio.ggzz.domain.auth.exception.InvalidTokenException | ||
import com.wafflestudio.ggzz.domain.auth.service.AuthService | ||
import com.wafflestudio.ggzz.global.common.utils.JwtUtils | ||
import jakarta.servlet.http.HttpServletRequest | ||
import jakarta.validation.Valid | ||
import org.springframework.http.HttpHeaders | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/api/v1/auth") | ||
class AuthController( | ||
private val authService: AuthService | ||
) { | ||
|
||
@PostMapping("/ggzz/signup") | ||
fun signup(@RequestBody @Valid request: GgzzSignupRequest): GgzzAuthResponse { | ||
return authService.signup(request) | ||
} | ||
|
||
@PostMapping("/ggzz/login") | ||
fun login(@RequestBody @Valid request: GgzzLoginRequest): GgzzAuthResponse { | ||
return authService.login(request) | ||
} | ||
|
||
@PostMapping("/ggzz/refresh") | ||
fun refresh(request: HttpServletRequest): GgzzAuthResponse { | ||
request.getHeader(HttpHeaders.AUTHORIZATION)?.let { | ||
if (JwtUtils.isBearerToken(it)) | ||
return authService.refresh(it) | ||
|
||
throw InvalidTokenException() | ||
} ?: throw InvalidTokenException() | ||
} | ||
|
||
@PostMapping("/provider/signup") | ||
fun signupWithProvider(@RequestBody @Valid request: ProviderLoginRequest): GgzzAuthResponse { | ||
if (JwtUtils.isBearerToken(request.accessToken!!)) | ||
return authService.signupWithProvider(request) | ||
|
||
throw InvalidTokenException() | ||
} | ||
|
||
@PostMapping("/provider/login") | ||
fun loginWithProvider(@RequestBody @Valid request: ProviderLoginRequest): GgzzAuthResponse { | ||
if (JwtUtils.isBearerToken(request.accessToken!!)) | ||
return authService.loginWithProvider(request) | ||
|
||
throw InvalidTokenException() | ||
} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/dto/GgzzAuthResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.wafflestudio.ggzz.domain.auth.dto | ||
|
||
import com.wafflestudio.ggzz.domain.user.dto.UserBasicInfoResponse | ||
|
||
data class GgzzAuthResponse( | ||
val accessToken: String, | ||
val user: UserBasicInfoResponse? | ||
) |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/dto/GgzzLoginRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.wafflestudio.ggzz.domain.auth.dto | ||
|
||
import jakarta.validation.constraints.NotBlank | ||
|
||
data class GgzzLoginRequest( | ||
@field: NotBlank | ||
val ggzzId: String?, | ||
@field: NotBlank | ||
val password: String? | ||
) |
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/dto/GgzzSignupRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.wafflestudio.ggzz.domain.auth.dto | ||
|
||
import jakarta.validation.constraints.NotBlank | ||
|
||
data class GgzzSignupRequest( | ||
@field: NotBlank | ||
val ggzzId: String?, | ||
@field: NotBlank | ||
val username: String?, | ||
@field: NotBlank | ||
val password: String?, | ||
) |
12 changes: 12 additions & 0 deletions
12
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/dto/ProviderLoginRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.wafflestudio.ggzz.domain.auth.dto | ||
|
||
import com.wafflestudio.ggzz.domain.auth.model.Provider | ||
import jakarta.validation.constraints.NotBlank | ||
import jakarta.validation.constraints.NotNull | ||
|
||
data class ProviderLoginRequest( | ||
@field:NotBlank | ||
val accessToken: String?, | ||
@field:NotNull | ||
val provider: Provider?, | ||
) |
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/exception/DuplicateFirebaseIdException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.wafflestudio.ggzz.domain.auth.exception | ||
|
||
import com.wafflestudio.ggzz.global.common.exception.CustomException.ConflictException | ||
import com.wafflestudio.ggzz.global.common.exception.ErrorType.Conflict.DUPLICATE_FIREBASE_ID | ||
|
||
class DuplicateFirebaseIdException(id: String): ConflictException(DUPLICATE_FIREBASE_ID, "Firebase ID '$id' exists.") |
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/exception/DuplicateGgzzIdException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.wafflestudio.ggzz.domain.auth.exception | ||
|
||
import com.wafflestudio.ggzz.global.common.exception.CustomException.ConflictException | ||
import com.wafflestudio.ggzz.global.common.exception.ErrorType.Conflict.DUPLICATE_ID | ||
|
||
class DuplicateGgzzIdException(id: String): ConflictException(DUPLICATE_ID, "ID '$id' exists.") |
6 changes: 3 additions & 3 deletions
6
...r/exception/DuplicateUsernameException.kt → ...h/exception/DuplicateUsernameException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.wafflestudio.ggzz.domain.user.exception | ||
package com.wafflestudio.ggzz.domain.auth.exception | ||
|
||
import com.wafflestudio.ggzz.global.common.exception.CustomException.ConflictException | ||
import com.wafflestudio.ggzz.global.common.exception.ErrorType.Conflict.USERNAME_CONFLICT | ||
import com.wafflestudio.ggzz.global.common.exception.ErrorType.Conflict.DUPLICATE_USERNAME | ||
|
||
class DuplicateUsernameException(username: String): ConflictException(USERNAME_CONFLICT, "Username '$username' exists.") | ||
class DuplicateUsernameException(username: String): ConflictException(DUPLICATE_USERNAME, "Username '$username' exists.") |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/exception/InvalidProviderException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.wafflestudio.ggzz.domain.auth.exception | ||
|
||
import com.wafflestudio.ggzz.domain.auth.model.Provider | ||
import com.wafflestudio.ggzz.global.common.exception.CustomException.BadRequestException | ||
import com.wafflestudio.ggzz.global.common.exception.ErrorType.BadRequest.INVALID_PROVIDER | ||
|
||
class InvalidProviderException(provider: Provider): BadRequestException(INVALID_PROVIDER, "Invalid provider: $provider") |
4 changes: 2 additions & 2 deletions
4
...gzz/global/error/InvalidTokenException.kt → ...n/auth/exception/InvalidTokenException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.wafflestudio.ggzz.global.error | ||
package com.wafflestudio.ggzz.domain.auth.exception | ||
|
||
import com.wafflestudio.ggzz.global.common.exception.CustomException.BadRequestException | ||
import com.wafflestudio.ggzz.global.common.exception.ErrorType.BadRequest.INVALID_TOKEN | ||
|
||
class InvalidTokenException(type: String): BadRequestException(INVALID_TOKEN, "The $type token is invalid.") | ||
class InvalidTokenException: BadRequestException(INVALID_TOKEN, "Invalid token.") |
4 changes: 2 additions & 2 deletions
4
...in/user/exception/LoginFailedException.kt → ...in/auth/exception/LoginFailedException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.wafflestudio.ggzz.domain.user.exception | ||
package com.wafflestudio.ggzz.domain.auth.exception | ||
|
||
import com.wafflestudio.ggzz.global.common.exception.CustomException.UnauthorizedException | ||
import com.wafflestudio.ggzz.global.common.exception.ErrorType.Unauthorized.LOGIN_FAIL | ||
|
||
class LoginFailedException: UnauthorizedException(LOGIN_FAIL, "Login is failed") | ||
class LoginFailedException: UnauthorizedException(LOGIN_FAIL, "Login failed") |
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/wafflestudio/ggzz/domain/auth/exception/NoTokenException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.wafflestudio.ggzz.domain.auth.exception | ||
|
||
import com.wafflestudio.ggzz.global.common.exception.CustomException | ||
import com.wafflestudio.ggzz.global.common.exception.ErrorType.Unauthorized.NO_TOKEN | ||
|
||
class NoTokenException: CustomException.UnauthorizedException(NO_TOKEN, "Token doesn't exist.") |
2 changes: 1 addition & 1 deletion
2
...io/ggzz/global/error/WrongAPIException.kt → ...omain/auth/exception/WrongAPIException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.