Skip to content

Conversation

@takapi327
Copy link
Owner

@takapi327 takapi327 commented Dec 17, 2025

Implementation Details

You can now use any authentication plugin with the MySQL server.

val plugin = ???
val datasource = MySQLDataSource
  .build[IO]("127.0.0.1", 3306, "...")
  .setPlugins(plugin)

Plugins can be customized by using the ldbc.authentication.plugin.AuthenticationPlugin.

class CustomePluging[F[_]] extends AuthenticationPlugin[F]:
  override def name: PluginName = ???
  override def requiresConfidentiality: Boolean = ???
  override def hashPassword(password: String, scramble: Array[Byte]): F[ByteVector] = ???

The following items require configuration.

property value detail
name Authentication Plugin Name Only plugin names supported by MySQL can be used.
requiresConfidentiality Require SSL for connections If true, an exception is thrown if SSL is not enabled.
hashPassword Password Handling Method The password value to send to the MySQL server.

This can be used primarily for IAM authentication with AWS Aurora and Azure SQL Database.

AWS IAM authentication is supported by default as follows.
Using this plugin enables connection processing with IAM authentication on AWS Aurora.

val hostname   = "..."
val username   = "..."
val config     = MySQLConfig.default.setHost(hostname).setUser(username).setSSL(SSL.Trusted)
val plugin     = AwsIamAuthenticationPlugin.default[IO]("ap-northeast-1", hostname, username)
val datasource = MySQLDataSource.pooling[IO](config, plugins = List(plugin))
val connector  = datasource.map(Connector.fromDataSource(_, Some(logHandler)))

Fixes

Fixes #xxxxx

Pull Request Checklist

  • Wrote unit and integration tests
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code formatting by scalafmt (sbt scalafmtAll command execution)
  • Add copyright headers to new files

References

@takapi327 takapi327 added this to the 0.5.0 milestone Dec 17, 2025
@takapi327 takapi327 self-assigned this Dec 17, 2025
@takapi327 takapi327 added the 🚀 feature New feature label Dec 17, 2025
@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 66.21622% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.05%. Comparing base (f4b21e9) to head (127db31).

Files with missing lines Patch % Lines
...dbc/amazon/plugin/AwsIamAuthenticationPlugin.scala 0.00% 10 Missing ⚠️
...rc/main/scala/ldbc/connector/MySQLDataSource.scala 12.50% 7 Missing ⚠️
...d/src/main/scala/ldbc/connector/net/Protocol.scala 71.42% 4 Missing ⚠️
...n/scala/ldbc/connector/pool/PooledDataSource.scala 66.66% 2 Missing ⚠️
...ctor/authenticator/MysqlNativePasswordPlugin.scala 0.00% 1 Missing ⚠️
...connector/authenticator/Sha256PasswordPlugin.scala 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@               Coverage Diff                @@
##           series/0.5.x     #598      +/-   ##
================================================
+ Coverage         84.87%   85.05%   +0.18%     
================================================
  Files               213      216       +3     
  Lines             11495    10893     -602     
  Branches           1126     1104      -22     
================================================
- Hits               9756     9265     -491     
+ Misses             1739     1628     -111     
Flag Coverage Δ
3.3.7 85.11% <66.21%> (-0.07%) ⬇️
3.7.4 85.08% <66.21%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@takapi327 takapi327 added the ldbc:connector Addition and modification of functionality to Connector projects label Dec 21, 2025
@takapi327 takapi327 mentioned this pull request Dec 21, 2025
16 tasks
@takapi327 takapi327 merged commit 96a964b into series/0.5.x Dec 21, 2025
91 of 109 checks passed
@takapi327 takapi327 deleted the feature/2025-12-Create-ldbc-auth-plugin branch December 21, 2025 12:42
@takapi327 takapi327 added project:authPlugin MySQL authentication plugin written in pure Scala3 project:awsAuthenticationPlugin Project for the plugin used with Aurora IAM authentication labels Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 feature New feature ldbc:connector Addition and modification of functionality to Connector projects project:authPlugin MySQL authentication plugin written in pure Scala3 project:awsAuthenticationPlugin Project for the plugin used with Aurora IAM authentication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants