-
Notifications
You must be signed in to change notification settings - Fork 0
[STORY-102] Gmail 계정 연동 #16
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
611a835
refactor: MailAccount OAuth 검증 책임을 컨벤션에 맞게 재배치 (#9)
jjjjjk12 adb262b
refactor: Google OAuth 설정값을 Properties 기반으로 분리 (#9)
jjjjjk12 bb71efe
feat: Google OAuth 인가 URL 생성 및 토큰 교환 QueryService 추가 (#9)
jjjjjk12 a37a42f
feat: Google OAuth callback 실제 연동 및 사용자 정보 조회 로직 구현 (#9)
jjjjjk12 4ce37b3
chore: core 서비스에 Google OAuth 환경변수 추가 (#9)
jjjjjk12 0c70849
feat: Google refresh token 누락 시 재연동 유도 예외 처리 추가 (#9)
jjjjjk12 e845967
feat: Google verified_email 검증 로직 추가 (#9)
jjjjjk12 54d8a59
feat: Gmail 계정 연동 성공 시 루트 경로로 리다이렉트 처리 (#9)
jjjjjk12 f398213
feat: MailAccount 아이콘·색상 저장 및 HEX 색상 검증 추가 (#9)
jjjjjk12 f209cf2
feat: MailAccount 별칭 필드 추가 및 OAuth 등록 입력값 확장 (#9)
jjjjjk12 8aed55a
feat: 로그인 사용자 메일 계정 목록 조회 API 추가 (#12)
jjjjjk12 730439a
refactor: MailAccount 외형값 기본값 보정 및 callback 단계 검증으로 변경 (#9)
jjjjjk12 dd44445
refactor: 구글 OAuth 연동 검증과 타임아웃을 보강하고 메일 계정 alias/icon 길이 제한을 255자로 정비…
jjjjjk12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
core/src/main/java/com/mailsangja/core/config/GoogleOAuthClientConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package com.mailsangja.core.config; | ||
|
|
||
| import com.mailsangja.core.config.properties.GoogleOAuthProperties; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
| import org.springframework.http.client.SimpleClientHttpRequestFactory; | ||
| import org.springframework.web.client.RestClient; | ||
|
|
||
| @Configuration | ||
| public class GoogleOAuthClientConfig { | ||
|
|
||
| @Bean | ||
| public RestClient googleOAuthRestClient(GoogleOAuthProperties googleOAuthProperties) { | ||
| SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); | ||
| requestFactory.setConnectTimeout((int) googleOAuthProperties.getConnectTimeout().toMillis()); | ||
| requestFactory.setReadTimeout((int) googleOAuthProperties.getReadTimeout().toMillis()); | ||
|
|
||
| return RestClient.builder() | ||
| .requestFactory(requestFactory) | ||
| .build(); | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
core/src/main/java/com/mailsangja/core/config/properties/GoogleOAuthProperties.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package com.mailsangja.core.config.properties; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.time.Duration; | ||
| import java.util.List; | ||
|
|
||
| @Getter | ||
| @Setter | ||
| @Component | ||
| @ConfigurationProperties(prefix = "mailsangja.oauth.google") | ||
| public class GoogleOAuthProperties { | ||
|
|
||
| private static final Duration DEFAULT_CONNECT_TIMEOUT = Duration.ofSeconds(3); | ||
| private static final Duration DEFAULT_READ_TIMEOUT = Duration.ofSeconds(5); | ||
|
|
||
| private String clientId; | ||
| private String clientSecret; | ||
| private String redirectUri; | ||
| private String authorizationUri; | ||
| private String tokenUri; | ||
| private String userInfoUri; | ||
| private Duration connectTimeout = DEFAULT_CONNECT_TIMEOUT; | ||
| private Duration readTimeout = DEFAULT_READ_TIMEOUT; | ||
| private List<String> scopes; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
core/src/main/java/com/mailsangja/core/dto/mail/GoogleOAuthTokenResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| package com.mailsangja.core.dto.mail; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| public record GoogleOAuthTokenResult( | ||
| @JsonProperty("access_token") | ||
| String accessToken, | ||
| @JsonProperty("refresh_token") | ||
| String refreshToken, | ||
| @JsonProperty("expires_in") | ||
| Long expiresIn, | ||
| @JsonProperty("scope") | ||
| String scope, | ||
| @JsonProperty("token_type") | ||
| String tokenType | ||
| ) { | ||
| } |
11 changes: 11 additions & 0 deletions
11
core/src/main/java/com/mailsangja/core/dto/mail/GoogleUserInfoResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| package com.mailsangja.core.dto.mail; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| public record GoogleUserInfoResult( | ||
| @JsonProperty("email") | ||
| String email, | ||
| @JsonProperty("verified_email") | ||
| Boolean verifiedEmail | ||
| ) { | ||
| } |
14 changes: 14 additions & 0 deletions
14
core/src/main/java/com/mailsangja/core/dto/mail/MailAccountAuthorizeRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package com.mailsangja.core.dto.mail; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| @Schema(description = "메일 계정 연동 시작 요청") | ||
| public record MailAccountAuthorizeRequest( | ||
| @Schema(description = "사용자가 지정한 메일 계정 별칭", example = "업무 메일") | ||
| String alias, | ||
| @Schema(description = "클라이언트가 선택한 메일 계정 아이콘", example = "mail") | ||
| String icon, | ||
| @Schema(description = "클라이언트가 선택한 메일 계정 색상 HEX 값", example = "#4F46E5") | ||
| String color | ||
| ) { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.