-
-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace MCAuth with RK_01 MinecraftAuth (#795)
* Initial work on moving over mcauth * Initial work on importing MinecraftAuth * Make compile * Remove extra headers code * Switch to different http utils * Merge changes * Cleanup * Remove unused exceptions and constructors * Implement proxies * Fixup proxy stuff * Cleanup * Remove SR license header * Remove custom exceptions * Move auth into main module Auth has become so small that it's not worth keeping separate * Make ProxyInfo be part of network again * Fix indent * Allow null id and name in GameProfile * Fix remaining logs * Make texture checker more accurate * Fix spaces * Update dependencies * Remove usage of var * Use faster approach for reading raw uuids.
- Loading branch information
1 parent
5624d77
commit 471e92e
Showing
29 changed files
with
904 additions
and
131 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
example/src/main/java/org/geysermc/mcprotocollib/auth/example/MinecraftAuthTest.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,53 @@ | ||
package org.geysermc.mcprotocollib.auth.example; | ||
|
||
import net.raphimc.minecraftauth.MinecraftAuth; | ||
import net.raphimc.minecraftauth.step.java.StepMCProfile; | ||
import net.raphimc.minecraftauth.step.java.StepMCToken; | ||
import net.raphimc.minecraftauth.step.java.session.StepFullJavaSession; | ||
import net.raphimc.minecraftauth.step.msa.StepCredentialsMsaCode; | ||
import org.geysermc.mcprotocollib.auth.GameProfile; | ||
import org.geysermc.mcprotocollib.auth.SessionService; | ||
import org.geysermc.mcprotocollib.network.ProxyInfo; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class MinecraftAuthTest { | ||
private static final Logger log = LoggerFactory.getLogger(MinecraftAuthTest.class); | ||
private static final String EMAIL = "Username@mail.com"; | ||
private static final String PASSWORD = "Password"; | ||
private static final boolean REQUIRE_SECURE_TEXTURES = true; | ||
|
||
private static final ProxyInfo PROXY = null; | ||
|
||
public static void main(String[] args) { | ||
auth(); | ||
} | ||
|
||
private static void auth() { | ||
SessionService service = new SessionService(); | ||
service.setProxy(PROXY); | ||
|
||
StepFullJavaSession.FullJavaSession fullJavaSession; | ||
try { | ||
fullJavaSession = MinecraftAuth.JAVA_CREDENTIALS_LOGIN.getFromInput( | ||
MinecraftAuth.createHttpClient(), | ||
new StepCredentialsMsaCode.MsaCredentials(EMAIL, PASSWORD)); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
StepMCProfile.MCProfile mcProfile = fullJavaSession.getMcProfile(); | ||
StepMCToken.MCToken mcToken = mcProfile.getMcToken(); | ||
GameProfile profile = new GameProfile(mcProfile.getId(), mcProfile.getName()); | ||
try { | ||
service.fillProfileProperties(profile); | ||
|
||
log.info("Selected Profile: {}", profile); | ||
log.info("Selected Profile Textures: {}", profile.getTextures(REQUIRE_SECURE_TEXTURES)); | ||
log.info("Access Token: {}", mcToken.getAccessToken()); | ||
log.info("Expire Time: {}", mcToken.getExpireTimeMs()); | ||
} catch (Exception e) { | ||
log.error("Failed to get properties and textures of selected profile {}.", profile, e); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.