Skip to content

Commit

Permalink
chore: CD-dev 워크 플로우 트리거 브랜치 변경 & AuthInvoker 파일 주석 처리 해제(#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
whereami2048 committed May 7, 2024
1 parent b72060c commit 3d34e6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CD-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CD-dev

on:
push:
branches: [ "feat/flight-17" ]
branches: [ "main" ]

permissions:
contents: read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@ import org.springframework.stereotype.Component
class AuthInvoker (
private val authHandlerList: List<AuthHandler>,
private val jwtProvider: JwtProvider,
// private val userReader: UserReader
private val userReader: UserReader
) {

fun invoke(request: SocialLogin.Request, provider: SocialLoginProvider): SocialLogin.Response {
val response = attemptLogin(request, provider)
return SocialLogin.Response.Success("accessToken", "refreshToken")
// return TransactionUtils.writable {
// return@writable userReader.findBySocialIdOrNull(response.socialId)?.let {
// val accessToken = jwtProvider.generateAccessToken(Claims.UserClaims(it.id))
// val refreshToken = jwtProvider.generateRefreshToken(Claims.UserClaims(it.id))
// SocialLogin.Response.Success(accessToken, refreshToken)
// } ?: run {
// val registrationToken = jwtProvider.generateRegistrationToken(Claims.RegistrationClaims(response.socialId, provider))
// SocialLogin.Response.UnRegistered(registrationToken, response.nickName)
// }
// }
return TransactionUtils.writable {
return@writable userReader.findBySocialIdOrNull(response.socialId)?.let {
val accessToken = jwtProvider.generateAccessToken(Claims.UserClaims(it.id))
val refreshToken = jwtProvider.generateRefreshToken(Claims.UserClaims(it.id))
SocialLogin.Response.Success(accessToken, refreshToken)
} ?: run {
val registrationToken = jwtProvider.generateRegistrationToken(Claims.RegistrationClaims(response.socialId, provider))
SocialLogin.Response.UnRegistered(registrationToken, response.nickName)
}
}
}

private fun attemptLogin(request: SocialLogin.Request, provider: SocialLoginProvider): AuthHandler.Response {
Expand Down

0 comments on commit 3d34e6f

Please sign in to comment.