Record Class PlayerInfo
java.lang.Object
java.lang.Record
org.cloudburstmc.netty.util.nethernet.PlayerInfo
- Record Components:
xuid- The Xbox user ID of the player, self asserted underTokenTrust.ANYdisplayName- The Xbox gamertag of the player, self asserted underTokenTrust.ANYnetworkId- The Network ID the player is joining withremoteAddress- The address the join request came fromclaims- The full set of validated JWT claims, for anything not surfaced above
public record PlayerInfo(String xuid, String displayName, String networkId, InetSocketAddress remoteAddress, org.jose4j.jwt.JwtClaims claims)
extends Record
The validated identity of a player attempting to join.
How much of this can be trusted depends on the TokenTrust the offer was validated with.
Under TokenTrust.MINECRAFT_AUTH the token is Xbox issued, so the claims are attested.
Under TokenTrust.ANY the peer signed its own token and every claim below is self asserted,
with only clientPublicKey() bound to a key the peer had to hold.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerInfo(String xuid, String displayName, String networkId, InetSocketAddress remoteAddress, org.jose4j.jwt.JwtClaims claims) Creates an instance of aPlayerInforecord class. -
Method Summary
Modifier and TypeMethodDescriptionorg.jose4j.jwt.JwtClaimsclaims()Returns the value of theclaimsrecord component.The key the peer proved it holds, from the token'scpkclaim.Returns the value of thedisplayNamerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thenetworkIdrecord component.Returns the value of theremoteAddressrecord component.final StringtoString()Returns a string representation of this record class.xuid()Returns the value of thexuidrecord component.
-
Constructor Details
-
PlayerInfo
public PlayerInfo(String xuid, String displayName, String networkId, InetSocketAddress remoteAddress, org.jose4j.jwt.JwtClaims claims) Creates an instance of aPlayerInforecord class.- Parameters:
xuid- the value for thexuidrecord componentdisplayName- the value for thedisplayNamerecord componentnetworkId- the value for thenetworkIdrecord componentremoteAddress- the value for theremoteAddressrecord componentclaims- the value for theclaimsrecord component
-
-
Method Details
-
clientPublicKey
The key the peer proved it holds, from the token'scpkclaim.Nothing below the transport ties this to whatever identity your protocol carries afterwards. If your login step presents its own signed identity, compare its key to this one and reject a mismatch, or a peer can present an identity it captured elsewhere and did not sign for.
- Returns:
- The peer's public key
- Throws:
GeneralSecurityException- If the claim is missing or is not an EC public key
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
xuid
Returns the value of thexuidrecord component.- Returns:
- the value of the
xuidrecord component
-
displayName
Returns the value of thedisplayNamerecord component.- Returns:
- the value of the
displayNamerecord component
-
networkId
Returns the value of thenetworkIdrecord component.- Returns:
- the value of the
networkIdrecord component
-
remoteAddress
Returns the value of theremoteAddressrecord component.- Returns:
- the value of the
remoteAddressrecord component
-
claims
public org.jose4j.jwt.JwtClaims claims()Returns the value of theclaimsrecord component.- Returns:
- the value of the
claimsrecord component
-