mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-19 14:59:27 +00:00
Store iat in AuthData for later retrieval (#5884)
This commit is contained in:
@@ -27,5 +27,13 @@ package org.geysermc.geyser.session.auth;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public record AuthData(String name, UUID uuid, String xuid) {
|
/**
|
||||||
|
* A class holding some basic information of the connected user.
|
||||||
|
*
|
||||||
|
* @param name The gamertag of the user
|
||||||
|
* @param uuid Also known as identity
|
||||||
|
* @param xuid The xuid of the user
|
||||||
|
* @param issuedAt The unix time (in seconds) that the JWT was issued
|
||||||
|
*/
|
||||||
|
public record AuthData(String name, UUID uuid, String xuid, long issuedAt) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,9 +76,13 @@ public class LoginEncryptionUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Should always be present, but hey, why not make it safe :D
|
||||||
|
Long rawIssuedAt = (Long) result.rawIdentityClaims().get("iat");
|
||||||
|
long issuedAt = rawIssuedAt != null ? rawIssuedAt : -1;
|
||||||
|
|
||||||
IdentityData extraData = result.identityClaims().extraData;
|
IdentityData extraData = result.identityClaims().extraData;
|
||||||
// TODO!!! identity won't persist
|
// TODO!!! identity won't persist
|
||||||
session.setAuthData(new AuthData(extraData.displayName, extraData.identity, extraData.xuid));
|
session.setAuthData(new AuthData(extraData.displayName, extraData.identity, extraData.xuid, issuedAt));
|
||||||
if (authPayload instanceof CertificateChainPayload certificateChainPayload) {
|
if (authPayload instanceof CertificateChainPayload certificateChainPayload) {
|
||||||
session.setCertChainData(certificateChainPayload.getChain());
|
session.setCertChainData(certificateChainPayload.getChain());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user