-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/oauth logic #30
Conversation
@@ -7,4 +7,6 @@ import org.springframework.data.jpa.repository.JpaRepository | |||
interface ClientRepository: JpaRepository<Client, Long> { | |||
fun findAllByCreatedBy(createdBy: User): List<Client> | |||
fun findByIdAndCreatedBy(clientId: Long, createdBy: User): Client? | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
무야 이거 왜 한 줄 떼놓은그야
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
몰?루
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사람들 불편하라고....?
src/main/kotlin/com/msg/gauth/domain/oauth/exception/ClientSecretMismatchException.kt
Outdated
Show resolved
Hide resolved
val oauthUserInfoService: OauthUserInfoService, | ||
){ | ||
@PostMapping("/login") | ||
fun oauthLogin(@Validated @RequestBody oauthLoginRequestDto : OauthLoginRequestDto): ResponseEntity<OauthLoginResponseDto> = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
얘 왜 Validated야
@@ -0,0 +1,7 @@ | |||
package com.msg.gauth.domain.oauth.presentation.dto.request | |||
|
|||
class UserInfoRequestDto( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data class 해줭
@@ -0,0 +1,5 @@ | |||
package com.msg.gauth.domain.oauth.presentation.dto.response | |||
|
|||
class OauthLoginResponseDto( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data~
|
||
import com.msg.gauth.domain.user.enums.Gender | ||
|
||
class UserInfoResponseDto( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
daaaaaaaaaaaaaata
src/main/kotlin/com/msg/gauth/domain/oauth/presentation/dto/response/UserInfoResponseDto.kt
Show resolved
Hide resolved
fun execute(userInfoRequestDto: UserInfoRequestDto): UserInfoResponseDto{ | ||
val valueOperation = redisTemplate.opsForValue() | ||
val client = clientRepository.findByClientId(userInfoRequestDto.clientId) ?: throw ClientNotFindException() | ||
if(client.clientSecret != userInfoRequestDto.clientSecret) | ||
throw ClientSecretMismatchException() | ||
val email = valueOperation.get(userInfoRequestDto.code) ?: throw OauthCodeExpiredException() | ||
val user = userRepository.findByEmail(email) ?: throw UserNotFoundException() | ||
return UserInfoResponseDto( | ||
email = user.email, | ||
grade = user.grade, | ||
classNum = user.classNum, | ||
num = user.num, | ||
gender = user.gender | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유저 State PENDING이면 Exception띄우는거 어때
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿
…retMismatchException.kt Co-authored-by: baegteun <74440939+baekteun@users.noreply.github.com>
src/main/kotlin/com/msg/gauth/domain/client/repository/ClientRepository.kt
Outdated
Show resolved
Hide resolved
…epository.kt Co-authored-by: baegteun <74440939+baekteun@users.noreply.github.com>
한일
플로우 제대로 이해했는지 몰루