diff --git a/src/main/kotlin/com/hero/alignlab/domain/auth/resolver/ReactiveUserResolver.kt b/src/main/kotlin/com/hero/alignlab/domain/auth/resolver/ReactiveUserResolver.kt index 213ab99..5e9afb0 100644 --- a/src/main/kotlin/com/hero/alignlab/domain/auth/resolver/ReactiveUserResolver.kt +++ b/src/main/kotlin/com/hero/alignlab/domain/auth/resolver/ReactiveUserResolver.kt @@ -4,6 +4,8 @@ import com.hero.alignlab.domain.auth.application.AuthFacade import com.hero.alignlab.domain.auth.model.AUTH_TOKEN_KEY import com.hero.alignlab.domain.auth.model.AuthUser import com.hero.alignlab.domain.auth.model.AuthUserToken +import com.hero.alignlab.exception.ErrorCode +import com.hero.alignlab.exception.NotFoundException import org.springframework.core.MethodParameter import org.springframework.core.ReactiveAdapterRegistry import org.springframework.http.server.reactive.ServerHttpRequest @@ -40,7 +42,7 @@ class ReactiveUserResolver( .firstOrNull() ?.takeIf { token -> token.isNotBlank() } ?.let { token -> AuthUserToken.from(token) } - }.firstOrNull() ?: AuthUserToken.from("") + }.firstOrNull() ?: throw NotFoundException(ErrorCode.NOT_FOUND_TOKEN_ERROR) return authUserToken.toMono() } diff --git a/src/main/kotlin/com/hero/alignlab/exception/ErrorCode.kt b/src/main/kotlin/com/hero/alignlab/exception/ErrorCode.kt index 85eb824..ae234c7 100644 --- a/src/main/kotlin/com/hero/alignlab/exception/ErrorCode.kt +++ b/src/main/kotlin/com/hero/alignlab/exception/ErrorCode.kt @@ -15,6 +15,7 @@ enum class ErrorCode(val status: HttpStatus, val description: String) { FAIL_TO_TRANSACTION_TEMPLATE_EXECUTE_ERROR(HttpStatus.BAD_REQUEST, "fail to tx-templates execute error"), /** Auth Error Code */ + NOT_FOUND_TOKEN_ERROR(HttpStatus.UNAUTHORIZED, "not found token"), FAIL_TO_VERIFY_TOKEN_ERROR(HttpStatus.UNAUTHORIZED, "fail to verify token"), INVALID_ACCESS_TOKEN(HttpStatus.UNAUTHORIZED, "유효한 엑세스 토큰이 아닙니다."), INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "유효한 리프레시 토큰이 아닙니다."),