-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore : OpenFeign 설정 * chore : User authPlatform 필드 추가 * chore : User authPlatform 필드 추가 * chore : 회원 탈퇴 API * chore : 회원 탈퇴 Use case * chore : 탈퇴 관련 port 구현 * chore : User 쿼리 수정 및 추가 * chore : 탈퇴 Dto * chore : 탈퇴 관련 에러코드 * feat : UserInfo 수정에 따른 작업 * feat : 에러로그 추가 * feat : 회원탈퇴 시 컨텐츠 삭제 기능 추가
- Loading branch information
1 parent
d4c6d7c
commit 1f6ccf5
Showing
29 changed files
with
354 additions
and
37 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
16 changes: 16 additions & 0 deletions
16
adapters/in-web/src/main/kotlin/com/pokit/auth/dto/request/ApiRevokeRequest.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,16 @@ | ||
package com.pokit.auth.dto.request | ||
|
||
import com.pokit.token.dto.request.RevokeRequest | ||
import com.pokit.token.model.AuthPlatform | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
data class ApiRevokeRequest( | ||
@Schema(description = "플랫폼에서 받은 인가코드") | ||
val authorizationCode: String, | ||
val authPlatform: String | ||
) | ||
|
||
internal fun ApiRevokeRequest.toDto() = RevokeRequest( | ||
authorizationCode = this.authorizationCode, | ||
authPlatform = AuthPlatform.of(this.authPlatform) | ||
) |
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
Empty file.
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 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 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 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 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 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,5 +1,6 @@ | ||
package com.pokit.user | ||
|
||
import com.pokit.token.model.AuthPlatform | ||
import com.pokit.user.dto.UserInfo | ||
import com.pokit.user.dto.request.SignUpRequest | ||
import com.pokit.user.model.InterestType | ||
|
@@ -8,11 +9,11 @@ import com.pokit.user.model.User | |
|
||
class UserFixture { | ||
companion object { | ||
fun getUser() = User(1L, "[email protected]", Role.USER) | ||
fun getUser() = User(1L, "[email protected]", Role.USER, authPlatform = AuthPlatform.GOOGLE) | ||
|
||
fun getUserInfo() = UserInfo("[email protected]") | ||
fun getUserInfo() = UserInfo("[email protected]", AuthPlatform.GOOGLE) | ||
|
||
fun getInvalidUser() = User(2L, "[email protected]", Role.USER) | ||
fun getInvalidUser() = User(2L, "[email protected]", Role.USER, authPlatform = AuthPlatform.GOOGLE) | ||
|
||
fun getSignUpRequest() = SignUpRequest("인주니", listOf(InterestType.SPORTS)) | ||
} | ||
|
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
27 changes: 27 additions & 0 deletions
27
adapters/out-web/src/main/kotlin/com/pokit/auth/common/config/OpenFeignConfig.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,27 @@ | ||
package com.pokit.auth.common.config | ||
|
||
import feign.Logger | ||
import feign.RequestInterceptor | ||
import feign.RequestTemplate | ||
import feign.form.ContentProcessor.CONTENT_TYPE_HEADER | ||
import org.springframework.cloud.openfeign.EnableFeignClients | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.http.MediaType | ||
|
||
@Configuration | ||
@EnableFeignClients(basePackages = ["com.pokit"]) | ||
class OpenFeignConfig { | ||
@Bean | ||
fun feignLoggerLevel() = Logger.Level.FULL | ||
|
||
@Bean | ||
fun requestInterceptor(): RequestInterceptor { | ||
return RequestInterceptor { template: RequestTemplate -> | ||
template.header( | ||
CONTENT_TYPE_HEADER, | ||
MediaType.APPLICATION_FORM_URLENCODED_VALUE | ||
) | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
adapters/out-web/src/main/kotlin/com/pokit/auth/common/dto/AppleRevokeRequest.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,13 @@ | ||
package com.pokit.auth.common.dto | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
data class AppleRevokeRequest( | ||
@JsonProperty("client_id") | ||
val clientId: String, | ||
@JsonProperty("client_secret") | ||
val clientSecret: String, | ||
val token: String, | ||
@JsonProperty("token_type_hint") | ||
val tokenTypeHint: String | ||
) |
17 changes: 17 additions & 0 deletions
17
adapters/out-web/src/main/kotlin/com/pokit/auth/common/dto/AppleTokenResponse.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,17 @@ | ||
package com.pokit.auth.common.dto | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
data class AppleTokenResponse( | ||
@JsonProperty("access_token") | ||
val accessToken: String, | ||
@JsonProperty("token_type") | ||
val tokenType: String, | ||
@JsonProperty("expires_in") | ||
val expiresIn: Int, | ||
@JsonProperty("refresh_token") | ||
val refreshToken: String?, | ||
@JsonProperty("id_token") | ||
val idToken: String, | ||
val error: String?, | ||
) |
13 changes: 13 additions & 0 deletions
13
adapters/out-web/src/main/kotlin/com/pokit/auth/common/property/AppleProperty.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,13 @@ | ||
package com.pokit.auth.common.property | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
|
||
@ConfigurationProperties(prefix = "apple") | ||
class AppleProperty( | ||
val clientId: String, | ||
val teamId: String, | ||
val keyId: String, | ||
val privateKey: String, | ||
val tokenUrl: String, | ||
val audience: String | ||
) |
38 changes: 38 additions & 0 deletions
38
adapters/out-web/src/main/kotlin/com/pokit/auth/common/support/AppleFeignClient.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,38 @@ | ||
package com.pokit.auth.common.support | ||
|
||
import com.pokit.auth.common.config.OpenFeignConfig | ||
import com.pokit.auth.common.dto.ApplePublicKeys | ||
import com.pokit.auth.common.dto.AppleRevokeRequest | ||
import com.pokit.auth.common.dto.AppleTokenResponse | ||
import feign.Response | ||
import org.springframework.cloud.openfeign.FeignClient | ||
import org.springframework.http.MediaType | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestParam | ||
|
||
|
||
@FeignClient( | ||
name = "appleClient", | ||
url = "https://appleid.apple.com/auth", | ||
configuration = [OpenFeignConfig::class] | ||
) | ||
interface AppleFeignClient { | ||
@GetMapping("/keys") | ||
fun getApplePublicKeys(): ApplePublicKeys | ||
|
||
@PostMapping("/revoke", produces = [MediaType.APPLICATION_FORM_URLENCODED_VALUE]) | ||
fun revoke( | ||
@RequestBody appleRevokeRequest: AppleRevokeRequest | ||
): Response | ||
|
||
@PostMapping("/token", produces = [MediaType.APPLICATION_FORM_URLENCODED_VALUE]) | ||
fun getToken( | ||
@RequestParam("client_id") clientId: String, | ||
@RequestParam("client_secret") clientSecret: String, | ||
@RequestParam("code") code: String, | ||
@RequestParam("grant_type") grantType: String, | ||
): AppleTokenResponse? | ||
|
||
} |
Oops, something went wrong.