[FIX] Jwts token builder

This commit is contained in:
Gravita 2021-06-06 00:46:39 +07:00
parent 1b81d5956c
commit fcdaa36421

View file

@ -158,21 +158,21 @@ public void close() {
public String createHardwareToken(String username, HardwareReportRequest.HardwareInfo info) { public String createHardwareToken(String username, HardwareReportRequest.HardwareInfo info) {
return Jwts.builder() return Jwts.builder()
.setIssuer("LaunchSerer") .setIssuer("LaunchServer")
.setSubject(username) .setSubject(username)
.signWith(server.keyAgreementManager.ecdsaPrivateKey)
.setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 8)) .setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 8))
.claim("hardware", info) .claim("hardware", info)
.signWith(server.keyAgreementManager.ecdsaPrivateKey)
.compact(); .compact();
} }
public String createPublicKeyToken(String username, byte[] publicKey) { public String createPublicKeyToken(String username, byte[] publicKey) {
return Jwts.builder() return Jwts.builder()
.setIssuer("LaunchSerer") .setIssuer("LaunchServer")
.setSubject(username) .setSubject(username)
.signWith(server.keyAgreementManager.ecdsaPrivateKey)
.setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 8)) .setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 8))
.claim("publicKey", Base64.getEncoder().encode(publicKey)) .claim("publicKey", Base64.getEncoder().encode(publicKey))
.signWith(server.keyAgreementManager.ecdsaPrivateKey)
.compact(); .compact();
} }