Class CachingSha2PasswordPlugin
java.lang.Object
com.mysql.cj.protocol.a.authentication.Sha256PasswordPlugin
com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin
- All Implemented Interfaces:
AuthenticationPlugin<NativePacketPayload>
public class CachingSha2PasswordPlugin extends Sha256PasswordPlugin
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCachingSha2PasswordPlugin.AuthStage -
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPLUGIN_NAMEFields inherited from class com.mysql.cj.protocol.a.authentication.Sha256PasswordPlugin
password, protocol, publicKeyRequested, publicKeyString, seed, serverRSAPublicKeyFile -
Constructor Summary
Constructors Constructor Description CachingSha2PasswordPlugin() -
Method Summary
Modifier and Type Method Description voiddestroy()Called by the driver when this extension should release any resources it is holding and cleanup internally before the connection is closed.protected byte[]encryptPassword()java.lang.StringgetProtocolPluginName()Returns the name that the MySQL server uses on the wire for this pluginvoidinit(Protocol<NativePacketPayload> prot)We need direct Protocol reference because it isn't available from Connection before authentication complete.booleannextAuthenticationStep(NativePacketPayload fromServer, java.util.List<NativePacketPayload> toServer)Process authentication handshake data from server and optionally produce data to be sent back to the server.voidreset()Resets the authentication steps sequence.Methods inherited from class com.mysql.cj.protocol.a.authentication.Sha256PasswordPlugin
encryptPassword, isReusable, readRSAKey, requiresConfidentiality, setAuthenticationParameters
-
Field Details
-
PLUGIN_NAME
public static java.lang.String PLUGIN_NAME
-
-
Constructor Details
-
CachingSha2PasswordPlugin
public CachingSha2PasswordPlugin()
-
-
Method Details
-
init
Description copied from interface:AuthenticationPluginWe need direct Protocol reference because it isn't available from Connection before authentication complete.- Specified by:
initin interfaceAuthenticationPlugin<NativePacketPayload>- Overrides:
initin classSha256PasswordPlugin- Parameters:
prot- protocol instance
-
reset
public void reset()Description copied from interface:AuthenticationPluginResets the authentication steps sequence. -
destroy
public void destroy()Description copied from interface:AuthenticationPluginCalled by the driver when this extension should release any resources it is holding and cleanup internally before the connection is closed.- Specified by:
destroyin interfaceAuthenticationPlugin<NativePacketPayload>- Overrides:
destroyin classSha256PasswordPlugin
-
getProtocolPluginName
public java.lang.String getProtocolPluginName()Description copied from interface:AuthenticationPluginReturns the name that the MySQL server uses on the wire for this plugin- Specified by:
getProtocolPluginNamein interfaceAuthenticationPlugin<NativePacketPayload>- Overrides:
getProtocolPluginNamein classSha256PasswordPlugin- Returns:
- plugin name
-
nextAuthenticationStep
public boolean nextAuthenticationStep(NativePacketPayload fromServer, java.util.List<NativePacketPayload> toServer)Description copied from interface:AuthenticationPluginProcess authentication handshake data from server and optionally produce data to be sent back to the server. The driver will keep calling this method on each new server packet arrival until either an Exception is thrown (authentication failure, please use appropriate SQLStates) or the number of exchange iterations exceeded max limit or an OK packet is sent by server indicating that the connection has been approved. If, on return from this method, toServer is a non-empty list of buffers, then these buffers will be sent to the server in the same order and without any reads in between them. If toServer is an empty list, no data will be sent to server, driver immediately reads the next packet from server. In case of errors the method should throw Exception.- Specified by:
nextAuthenticationStepin interfaceAuthenticationPlugin<NativePacketPayload>- Overrides:
nextAuthenticationStepin classSha256PasswordPlugin- Parameters:
fromServer- a buffer containing handshake data payload from server (can be empty).toServer- list of buffers with data to be sent to the server (the list can be empty, but buffers in the list should contain data).- Returns:
- return value is ignored.
-
encryptPassword
protected byte[] encryptPassword()- Overrides:
encryptPasswordin classSha256PasswordPlugin
-