Skip to content

Commit

Permalink
Refactor FederatedAuthPlugin and add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronchung-bitquill committed Nov 17, 2023
1 parent 6bc826d commit bc89e93
Show file tree
Hide file tree
Showing 22 changed files with 1,785 additions and 423 deletions.
4 changes: 0 additions & 4 deletions config/checkstyle/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,4 @@
<suppress files="[\\/]PgDataSourceHelper\.java" checks="IllegalImport"/>
<suppress files="[\\/]test[\\/]" checks="IllegalImport"/>
<suppress files="[\\/]ExtendedFormatter\.java" checks="Header"/>
<suppress files="[\\/]NonValidatingFactory\.java" checks="Header"/>
<suppress files="[\\/]WrappedFactory\.java" checks="Header"/>
<suppress files="[\\/]FederatedAuthConnectionPluginFactory\.java" checks="Header"/>
<suppress files="[\\/]FederatedAuthConnectionPlugin\.java" checks="Header"/>
</suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package software.amazon;

import software.amazon.jdbc.PropertyDefinition;
import software.amazon.jdbc.plugin.FederatedAuthConnectionPlugin;
import software.amazon.jdbc.plugin.federatedauth.FederatedAuthConnectionPlugin;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
Expand All @@ -35,6 +35,7 @@ public static void main(String[] args) throws SQLException {

// Enable the AWS Federated Authentication Connection Plugin.
properties.setProperty(PropertyDefinition.PLUGINS.name, "federatedAuth");
properties.setProperty(FederatedAuthConnectionPlugin.IDP_NAME.name, "adfs");
properties.setProperty(FederatedAuthConnectionPlugin.IDP_HOST.name, "ec2amaz-ab3cdef.example.com");
properties.setProperty(FederatedAuthConnectionPlugin.IAM_ROLE_ARN.name, "arn:aws:iam::123456789012:role/adfs_example_iam_role");
properties.setProperty(FederatedAuthConnectionPlugin.IAM_IDP_ARN.name, "arn:aws:iam::123456789012:saml-provider/adfs_example");
Expand Down
3 changes: 2 additions & 1 deletion wrapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ dependencies {
testImplementation("org.mockito:mockito-inline:4.11.0") // 4.11.0 is the last version compatible with Java 8
testImplementation("software.amazon.awssdk:rds:2.21.11")
testImplementation("software.amazon.awssdk:ec2:2.21.12")
testImplementation("software.amazon.awssdk:secretsmanager:2.21.21")
testImplementation("software.amazon.awssdk:secretsmanager:2.21.11")
testImplementation("software.amazon.awssdk:sts:2.21.11")
testImplementation("org.testcontainers:testcontainers:1.19.1")
testImplementation("org.testcontainers:mysql:1.19.1")
testImplementation("org.testcontainers:postgresql:1.19.1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
import software.amazon.jdbc.plugin.DefaultConnectionPlugin;
import software.amazon.jdbc.plugin.DriverMetaDataConnectionPluginFactory;
import software.amazon.jdbc.plugin.ExecutionTimeConnectionPluginFactory;
import software.amazon.jdbc.plugin.FederatedAuthConnectionPluginFactory;
import software.amazon.jdbc.plugin.IamAuthConnectionPluginFactory;
import software.amazon.jdbc.plugin.LogQueryConnectionPluginFactory;
import software.amazon.jdbc.plugin.dev.DeveloperConnectionPluginFactory;
import software.amazon.jdbc.plugin.efm.HostMonitoringConnectionPluginFactory;
import software.amazon.jdbc.plugin.failover.FailoverConnectionPluginFactory;
import software.amazon.jdbc.plugin.federatedauth.FederatedAuthConnectionPluginFactory;
import software.amazon.jdbc.plugin.readwritesplitting.ReadWriteSplittingPluginFactory;
import software.amazon.jdbc.plugin.staledns.AuroraStaleDnsPluginFactory;
import software.amazon.jdbc.profile.DriverConfigurationProfiles;
Expand Down
Loading

0 comments on commit bc89e93

Please sign in to comment.