-
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.
Browse files
Browse the repository at this point in the history
[Feat/#91] 네이버 회원탈퇴
- Loading branch information
Showing
8 changed files
with
152 additions
and
36 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
5 changes: 5 additions & 0 deletions
5
src/main/java/Journey/Together/domain/member/dto/LoginReq.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,5 @@ | ||
package Journey.Together.domain.member.dto; | ||
public record LoginReq( | ||
String refreshToken | ||
) { | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/main/java/Journey/Together/global/security/naver/dto/NaverDeleteResponse.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 Journey.Together.global.security.naver.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class NaverDeleteResponse { | ||
@JsonProperty("access_token") | ||
private String accessToken; | ||
@JsonProperty("result") | ||
private String result; | ||
@JsonProperty("error") | ||
private String error; | ||
@JsonProperty("error_description") | ||
private String errorDescription; | ||
|
||
} |
54 changes: 41 additions & 13 deletions
54
src/main/java/Journey/Together/global/security/naver/dto/NaverProperties.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,24 +1,52 @@ | ||
package Journey.Together.global.security.naver.dto; | ||
|
||
import lombok.Data; | ||
import lombok.Getter; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.util.UriComponentsBuilder; | ||
|
||
@Data | ||
@Configuration | ||
@Getter | ||
@ConfigurationProperties(prefix = "naver") | ||
public class NaverProperties { | ||
private String requestTokenUri; | ||
private String clientId; | ||
private String clientSecret; | ||
|
||
public String getRequestURL(String code) { | ||
return UriComponentsBuilder.fromHttpUrl(requestTokenUri) | ||
.queryParam("grant_type", "authorization_code") | ||
.queryParam("client_id", clientId) | ||
.queryParam("client_secret", clientSecret) | ||
.queryParam("code", code) | ||
@Value("${spring.security.oauth2.client.registration.naver.client-id}") | ||
private String naverClientId; | ||
|
||
@Value("${spring.security.oauth2.client.registration.naver.client-secret}") | ||
private String naverClientSecret; | ||
|
||
@Value("${spring.security.oauth2.client.registration.naver.authorization-grant-type}") | ||
private String naverGrantType; | ||
|
||
@Value("${spring.security.oauth2.client.registration.naver.redirect-uri}") | ||
private String naverRedirectUri; | ||
|
||
@Value("${spring.security.oauth2.client.provider.naver.token-uri}") | ||
private String naverTokenUri; | ||
|
||
@Value("${spring.security.oauth2.client.provider.naver.user-info-uri}") | ||
private String naverUserInfoUri; | ||
|
||
// 새로운 액세스 토큰을 요청하기 위한 URI 생성 | ||
public String refreshTokenUri(String refreshToken) { | ||
return UriComponentsBuilder.fromHttpUrl("https://nid.naver.com/oauth2.0/token") | ||
.queryParam("grant_type", "refresh_token") | ||
.queryParam("client_id", naverClientId) | ||
.queryParam("client_secret", naverClientSecret) | ||
.queryParam("refresh_token", refreshToken) | ||
.toUriString(); | ||
} | ||
} | ||
|
||
public String delete(String accessToken) { | ||
return UriComponentsBuilder.fromHttpUrl("https://nid.naver.com/oauth2.0/token") | ||
.queryParam("grant_type", "delete") | ||
.queryParam("client_id", naverClientId) | ||
.queryParam("client_secret", naverClientSecret) | ||
.queryParam("access_token", accessToken) | ||
.queryParam("service_provider", "NAVER") | ||
.toUriString(); | ||
} | ||
|
||
|
||
} |
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