Skip to content
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

Merged
merged 9 commits into from
Oct 12, 2022
Merged

Feature/oauth logic #30

merged 9 commits into from
Oct 12, 2022

Conversation

dolong2
Copy link
Member

@dolong2 dolong2 commented Oct 12, 2022

한일

  • oauth로그인, 유저정보 개발

플로우 제대로 이해했는지 몰루

@dolong2 dolong2 added 1️⃣Priority: High 우선순위 상 ✨ Feature 기능 개발 labels Oct 12, 2022
@dolong2 dolong2 requested a review from baekteun October 12, 2022 07:30
@dolong2 dolong2 self-assigned this Oct 12, 2022
@@ -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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

무야 이거 왜 한 줄 떼놓은그야

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

몰?루

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사람들 불편하라고....?

val oauthUserInfoService: OauthUserInfoService,
){
@PostMapping("/login")
fun oauthLogin(@Validated @RequestBody oauthLoginRequestDto : OauthLoginRequestDto): ResponseEntity<OauthLoginResponseDto> =
Copy link
Member

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(
Copy link
Member

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(
Copy link
Member

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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

daaaaaaaaaaaaaata

Comment on lines 23 to 37
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
)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유저 State PENDING이면 Exception띄우는거 어때

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿

dolong2 and others added 2 commits October 12, 2022 16:37
…retMismatchException.kt

Co-authored-by: baegteun <74440939+baekteun@users.noreply.github.com>
@dolong2 dolong2 merged commit c763dcb into main Oct 12, 2022
@dolong2 dolong2 deleted the feature/oauth_logic branch October 12, 2022 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1️⃣Priority: High 우선순위 상 ✨ Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants