Class SendPamAuthPacket
- java.lang.Object
-
- org.mariadb.jdbc.plugin.authentication.standard.SendPamAuthPacket
-
- All Implemented Interfaces:
AuthenticationPlugin
public class SendPamAuthPacket extends java.lang.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 Summary
Fields Modifier and Type Field Description private java.lang.StringauthenticationDataprivate Configurationconfprivate intcounter
-
Constructor Summary
Constructors Constructor Description SendPamAuthPacket(java.lang.String authenticationData, Configuration conf)Initialization.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static AuthDialogCallbackdialogCallback()Look up the application-registeredAuthDialogCallbackviaServiceLoader.ReadableByteBufprocess(Writer out, Reader in, Context context, boolean sslFingerPrintValidation)Process PAM plugin authentication.private java.lang.StringresolvePassword(ReadableByteBuf serverPacket)Pick the answer for the current PAM/dialog round.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.mariadb.jdbc.plugin.AuthenticationPlugin
hash, isMitMProof
-
-
-
-
Field Detail
-
authenticationData
private final java.lang.String authenticationData
-
conf
private final Configuration conf
-
counter
private int counter
-
-
Constructor Detail
-
SendPamAuthPacket
public SendPamAuthPacket(java.lang.String authenticationData, Configuration conf)Initialization.- Parameters:
authenticationData- authentication data (password/token)conf- Connection string options
-
-
Method Detail
-
process
public ReadableByteBuf process(Writer out, Reader in, Context context, boolean sslFingerPrintValidation) throws java.sql.SQLException, java.io.IOException
Process PAM plugin authentication. see https://mariadb.com/kb/en/library/authentication-plugin-pam/- Specified by:
processin interfaceAuthenticationPlugin- Parameters:
out- out streamin- in streamcontext- connection contextsslFingerPrintValidation- true if SSL certificate fingerprint validation is enabled- Returns:
- response packet
- Throws:
java.io.IOException- if socket errorjava.sql.SQLException- if plugin exception
-
resolvePassword
private java.lang.String resolvePassword(ReadableByteBuf serverPacket) throws java.sql.SQLException
Pick the answer for the current PAM/dialog round. Round 1 uses the connection password, later rounds prefer the application-registeredAuthDialogCallback(so a UI can surface the actual server prompt). When no callback is registered, or the callback returnsnull, we fall back to the historicalpasswordNURL options.- Throws:
java.sql.SQLException
-
dialogCallback
private static AuthDialogCallback dialogCallback()
Look up the application-registeredAuthDialogCallbackviaServiceLoader. Java equivalent of the C connector'sdlsym(RTLD_DEFAULT, "mariadb_auth_dialog"). Returnsnullwhen nothing is registered.
-
-