AuthenticationRequest packet

The confusingly named AuthenticationRequest packet is actually sent by the database server after StartupMessage has been received from the client. There are several variations of this packet depending on the authentication methods supported by your database server. See the Postgres documentation for (much) more detail.

All the variations of this packet have one field in common, called int1, which specifies what type of authentication this packet requests from the client.

Methods

  • int getInt1() : returns a number indicating the type of authentication requested from the client:

      • 0 : AuthenticationOk (a packet of this type concludes the authentication process)

      • 2 : AuthenticationKerberosV5

      • 3 : AuthenticationCleartextPassword

      • 5 : AuthenticationMD5Password

      • 6 : AuthenticationSCMCredential

      • 7 : AuthenticationGSS

      • 8 : AuthenticationGSSContinue

      • 9 : AuthenticationSSPI

      • 10 : AuthenticationSASL

      • 11 : AuthenticationSASLContinue

      • 12 : AuthenticationSASLFinal

  • byte[] getBytes() : returns the raw bytes forming the payload of this packet. The meaning of the payload depends on the authentication type.

  • void setBytes(byte[] bytes) : sets the raw bytes of the payload of this packet.

  • array getJSBytes() : gets the bytes forming the payload of this packet, in a JavaScript-friendly format. The array should not be changed unless setJSBytes is called.

  • void setJSBytes(array) : sets the payload bytes for this packet.

  • List<String> getStrings() : gets the strings used by some authentication protocols (like SASL). The returned list can be modified.