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 class
CachingSha2PasswordPlugin.AuthStage
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PLUGIN_NAME
Fields 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 void
destroy()
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.String
getProtocolPluginName()
Returns the name that the MySQL server uses on the wire for this pluginvoid
init(Protocol<NativePacketPayload> prot)
We need direct Protocol reference because it isn't available from Connection before authentication complete.boolean
nextAuthenticationStep(NativePacketPayload fromServer, java.util.List<NativePacketPayload> toServer)
Process authentication handshake data from server and optionally produce data to be sent back to the server.void
reset()
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:AuthenticationPlugin
We need direct Protocol reference because it isn't available from Connection before authentication complete.- Specified by:
init
in interfaceAuthenticationPlugin<NativePacketPayload>
- Overrides:
init
in classSha256PasswordPlugin
- Parameters:
prot
- protocol instance
-
reset
public void reset()Description copied from interface:AuthenticationPlugin
Resets the authentication steps sequence. -
destroy
public void destroy()Description copied from interface:AuthenticationPlugin
Called by the driver when this extension should release any resources it is holding and cleanup internally before the connection is closed.- Specified by:
destroy
in interfaceAuthenticationPlugin<NativePacketPayload>
- Overrides:
destroy
in classSha256PasswordPlugin
-
getProtocolPluginName
public java.lang.String getProtocolPluginName()Description copied from interface:AuthenticationPlugin
Returns the name that the MySQL server uses on the wire for this plugin- Specified by:
getProtocolPluginName
in interfaceAuthenticationPlugin<NativePacketPayload>
- Overrides:
getProtocolPluginName
in classSha256PasswordPlugin
- Returns:
- plugin name
-
nextAuthenticationStep
public boolean nextAuthenticationStep(NativePacketPayload fromServer, java.util.List<NativePacketPayload> toServer)Description copied from interface:AuthenticationPlugin
Process 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:
nextAuthenticationStep
in interfaceAuthenticationPlugin<NativePacketPayload>
- Overrides:
nextAuthenticationStep
in 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:
encryptPassword
in classSha256PasswordPlugin
-