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
displayName - The Xbox gamertag of the player
networkId - The Network ID the player is joining with
remoteAddress - The address the join request came from
claims - 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.
  • Constructor Details

    • PlayerInfo

      public PlayerInfo(String xuid, String displayName, String networkId, InetSocketAddress remoteAddress, org.jose4j.jwt.JwtClaims claims)
      Creates an instance of a PlayerInfo record class.
      Parameters:
      xuid - the value for the xuid record component
      displayName - the value for the displayName record component
      networkId - the value for the networkId record component
      remoteAddress - the value for the remoteAddress record component
      claims - the value for the claims record component
  • Method Details

    • clientPublicKey

      public PublicKey clientPublicKey() throws GeneralSecurityException
      The key the peer proved it holds, from the token's cpk claim.

      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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • xuid

      public String xuid()
      Returns the value of the xuid record component.
      Returns:
      the value of the xuid record component
    • displayName

      public String displayName()
      Returns the value of the displayName record component.
      Returns:
      the value of the displayName record component
    • networkId

      public String networkId()
      Returns the value of the networkId record component.
      Returns:
      the value of the networkId record component
    • remoteAddress

      public InetSocketAddress remoteAddress()
      Returns the value of the remoteAddress record component.
      Returns:
      the value of the remoteAddress record component
    • claims

      public org.jose4j.jwt.JwtClaims claims()
      Returns the value of the claims record component.
      Returns:
      the value of the claims record component