From 101ebbfb47bd110c95c0fc988dc195b296951851 Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:22:14 +0900 Subject: [PATCH 1/5] =?UTF-8?q?update=20::=20response=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/gauth/{ => response}/GAuthCode.java | 2 +- src/main/java/gauth/{ => response}/GAuthToken.java | 2 +- src/main/java/gauth/{ => response}/GAuthUserInfo.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/gauth/{ => response}/GAuthCode.java (88%) rename src/main/java/gauth/{ => response}/GAuthToken.java (94%) rename src/main/java/gauth/{ => response}/GAuthUserInfo.java (98%) diff --git a/src/main/java/gauth/GAuthCode.java b/src/main/java/gauth/response/GAuthCode.java similarity index 88% rename from src/main/java/gauth/GAuthCode.java rename to src/main/java/gauth/response/GAuthCode.java index 7db9994..46ea6a7 100644 --- a/src/main/java/gauth/GAuthCode.java +++ b/src/main/java/gauth/response/GAuthCode.java @@ -1,4 +1,4 @@ -package gauth; +package gauth.response; public class GAuthCode { private String code; diff --git a/src/main/java/gauth/GAuthToken.java b/src/main/java/gauth/response/GAuthToken.java similarity index 94% rename from src/main/java/gauth/GAuthToken.java rename to src/main/java/gauth/response/GAuthToken.java index 07a4aee..23c8443 100644 --- a/src/main/java/gauth/GAuthToken.java +++ b/src/main/java/gauth/response/GAuthToken.java @@ -1,4 +1,4 @@ -package gauth; +package gauth.response; import java.util.Map; diff --git a/src/main/java/gauth/GAuthUserInfo.java b/src/main/java/gauth/response/GAuthUserInfo.java similarity index 98% rename from src/main/java/gauth/GAuthUserInfo.java rename to src/main/java/gauth/response/GAuthUserInfo.java index b9377b4..54245eb 100644 --- a/src/main/java/gauth/GAuthUserInfo.java +++ b/src/main/java/gauth/response/GAuthUserInfo.java @@ -1,4 +1,4 @@ -package gauth; +package gauth.response; import java.util.Map; From d1695fde072af2e74bc3c04f8b275d1bd5d9ebdc Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:22:50 +0900 Subject: [PATCH 2/5] =?UTF-8?q?delete=20::=20Auth=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/gauth/impl/GAuthImpl.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/gauth/impl/GAuthImpl.java b/src/main/java/gauth/impl/GAuthImpl.java index c299806..8d09d2b 100644 --- a/src/main/java/gauth/impl/GAuthImpl.java +++ b/src/main/java/gauth/impl/GAuthImpl.java @@ -27,10 +27,6 @@ public class GAuthImpl implements GAuth { private final String GAuthServerURL = "https://port-0-gauth-backend-85phb42bluutn9a7.sel5.cloudtype.app/oauth"; private final String ResourceServerURL = "https://port-0-gauth-resource-server-71t02clq411q18.sel4.cloudtype.app"; - private enum Auth{ - ACCESS, - REFRESH - } public GAuthToken generateToken(String email, String password, String clientId, String clientSecret, String redirectUri) { String code = generateCode(email, password).getCode(); return new GAuthToken(getToken(code, clientId, clientSecret, redirectUri)); From 0b014482c92a8e53e7d582ac967749299e9eee6a Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:23:06 +0900 Subject: [PATCH 3/5] =?UTF-8?q?update=20::=20Auth=20->=20TokenType=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/gauth/impl/GAuthImpl.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/gauth/impl/GAuthImpl.java b/src/main/java/gauth/impl/GAuthImpl.java index 8d09d2b..a4e3f80 100644 --- a/src/main/java/gauth/impl/GAuthImpl.java +++ b/src/main/java/gauth/impl/GAuthImpl.java @@ -3,9 +3,10 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import gauth.GAuth; -import gauth.GAuthCode; -import gauth.GAuthToken; -import gauth.GAuthUserInfo; +import gauth.enums.TokenType; +import gauth.response.GAuthCode; +import gauth.response.GAuthToken; +import gauth.response.GAuthUserInfo; import gauth.exception.GAuthException; import gauth.exception.InvalidEncodingException; import gauth.exception.JsonNotParseException; @@ -47,7 +48,7 @@ public GAuthCode generateCode(String email, String password) { public GAuthToken refresh(String refreshToken) { if(!refreshToken.startsWith("Bearer ")) refreshToken = "Bearer "+refreshToken; - return new GAuthToken(sendPatchGAuthServer(null, refreshToken, "/token", Auth.REFRESH)); + return new GAuthToken(sendPatchGAuthServer(null, refreshToken, "/token", TokenType.REFRESH)); } public GAuthUserInfo getUserInfo(String accessToken) { @@ -70,8 +71,8 @@ private Map sendPostGAuthServer(Map body, String return sendPost(body, token, GAuthServerURL+url); } - private Map sendPatchGAuthServer(Map body, String token, String url, Auth auth) { - return sendPatch(body, token, GAuthServerURL+ url, auth); + private Map sendPatchGAuthServer(Map body, String token, String url, TokenType tokenType) { + return sendPatch(body, token, GAuthServerURL+ url, tokenType); } private Map sendGetResourceServer(String token, String url) { @@ -103,12 +104,12 @@ private Map sendGet(String token, String url) { } } - private Map sendPatch(Map body, String token, String url, Auth auth) { + private Map sendPatch(Map body, String token, String url, TokenType tokenType) { HttpPatch request = new HttpPatch(url); request.setHeader("Accept", "application/json"); request.setHeader("Connection", "keep-alive"); request.setHeader("Content-Type", "application/json"); - if(auth == Auth.ACCESS) + if(tokenType == TokenType.ACCESS) request.setHeader("Authorization", token); else request.addHeader("refreshToken", token); From e7117e561de31b00173536f7d38891675fb3a89c Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:23:26 +0900 Subject: [PATCH 4/5] =?UTF-8?q?add=20::=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20import=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/gauth/GAuth.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/gauth/GAuth.java b/src/main/java/gauth/GAuth.java index 346df50..e783a25 100644 --- a/src/main/java/gauth/GAuth.java +++ b/src/main/java/gauth/GAuth.java @@ -1,5 +1,9 @@ package gauth; +import gauth.response.GAuthCode; +import gauth.response.GAuthToken; +import gauth.response.GAuthUserInfo; + public interface GAuth { GAuthToken generateToken(String email, String password, String clientId, String clientSecret, String redirectUri); From c115243e3687c03907b81e94d25d315f30b7292a Mon Sep 17 00:00:00 2001 From: Umjiseung <127853946+Umjiseung@users.noreply.github.com> Date: Mon, 15 Apr 2024 11:23:42 +0900 Subject: [PATCH 5/5] =?UTF-8?q?add=20::=20TokenType=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/gauth/enums/TokenType.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/main/java/gauth/enums/TokenType.java diff --git a/src/main/java/gauth/enums/TokenType.java b/src/main/java/gauth/enums/TokenType.java new file mode 100644 index 0000000..0dfa217 --- /dev/null +++ b/src/main/java/gauth/enums/TokenType.java @@ -0,0 +1,5 @@ +package gauth.enums; + +public enum TokenType { + ACCESS, REFRESH +}