diff options
Diffstat (limited to 'loader/src/main/java')
-rwxr-xr-x | loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java | 8 | ||||
-rwxr-xr-x | loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java index 1df59f83..66d7e79b 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java @@ -18,6 +18,8 @@ package kr.syeyoung.dungeonsguide.launcher; +import com.mojang.authlib.exceptions.AuthenticationUnavailableException; +import com.mojang.authlib.exceptions.InvalidCredentialsException; import kr.syeyoung.dungeonsguide.launcher.exceptions.AuthServerException; import kr.syeyoung.dungeonsguide.launcher.authentication.Authenticator; import kr.syeyoung.dungeonsguide.launcher.branch.ModDownloader; @@ -54,7 +56,7 @@ public class Main { public static final String MOD_ID = "dungeons_guide_wrapper"; public static final String VERSION = "1.0"; - public static final String DOMAIN = "http://testmachine:8080/panel/api"; + public static final String DOMAIN = "http://testmachine:8080/api"; private static Main main; @@ -156,6 +158,10 @@ public class Main } else if (lastError instanceof AuthServerException) { + } else if (lastError instanceof InvalidCredentialsException) { + + } else if (lastError instanceof AuthenticationUnavailableException) { + } else if (lastError != null){ return new GuiLoadingError(lastError, () -> {lastError = null;}); } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java index d06e3a39..d16f70ed 100755 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/authentication/Authenticator.java @@ -46,7 +46,6 @@ import java.util.concurrent.locks.ReentrantLock; public class Authenticator { private String dgAccessToken; - private Instant validThru; @Getter private TokenStatus tokenStatus = TokenStatus.UNAUTHENTICATED; @@ -55,13 +54,13 @@ public class Authenticator { private Lock authenticationLock = new ReentrantLock(); static { - Reflection.registerFieldsToFilter(Authenticator.class, "token"); // Please do not touch this field. I know there is a way to block it completely, but I won't do it here. + Reflection.registerFieldsToFilter(Authenticator.class, "dgAccessToken"); // Please do not touch this field. I know there is a way to block it completely, but I won't do it here. } public String getRawToken() { return dgAccessToken; } - public String getUnexpiredToken() { + public String getUnexpiredToken() { // THIS METHOD MAY BLOCK. if (tokenStatus != TokenStatus.AUTHENTICATED) throw new IllegalStateException("Token is not available"); long expiry = getJwtPayload(dgAccessToken).getLong("exp"); if (System.currentTimeMillis() >= expiry-2000 || tokenStatus == TokenStatus.EXPIRED) { |