Skip to content

Commit

Permalink
chore: invoke 코드 원상복구
Browse files Browse the repository at this point in the history
  • Loading branch information
whereami2048 committed May 7, 2024
1 parent 3fad62b commit fa95510
Showing 1 changed file with 11 additions and 12 deletions.
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.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)
// }
// }
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 fa95510

Please sign in to comment.