team-carepay / carepool-aws-jdbc

RDS support for Hikari, Tomcat and MariaDB
0 stars 3 forks source link

Question: WildFlyDataSource IAM Authentication #7

Open viswa-optimusprime opened 2 years ago

viswa-optimusprime commented 2 years ago

Hi @blagerweij We use Wildfly application server for application. Application uses JNDI Datasource for connection. How to implement IAM mysql authentication for wildfly datasource like tomcat you provided.

I used plugin way but after 15 mins(token expiry) application is crashing.. Do i need to create custom data source?

https://github.com/wildfly/wildfly/blob/main/connector/src/main/java/org/jboss/as/connector/subsystems/datasources/WildFlyDataSource.java

Thanks

blagerweij commented 1 year ago

You did not mention which driver you're using (MySQL or MariaDB, the project provides plugins for both). Some DataSource implementations cache the password, which obviously does not work well with IAM (where the RDS token should be refreshed every 15 minutes). This project tries to refresh the token after 10 minutes.

You could also give the Amazon JDBC driver (fork from MySQL) a try, see if that works. See https://github.com/awslabs/aws-mysql-jdbc . It has support for IAM authentication, but requires a few additional JAR files on the classpath