mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-22 16:41:46 +03:00
[FIX] Jwt library remove deprecated
This commit is contained in:
parent
1710eb7bec
commit
f7decac23d
6 changed files with 14 additions and 14 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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") {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ public final class Version implements Comparable<Version> {
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue