Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,13 @@

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) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ private static void encryptConnectionWithCert(GeyserSession session, AuthPayload
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;
// 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) {
session.setCertChainData(certificateChainPayload.getChain());
} else {
Expand Down