diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java index 613e2a5a..7bbc7930 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/AdvancedProtectHandler.java @@ -134,7 +134,7 @@ public static class HardwareInfoTokenVerifier implements RestoreResponse.Extende public HardwareInfoTokenVerifier(LaunchServer server) { this.parser = Jwts.parser() .requireIssuer("LaunchServer") - .setSigningKey(server.keyAgreementManager.ecdsaPublicKey) + .verifyWith(server.keyAgreementManager.ecdsaPublicKey) .build(); } @@ -166,7 +166,7 @@ public static class PublicKeyTokenVerifier implements RestoreResponse.ExtendedTo public PublicKeyTokenVerifier(LaunchServer server) { this.parser = Jwts.parser() .requireIssuer("LaunchServer") - .setSigningKey(server.keyAgreementManager.ecdsaPublicKey) + .verifyWith(server.keyAgreementManager.ecdsaPublicKey) .build(); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/TokenCommand.java b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/TokenCommand.java index 3d644074..6fd89943 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/TokenCommand.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/command/service/TokenCommand.java @@ -18,9 +18,9 @@ public TokenCommand(LaunchServer server) { @Override public void invoke(String... args) throws Exception { verifyArgs(args, 1); - var parser = Jwts.parser().setSigningKey(server.keyAgreementManager.ecdsaPublicKey).build(); - var claims = parser.parseClaimsJws(args[0]); - logger.info("Token: {}", claims.getBody()); + var parser = Jwts.parser().verifyWith(server.keyAgreementManager.ecdsaPublicKey).build(); + var claims = parser.parseSignedClaims(args[0]); + logger.info("Token: {}", claims.getPayload()); } }); this.childCommands.put("server", new SubCommand("[profileName] (authId) (public only)", "generate new server token") { diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/helper/LegacySessionHelper.java b/LaunchServer/src/main/java/pro/gravit/launchserver/helper/LegacySessionHelper.java index 764a7208..bc165fba 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/helper/LegacySessionHelper.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/helper/LegacySessionHelper.java @@ -27,12 +27,12 @@ public static String makeAccessJwtTokenFromString(User user, LocalDateTime expir public static JwtTokenInfo getJwtInfoFromAccessToken(String token, ECPublicKey publicKey) { var parser = Jwts.parser() .requireIssuer("LaunchServer") - .setClock(() -> new Date(Clock.systemUTC().millis())) - .setSigningKey(publicKey) + .clock(() -> new Date(Clock.systemUTC().millis())) + .verifyWith(publicKey) .build(); - var claims = parser.parseClaimsJws(token); - var uuid = UUID.fromString(claims.getBody().get("uuid", String.class)); - var username = claims.getBody().getSubject(); + var claims = parser.parseSignedClaims(token); + var uuid = UUID.fromString(claims.getPayload().get("uuid", String.class)); + var username = claims.getPayload().getSubject(); return new JwtTokenInfo(username, uuid); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java index b6122689..fcfb4b20 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/manangers/AuthManager.java @@ -41,13 +41,13 @@ public AuthManager(LaunchServer server) { this.checkServerTokenParser = Jwts.parser() .requireIssuer("LaunchServer") .require("tokenType", "checkServer") - .setSigningKey(server.keyAgreementManager.ecdsaPublicKey) + .verifyWith(server.keyAgreementManager.ecdsaPublicKey) .build(); } public String newCheckServerToken(String serverName, String authId, boolean publicOnly) { return Jwts.builder() - .setIssuer("LaunchServer") + .issuer("LaunchServer") .claim("serverName", serverName) .claim("authId", authId) .claim("tokenType", "checkServer") diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/update/LauncherResponse.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/update/LauncherResponse.java index f96fb48d..05e6c958 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/update/LauncherResponse.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/response/update/LauncherResponse.java @@ -90,7 +90,7 @@ public static class LauncherTokenVerifier implements RestoreResponse.ExtendedTok public LauncherTokenVerifier(LaunchServer server) { parser = Jwts.parser() - .setSigningKey(server.keyAgreementManager.ecdsaPublicKey) + .verifyWith(server.keyAgreementManager.ecdsaPublicKey) .requireIssuer("LaunchServer") .build(); } diff --git a/LauncherCore/src/main/java/pro/gravit/utils/Version.java b/LauncherCore/src/main/java/pro/gravit/utils/Version.java index 62fb4e33..0f523f08 100644 --- a/LauncherCore/src/main/java/pro/gravit/utils/Version.java +++ b/LauncherCore/src/main/java/pro/gravit/utils/Version.java @@ -8,7 +8,7 @@ public final class Version implements Comparable { public static final int MINOR = 6; public static final int PATCH = 0; public static final int BUILD = 1; - public static final Version.Type RELEASE = Type.EXPERIMENTAL; + public static final Version.Type RELEASE = Type.DEV; public final int major; public final int minor; public final int patch;