Class SendPamAuthPacket

java.lang.Object
org.mariadb.jdbc.plugin.authentication.standard.SendPamAuthPacket
All Implemented Interfaces:
AuthenticationPlugin

public class SendPamAuthPacket extends Object implements AuthenticationPlugin
PAM (dialog) authentication plugin. This is a multi-step exchange password. If more than one step, passwordX (password2, password3, ...) options must be set.
  • Field Details

    • authenticationData

      private final String authenticationData
    • conf

      private final Configuration conf
    • counter

      private int counter
  • Constructor Details

    • SendPamAuthPacket

      public SendPamAuthPacket(String authenticationData, Configuration conf)
      Initialization.
      Parameters:
      authenticationData - authentication data (password/token)
      conf - Connection string options
  • Method Details

    • process

      public ReadableByteBuf process(Writer out, Reader in, Context context, boolean sslFingerPrintValidation) throws SQLException, IOException
      Process PAM plugin authentication. see https://mariadb.com/kb/en/library/authentication-plugin-pam/
      Specified by:
      process in interface AuthenticationPlugin
      Parameters:
      out - out stream
      in - in stream
      context - connection context
      sslFingerPrintValidation - true if SSL certificate fingerprint validation is enabled
      Returns:
      response packet
      Throws:
      IOException - if socket error
      SQLException - if plugin exception
    • resolvePassword

      private String resolvePassword(ReadableByteBuf serverPacket) throws SQLException
      Pick the answer for the current PAM/dialog round. Round 1 uses the connection password, later rounds prefer the application-registered AuthDialogCallback (so a UI can surface the actual server prompt). When no callback is registered, or the callback returns null, we fall back to the historical passwordN URL options.
      Throws:
      SQLException
    • dialogCallback

      private static AuthDialogCallback dialogCallback()
      Look up the application-registered AuthDialogCallback via ServiceLoader. Java equivalent of the C connector's dlsym(RTLD_DEFAULT, "mariadb_auth_dialog"). Returns null when nothing is registered.