|
29 | 29 | import com.fasterxml.jackson.core.type.TypeReference;
|
30 | 30 | import com.fasterxml.jackson.databind.DeserializationFeature;
|
31 | 31 | import com.fasterxml.jackson.databind.ObjectMapper;
|
32 |
| -import com.google.gson.Gson; |
33 | 32 | import io.netty.channel.epoll.Epoll;
|
34 | 33 | import io.netty.util.NettyRuntime;
|
35 | 34 | import io.netty.util.concurrent.DefaultThreadFactory;
|
|
39 | 38 | import lombok.Setter;
|
40 | 39 | import net.kyori.adventure.text.Component;
|
41 | 40 | import net.kyori.adventure.text.format.NamedTextColor;
|
42 |
| -import net.raphimc.minecraftauth.step.java.session.StepFullJavaSession; |
43 |
| -import net.raphimc.minecraftauth.step.msa.StepMsaToken; |
44 | 41 | import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
45 | 42 | import org.checkerframework.checker.nullness.qual.NonNull;
|
46 | 43 | import org.checkerframework.checker.nullness.qual.Nullable;
|
|
99 | 96 | import org.geysermc.geyser.util.AssetUtils;
|
100 | 97 | import org.geysermc.geyser.util.CooldownUtils;
|
101 | 98 | import org.geysermc.geyser.util.Metrics;
|
102 |
| -import org.geysermc.geyser.util.MinecraftAuthLogger; |
103 | 99 | import org.geysermc.geyser.util.NewsHandler;
|
104 | 100 | import org.geysermc.geyser.util.VersionCheckUtils;
|
105 | 101 | import org.geysermc.geyser.util.WebUtils;
|
@@ -566,53 +562,6 @@ private void startInstance() {
|
566 | 562 | // May be written/read to on multiple threads from each GeyserSession as well as writing the config
|
567 | 563 | savedAuthChains = new ConcurrentHashMap<>();
|
568 | 564 |
|
569 |
| - // TODO Remove after a while - just a migration help |
570 |
| - //noinspection deprecation |
571 |
| - File refreshTokensFile = bootstrap.getSavedUserLoginsFolder().resolve(Constants.SAVED_REFRESH_TOKEN_FILE).toFile(); |
572 |
| - if (refreshTokensFile.exists()) { |
573 |
| - logger.info("Migrating refresh tokens to auth chains..."); |
574 |
| - TypeReference<Map<String, String>> type = new TypeReference<>() { }; |
575 |
| - Map<String, String> refreshTokens = null; |
576 |
| - try { |
577 |
| - refreshTokens = JSON_MAPPER.readValue(refreshTokensFile, type); |
578 |
| - } catch (IOException e) { |
579 |
| - // ignored - we'll just delete this file :)) |
580 |
| - } |
581 |
| - |
582 |
| - if (refreshTokens != null) { |
583 |
| - List<String> validUsers = config.getSavedUserLogins(); |
584 |
| - final Gson gson = new Gson(); |
585 |
| - for (Map.Entry<String, String> entry : refreshTokens.entrySet()) { |
586 |
| - String user = entry.getKey(); |
587 |
| - if (!validUsers.contains(user)) { |
588 |
| - continue; |
589 |
| - } |
590 |
| - |
591 |
| - // Migrate refresh tokens to auth chains |
592 |
| - try { |
593 |
| - StepFullJavaSession javaSession = PendingMicrosoftAuthentication.AUTH_FLOW.apply(false, 10); |
594 |
| - StepFullJavaSession.FullJavaSession fullJavaSession = javaSession.getFromInput( |
595 |
| - MinecraftAuthLogger.INSTANCE, |
596 |
| - PendingMicrosoftAuthentication.AUTH_CLIENT, |
597 |
| - new StepMsaToken.RefreshToken(entry.getValue()) |
598 |
| - ); |
599 |
| - |
600 |
| - String authChain = gson.toJson(javaSession.toJson(fullJavaSession)); |
601 |
| - savedAuthChains.put(user, authChain); |
602 |
| - } catch (Exception e) { |
603 |
| - GeyserImpl.getInstance().getLogger().warning("Could not migrate " + entry.getKey() + " to an auth chain! " + |
604 |
| - "They will need to sign in the next time they join Geyser."); |
605 |
| - } |
606 |
| - |
607 |
| - // Ensure the new additions are written to the file |
608 |
| - scheduleAuthChainsWrite(); |
609 |
| - } |
610 |
| - } |
611 |
| - |
612 |
| - // Finally: Delete it. Goodbye! |
613 |
| - refreshTokensFile.delete(); |
614 |
| - } |
615 |
| - |
616 | 565 | File authChainsFile = bootstrap.getSavedUserLoginsFolder().resolve(Constants.SAVED_AUTH_CHAINS_FILE).toFile();
|
617 | 566 | if (authChainsFile.exists()) {
|
618 | 567 | TypeReference<Map<String, String>> type = new TypeReference<>() { };
|
|
0 commit comments