aws / aws-advanced-jdbc-wrapper

The Amazon Web Services JDBC Driver has been redesigned as an advanced JDBC wrapper. This wrapper is complementary to and extends the functionality of an existing JDBC driver to help an application take advantage of the features of clustered databases such as Amazon Aurora.
Apache License 2.0
217 stars 46 forks source link

[SQLServer, MS SQL Server] Use `accessToken` property in lieu of password in IAM Plugin for MS SQL Server connections #1159

Open bgshacklett opened 1 month ago

bgshacklett commented 1 month ago

Describe the feature

Documentation states that the accessToken property must be specified instead of the password property when using IAM authentication for MS SQL Server: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-connecting.html#rds-proxy-connecting-sqlserver

At present, the plugin only supports using the password property. It would be very helpful to be able to connect to RDS-Proxy for MS SQL Server instances using IAM Authentication.

Use Case

I want to connect to an RDS Proxy endpoint for MS SQL Server, using IAM Authentication, without using custom code.

Proposed Solution

Update the IAM plugin with logic based on DB Engine to set the accessToken property instead of the password property: https://github.com/bgshacklett/aws-advanced-jdbc-wrapper/blob/main/wrapper/src/main/java/software/amazon/jdbc/plugin/iam/IamAuthConnectionPlugin.java#L153

Perhaps it would make sense to split this logic out into multiple implementations of the IamAuthConnectionPlugin class, with the desired implementation being created in the IamAuthConnectionPluginFactory class

Other Information

No response

Acknowledgements

The AWS Advanced JDBC Driver version used

Latest

JDK version used

1.8

Operating System and version

Container image: tomcat:9