-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e43fec
commit 97e52e4
Showing
44 changed files
with
574 additions
and
131 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
2 changes: 1 addition & 1 deletion
2
...main/member/type/NotificationSetting.java → ...in/member/domain/NotificationSetting.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
2 changes: 1 addition & 1 deletion
2
src/main/java/com/kcy/fitapet/domain/member/dto/account/AccountProfileRes.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
1 change: 0 additions & 1 deletion
1
src/main/java/com/kcy/fitapet/domain/member/dto/auth/SignUpReq.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
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
2 changes: 1 addition & 1 deletion
2
...ation/type/NotificationTypeConverter.java → .../converter/NotificationTypeConverter.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
3 changes: 2 additions & 1 deletion
3
.../type/NotificationTypeQueryConverter.java → ...erter/NotificationTypeQueryConverter.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
45 changes: 45 additions & 0 deletions
45
src/main/java/com/kcy/fitapet/domain/oauth/api/OAuthApi.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,45 @@ | ||
package com.kcy.fitapet.domain.oauth.api; | ||
|
||
import com.kcy.fitapet.domain.member.dto.auth.SignInReq; | ||
import com.kcy.fitapet.domain.oauth.dto.OauthSignInReq; | ||
import com.kcy.fitapet.domain.oauth.dto.OauthSignUpReq; | ||
import com.kcy.fitapet.domain.oauth.service.OAuthService; | ||
import com.kcy.fitapet.domain.oauth.type.ProviderType; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@Tag(name = "OAuth API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/auth/oauth") | ||
@Slf4j | ||
public class OAuthApi { | ||
private final OAuthService oAuthService; | ||
|
||
@PostMapping("") | ||
@PreAuthorize("isAnonymous()") | ||
public void signIn( | ||
@RequestParam("provider") ProviderType provider, | ||
@RequestBody @Valid OauthSignInReq req | ||
) { | ||
if (ProviderType.NAVER.equals(provider)) { | ||
|
||
} else { | ||
|
||
} | ||
} | ||
|
||
@PostMapping("/{id}") | ||
@PreAuthorize("isAnonymous()") | ||
public void signUp( | ||
@PathVariable("id") String id, | ||
@RequestParam("provider") ProviderType provider, | ||
@RequestBody @Valid OauthSignUpReq req | ||
) { | ||
|
||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/kcy/fitapet/domain/oauth/dao/OAuthRepository.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.kcy.fitapet.domain.oauth.dao; | ||
|
||
import com.kcy.fitapet.domain.oauth.api.OAuthApi; | ||
import com.kcy.fitapet.global.common.repository.ExtendedRepository; | ||
|
||
public interface OAuthRepository extends ExtendedRepository<OAuthApi, Long> { | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/com/kcy/fitapet/domain/oauth/domain/OAuthAccount.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,45 @@ | ||
package com.kcy.fitapet.domain.oauth.domain; | ||
|
||
import com.kcy.fitapet.domain.member.domain.Member; | ||
import com.kcy.fitapet.domain.model.Auditable; | ||
import com.kcy.fitapet.domain.oauth.type.ProviderType; | ||
import com.kcy.fitapet.domain.oauth.type.converter.ProviderTypeConverter; | ||
import jakarta.persistence.*; | ||
import lombok.*; | ||
|
||
@Entity | ||
@Table(name = "OAUTH") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@ToString(of = {"id", "provider"}) | ||
public class OAuthAccount extends Auditable { | ||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@Column(name = "oauth_id") | ||
private Long OAuthID; | ||
@Convert(converter = ProviderTypeConverter.class) | ||
private ProviderType provider; | ||
private String email; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "member_id") | ||
private Member member; | ||
|
||
@Builder | ||
public OAuthAccount(Long id, Long OAuthID, ProviderType provider, String email, Member member) { | ||
this.id = id; | ||
this.OAuthID = OAuthID; | ||
this.provider = provider; | ||
this.email = email; | ||
this.member = member; | ||
} | ||
|
||
public static OAuthAccount of(Long OAuthID, ProviderType provider, String email, Member member) { | ||
return OAuthAccount.builder() | ||
.OAuthID(OAuthID) | ||
.provider(provider) | ||
.email(email) | ||
.member(member) | ||
.build(); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/kcy/fitapet/domain/oauth/dto/OauthSignInReq.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,11 @@ | ||
package com.kcy.fitapet.domain.oauth.dto; | ||
|
||
import jakarta.validation.constraints.NotEmpty; | ||
|
||
public record OauthSignInReq( | ||
@NotEmpty | ||
String id, | ||
@NotEmpty | ||
String id_token | ||
) { | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/kcy/fitapet/domain/oauth/dto/OauthSignUpReq.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.kcy.fitapet.domain.oauth.dto; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record OauthSignUpReq( | ||
@NotBlank | ||
String phone, | ||
@NotBlank | ||
String name, | ||
@NotBlank | ||
String uid | ||
) { | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/com/kcy/fitapet/domain/oauth/service/OAuthService.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,34 @@ | ||
package com.kcy.fitapet.domain.oauth.service; | ||
|
||
import com.kcy.fitapet.domain.oauth.dao.OAuthRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class OAuthService { | ||
private final OAuthRepository oAuthRepository; | ||
|
||
@Transactional | ||
public void signUpByOIDC() { | ||
|
||
} | ||
|
||
@Transactional | ||
public void signInByOIDC() { | ||
|
||
} | ||
|
||
@Transactional | ||
public void signInByCode() { | ||
|
||
} | ||
|
||
@Transactional | ||
public void signUpByCode() { | ||
|
||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/com/kcy/fitapet/domain/oauth/type/ProviderType.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,47 @@ | ||
package com.kcy.fitapet.domain.oauth.type; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import com.kcy.fitapet.global.common.util.converter.LegacyCommonType; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Map; | ||
import java.util.stream.Stream; | ||
|
||
import static java.util.stream.Collectors.toMap; | ||
|
||
@RequiredArgsConstructor | ||
public enum ProviderType implements LegacyCommonType { | ||
KAKAO("1", "카카오"), | ||
GOOGLE("2", "구글"), | ||
NAVER("2", "네이버"), | ||
APPLE("3", "애플"); | ||
|
||
private final String code; | ||
private final String type; | ||
|
||
private static final Map<String, ProviderType> stringToEnum = | ||
Stream.of(values()).collect(toMap(Object::toString, e -> e)); | ||
|
||
|
||
@Override | ||
public String getCode() { | ||
return code; | ||
} | ||
|
||
@JsonValue | ||
public String getType() { | ||
return type; | ||
} | ||
|
||
@JsonCreator | ||
public static ProviderType fromString(String type) { | ||
return stringToEnum.get(type.toUpperCase()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return name().toLowerCase(); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/kcy/fitapet/domain/oauth/type/converter/ProviderTypeConverter.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,12 @@ | ||
package com.kcy.fitapet.domain.oauth.type.converter; | ||
|
||
import com.kcy.fitapet.domain.oauth.type.ProviderType; | ||
import com.kcy.fitapet.global.common.util.converter.AbstractLegacyEnumAttributeConverter; | ||
|
||
public class ProviderTypeConverter extends AbstractLegacyEnumAttributeConverter<ProviderType> { | ||
private static final String ENUM_NAME = "제공자"; | ||
|
||
public ProviderTypeConverter() { | ||
super(ProviderType.class, false, ENUM_NAME); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/kcy/fitapet/domain/oauth/type/converter/ProviderTypeQueryConverter.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.kcy.fitapet.domain.oauth.type.converter; | ||
|
||
import com.kcy.fitapet.domain.oauth.type.ProviderType; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
public class ProviderTypeQueryConverter implements Converter<String, ProviderType> { | ||
@Override | ||
public ProviderType convert(String source) { | ||
try { | ||
return ProviderType.valueOf(source.toUpperCase()); | ||
} catch (IllegalArgumentException e) { | ||
throw null; | ||
} | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
src/main/java/com/kcy/fitapet/domain/oauth2/api/OAuthApi.java
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
src/main/java/com/kcy/fitapet/domain/oauth2/domain/OAuthID.java
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
src/main/java/com/kcy/fitapet/global/common/redis/refresh/RefreshTokenServiceImpl.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
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.