-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[feat]: 애플 로그인 구현
- Loading branch information
Showing
24 changed files
with
558 additions
and
190 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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/onnoff/onnoff/auth/dto/LoginRequestDTO.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,26 @@ | ||
package com.onnoff.onnoff.auth.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Getter; | ||
|
||
public class LoginRequestDTO { | ||
@Getter | ||
public static class AppleTokenValidateDTO{ | ||
@JsonProperty("user") | ||
private String oauthId; | ||
@JsonProperty("full_name") | ||
private String fullName; | ||
private String email; | ||
@JsonProperty("identity_token") | ||
private String identityToken; | ||
@JsonProperty("authorization_code") | ||
private String authorizationCode; | ||
} | ||
@Getter | ||
public static class KakaoTokenValidateDTO{ | ||
@JsonProperty("identity_token") | ||
private String identityToken; | ||
@JsonProperty("access_token") | ||
private String accessToken; | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/main/java/com/onnoff/onnoff/auth/feignClient/client/AppleAuthClient.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,21 @@ | ||
package com.onnoff.onnoff.auth.feignClient.client; | ||
|
||
|
||
import com.onnoff.onnoff.auth.feignClient.dto.JwkResponse; | ||
import com.onnoff.onnoff.auth.feignClient.dto.TokenResponse; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.util.MultiValueMap; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
|
||
@FeignClient(name = "apple-auth-client",url = "https://appleid.apple.com/auth") | ||
public interface AppleAuthClient{ | ||
@GetMapping("/keys") | ||
JwkResponse.JwkSet getKeys(); | ||
|
||
@GetMapping(value = "/token", consumes = "application/x-www-form-urlencoded") | ||
TokenResponse getToken(MultiValueMap requestBody); | ||
|
||
//회원 탈퇴 메서드 | ||
// @GetMapping("/revoke") | ||
// KakaoOauth2DTO.TokenValidateResponseDTO getTokenValidate(@RequestHeader("Authorization") String accessToken); | ||
} |
9 changes: 4 additions & 5 deletions
9
src/main/java/com/onnoff/onnoff/auth/feignClient/client/KakaoApiClient.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 |
---|---|---|
@@ -1,20 +1,19 @@ | ||
package com.onnoff.onnoff.auth.feignClient.client; | ||
|
||
import com.onnoff.onnoff.auth.feignClient.config.FeignConfig; | ||
import com.onnoff.onnoff.auth.feignClient.dto.KakaoOauth2DTO; | ||
import feign.Headers; | ||
import com.onnoff.onnoff.auth.feignClient.dto.kakao.KakaoOauth2DTO; | ||
import org.springframework.cloud.openfeign.FeignClient; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
/* | ||
토큰 유효성 검증하고 사용자 정보 가져오는 client | ||
토큰 유효성 검증 하고 사용자 정보 가져오는 client | ||
*/ | ||
|
||
@FeignClient(name = "kakao-api-client", url = "https://kapi.kakao.com", configuration = FeignConfig.class) | ||
public interface KakaoApiClient { | ||
@GetMapping("v1/user/access_token_info") | ||
KakaoOauth2DTO.TokenValidateResponseDTO getTokenValidate(@RequestHeader("Authorization") String accessToken); | ||
@GetMapping(value = "/v2/user/me") | ||
KakaoOauth2DTO.UserInfoResponseDTO getUserInfo(@RequestHeader("Authorization") String accessToken, @RequestParam(name = "property_keys") String propertyKeys); | ||
@GetMapping(value = "/v1/oidc/userinfo") | ||
KakaoOauth2DTO.UserInfoResponseDTO getUserInfo(@RequestHeader("Authorization") String accessToken); | ||
|
||
} |
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
30 changes: 30 additions & 0 deletions
30
src/main/java/com/onnoff/onnoff/auth/feignClient/dto/JwkResponse.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,30 @@ | ||
package com.onnoff.onnoff.auth.feignClient.dto; | ||
|
||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
public class JwkResponse { | ||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class Jwk { | ||
private String alg; | ||
private String e; | ||
private String kid; | ||
private String kty; | ||
private String n; | ||
private String use; | ||
} | ||
@Getter | ||
public static class JwkSet{ | ||
@JsonProperty("keys") | ||
private List<Jwk> jwkList; | ||
} | ||
} |
55 changes: 0 additions & 55 deletions
55
src/main/java/com/onnoff/onnoff/auth/feignClient/dto/KakaoOauth2DTO.java
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
src/main/java/com/onnoff/onnoff/auth/feignClient/dto/TokenResponse.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,18 @@ | ||
package com.onnoff.onnoff.auth.feignClient.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class TokenResponse { | ||
@JsonProperty("access_token") | ||
private String accessToken; | ||
@JsonProperty("expires_in") | ||
private Integer expiresIn; | ||
@JsonProperty("id_token") | ||
private String idToken; | ||
@JsonProperty("refresh_token") | ||
private String refreshToken; | ||
@JsonProperty("token_type") | ||
private String tokenType; | ||
} |
Oops, something went wrong.