Top Description Inners Fields Constructors Methods
com.mysql.cj.protocol.a.authentication

public Class AuthenticationWebAuthnClient

extends Object
implements AuthenticationPlugin<NativePacketPayload>
Class Inheritance
All Implemented Interfaces
com.mysql.cj.protocol.AuthenticationPlugin
Imports
java.nio.charset.StandardCharsets, java.security.MessageDigest, .NoSuchAlgorithmException, java.util.Base64, .Base64.Encoder, .List, com.mysql.cj.Messages, com.mysql.cj.callback.MysqlCallbackHandler, .UsernameCallback, .WebAuthnAuthenticationCallback, com.mysql.cj.conf.PropertyKey, com.mysql.cj.exceptions.ExceptionFactory, com.mysql.cj.protocol.AuthenticationPlugin, .Protocol, com.mysql.cj.protocol.a.NativeConstants.IntegerDataType, .NativeConstants.StringSelfDataType, .NativePacketPayload, com.mysql.cj.util.Util

MySQL 'authentication_webauthn_client' authentication plugin. This authentication plugin requires a callback handler implemented in the client application that performs all the interactions with the authenticator device. This callback handler is injected into the driver via the connection property 'authenticationWebauthnCallbackHandler'.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private byte[]
private static final String
private byte[]
private String
private byte[]
public static String
private String
private String
private AuthenticationWebAuthnClient.AuthStage
private MysqlCallbackHandler
private WebAuthnAuthenticationCallback
private MysqlCallbackHandler

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
destroy()

Overrides default com.mysql.cj.protocol.AuthenticationPlugin.destroy.

Called by the driver when this extension should release any resources it is holding and cleanup internally before the connection is closed.

public String
getProtocolPluginName()

Implements com.mysql.cj.protocol.AuthenticationPlugin.getProtocolPluginName.

Returns the client-side name that the MySQL server uses on the wire for this plugin.

public void
init(Protocol<NativePacketPayload>
the protocol instance
protocol
,
MysqlCallbackHandler
a callback handler to provide additional information to the authentication provider
callbackHandler
)

Overrides default com.mysql.cj.protocol.AuthenticationPlugin.init.

Initializes this plugin with a direct Protocol reference and a generic MysqlCallbackHandler that can be used to pass over information back to the authentication provider.

public boolean
public boolean
nextAuthenticationStep(NativePacketPayload
a buffer containing handshake data payload from server (can be empty).
fromServer
,
List<NativePacketPayload>
list of buffers with data to be sent to the server (the list can be empty, but buffers in the list should contain data).
toServer
)

Implements com.mysql.cj.protocol.AuthenticationPlugin.nextAuthenticationStep.

Process authentication handshake data from server and optionally produce data to be sent back to the server.

public boolean
requiresConfidentiality()

Implements com.mysql.cj.protocol.AuthenticationPlugin.requiresConfidentiality.

Does this plugin require the connection itself to be confidential (i.e. tls/ssl)...Highly recommended to return "true" for plugins that return the credentials in the clear.

public void
reset()

Overrides default com.mysql.cj.protocol.AuthenticationPlugin.reset.

Resets the authentication steps sequence.

public void
setAuthenticationParameters(String
user name
user
,
String
user password
password
)

Implements com.mysql.cj.protocol.AuthenticationPlugin.setAuthenticationParameters.

This method called from Connector/J before first nextAuthenticationStep call.

public void
setSourceOfAuthData(String
the authentication plugin that is source of the authentication data
sourceOfAuthData
)

Overrides default com.mysql.cj.protocol.AuthenticationPlugin.setSourceOfAuthData.

Connector/J uses this method to identify the source of the authentication data, as an authentication plugin name, that will be available to the next authentication step(s).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

challengeback to summary
private byte[] challenge
CLIENT_DATA_JSONback to summary
private static final String CLIENT_DATA_JSON
clientDataHashback to summary
private byte[] clientDataHash
clientDataJsonback to summary
private String clientDataJson
credentialIdback to summary
private byte[] credentialId
PLUGIN_NAMEback to summary
public static String PLUGIN_NAME
relyingPartyIdback to summary
private String relyingPartyId
sourceOfAuthDataback to summary
private String sourceOfAuthData
stageback to summary
private AuthenticationWebAuthnClient.AuthStage stage
usernameCallbackHandlerback to summary
private MysqlCallbackHandler usernameCallbackHandler
webAuthnAuthCallbackback to summary
private WebAuthnAuthenticationCallback webAuthnAuthCallback
webAuthnAuthenticationCallbackHandlerback to summary
private MysqlCallbackHandler webAuthnAuthenticationCallbackHandler

Constructor Detail

AuthenticationWebAuthnClientback to summary
public AuthenticationWebAuthnClient()

Method Detail

destroyback to summary
public void destroy()

Overrides default com.mysql.cj.protocol.AuthenticationPlugin.destroy.

Doc from com.mysql.cj.protocol.AuthenticationPlugin.destroy.

Called by the driver when this extension should release any resources it is holding and cleanup internally before the connection is closed.

Annotations
@Override
getProtocolPluginNameback to summary
public String getProtocolPluginName()

Implements com.mysql.cj.protocol.AuthenticationPlugin.getProtocolPluginName.

Doc from com.mysql.cj.protocol.AuthenticationPlugin.getProtocolPluginName.

Returns the client-side name that the MySQL server uses on the wire for this plugin.

Returns:String

plugin name

Annotations
@Override
initback to summary
public void init(Protocol<NativePacketPayload> protocol, MysqlCallbackHandler callbackHandler)

Overrides default com.mysql.cj.protocol.AuthenticationPlugin.init.

Doc from com.mysql.cj.protocol.AuthenticationPlugin.init.

Initializes this plugin with a direct Protocol reference and a generic MysqlCallbackHandler that can be used to pass over information back to the authentication provider. For example an authentication plugin may accept null usernames and use that information to obtain them from some external source, such as the system login.

Parameters
protocol:Protocol<NativePacketPayload>

the protocol instance

callbackHandler:MysqlCallbackHandler

a callback handler to provide additional information to the authentication provider

Annotations
@Override
isReusableback to summary
public boolean isReusable()

Implements com.mysql.cj.protocol.AuthenticationPlugin.isReusable.

Returns:boolean

Doc from com.mysql.cj.protocol.AuthenticationPlugin.isReusable.

true if plugin instance may be reused, false otherwise

Annotations
@Override
nextAuthenticationStepback to summary
public boolean nextAuthenticationStep(NativePacketPayload fromServer, List<NativePacketPayload> toServer)

Implements com.mysql.cj.protocol.AuthenticationPlugin.nextAuthenticationStep.

Doc from com.mysql.cj.protocol.AuthenticationPlugin.nextAuthenticationStep.

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.

Parameters
fromServer:NativePacketPayload

a buffer containing handshake data payload from server (can be empty).

toServer:List<NativePacketPayload>

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:boolean

return value is ignored.

Annotations
@Override
requiresConfidentialityback to summary
public boolean requiresConfidentiality()

Implements com.mysql.cj.protocol.AuthenticationPlugin.requiresConfidentiality.

Doc from com.mysql.cj.protocol.AuthenticationPlugin.requiresConfidentiality.

Does this plugin require the connection itself to be confidential (i.e. tls/ssl)...Highly recommended to return "true" for plugins that return the credentials in the clear.

Returns:boolean

true if secure connection is required

Annotations
@Override
resetback to summary
public void reset()

Overrides default com.mysql.cj.protocol.AuthenticationPlugin.reset.

Doc from com.mysql.cj.protocol.AuthenticationPlugin.reset.

Resets the authentication steps sequence.

Annotations
@Override
setAuthenticationParametersback to summary
public void setAuthenticationParameters(String user, String password)

Implements com.mysql.cj.protocol.AuthenticationPlugin.setAuthenticationParameters.

Doc from com.mysql.cj.protocol.AuthenticationPlugin.setAuthenticationParameters.

This method called from Connector/J before first nextAuthenticationStep call. Values of user and password parameters are passed from those in NativeAuthenticationProvider#changeUser() or NativeAuthenticationProvider#connect(). Plugin should use these values instead of values from connection properties because parent method may be a changeUser call which saves user and password into connection only after successful handshake.

Parameters
user:String

user name

password:String

user password

Annotations
@Override
setSourceOfAuthDataback to summary
public void setSourceOfAuthData(String sourceOfAuthData)

Overrides default com.mysql.cj.protocol.AuthenticationPlugin.setSourceOfAuthData.

Doc from com.mysql.cj.protocol.AuthenticationPlugin.setSourceOfAuthData.

Connector/J uses this method to identify the source of the authentication data, as an authentication plugin name, that will be available to the next authentication step(s). The source of the authentication data in the first iteration will always be the sever-side default authentication plugin name. In the following iterations this depends on the client-side default authentication plugin or on the successive Protocol::AuthSwitchRequest that may have been received in the meantime. Authentication plugin implementation can use this information to decide if the data coming from the server is useful to them or not.

Parameters
sourceOfAuthData:String

the authentication plugin that is source of the authentication data

Annotations
@Override
com.mysql.cj.protocol.a.authentication back to summary

private final Enum AuthenticationWebAuthnClient.AuthStage

extends Enum<AuthenticationWebAuthnClient.AuthStage>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final AuthenticationWebAuthnClient.AuthStage
public static final AuthenticationWebAuthnClient.AuthStage
public static final AuthenticationWebAuthnClient.AuthStage

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static AuthenticationWebAuthnClient.AuthStage
public static AuthenticationWebAuthnClient.AuthStage[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CREDENTIAL_IDback to summary
public static final AuthenticationWebAuthnClient.AuthStage CREDENTIAL_ID
FINISHEDback to summary
public static final AuthenticationWebAuthnClient.AuthStage FINISHED
INITIAL_DATAback to summary
public static final AuthenticationWebAuthnClient.AuthStage INITIAL_DATA

Constructor Detail

AuthStageback to summary
private AuthStage()

Method Detail

valueOfback to summary
public static AuthenticationWebAuthnClient.AuthStage valueOf(String name)
valuesback to summary
public static AuthenticationWebAuthnClient.AuthStage[] values()