-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Apple OAuth Login을 추가한다. (#80)
* chore: remove unused util class * feat: OAuthProvider에 Apple을 추가한다. * feat: bouncy castle, JWT decode 라이브러리를 추가한다. * feat: yml에 apple 환경 변수를 추가한다. * feat: apple login service를 구현한다. * refactor: Apple login 시 name을 http body로 받는다. * feat: OAuth 계정을 revoke하는 메소드를 추가한다. * feat: 최초 로그인 시 authorizationCode로 refreshToken을 취득한다. * feat: AppleUser 정보를 저장하는 Entity를 추가한다. * feat: 회원가입 시 Apple User인 경우 AppleUser를 저장한다.
- Loading branch information
Showing
24 changed files
with
326 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
push: | ||
branches: | ||
- dev | ||
|
||
- feat/** | ||
# 권한 설정 | ||
permissions: | ||
contents: read | ||
|
This file contains 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 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
13 changes: 13 additions & 0 deletions
13
src/main/java/com/moneymong/domain/user/api/request/UserDeleteRequest.java
This file contains 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,13 @@ | ||
package com.moneymong.domain.user.api.request; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class UserDeleteRequest { | ||
@NotBlank | ||
private String provider; | ||
|
||
@NotBlank | ||
private String token; | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/com/moneymong/domain/user/entity/AppleUser.java
This file contains 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,37 @@ | ||
package com.moneymong.domain.user.entity; | ||
|
||
import com.moneymong.global.domain.BaseEntity; | ||
import jakarta.persistence.*; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.hibernate.annotations.SQLDelete; | ||
import org.hibernate.annotations.Where; | ||
|
||
import static lombok.AccessLevel.PROTECTED; | ||
|
||
@Table(name = "apple_users") | ||
@Entity | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor(access = PROTECTED) | ||
@Where(clause = "deleted = false") | ||
@SQLDelete(sql = "UPDATE users SET deleted = true where id=?") | ||
public class AppleUser extends BaseEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private Long userId; | ||
|
||
private String appleRefreshToken; | ||
|
||
public static AppleUser of(Long userId, String appleRefreshToken) { | ||
return AppleUser.builder() | ||
.userId(userId) | ||
.appleRefreshToken(appleRefreshToken) | ||
.build(); | ||
} | ||
} |
This file contains 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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/moneymong/domain/user/repository/AppleUserRepository.java
This file contains 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,7 @@ | ||
package com.moneymong.domain.user.repository; | ||
|
||
import com.moneymong.domain.user.entity.AppleUser; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface AppleUserRepository extends JpaRepository<AppleUser, Long> { | ||
} |
This file contains 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 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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/moneymong/global/security/oauth/dto/AppleUserData.java
This file contains 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,15 @@ | ||
package com.moneymong.global.security.oauth.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class AppleUserData { | ||
@JsonProperty("refresh_token") | ||
private String refreshToken; | ||
|
||
@JsonProperty("id_token") | ||
private String idToken; | ||
} |
This file contains 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 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 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.