Federated Authentication Plugin

June 18, 2026 ยท View on GitHub

The Federated Authentication Plugin adds support for authentication via Federated Identity and then database access via IAM. Currently, only Microsoft Active Directory Federation Services (AD FS) is supported.

What is Federated Identity

Federated Identity allows users to use the same set of credentials to access multiple services or resources across different organizations. This works by having Identity Providers (IdP) that manage and authenticate user credentials, and Service Providers (SP) that are services or resources that can be internal, external, and/or belonging to various organizations. Multiple Service Providers can establish trust relationships with a single IdP.

When a user wants access to a resource, it authenticates with the IdP. From this a security token generated and is passed to the SP then grants access to said resource. In the case of AD FS, the user signs into the AD FS sign in page. This generates a SAML Assertion which acts as a security token. The user then passes the SAML Assertion to the SP when requesting access to resources. The SP verifies the SAML Assertion and grants access to the user.

Prerequisites

Warning


This plugin requires the AWS SDK for Python - Boto3. Boto3 is a runtime dependency and must be resolved. It can be installed via pip install boto3.

Warning


To use this plugin, you must provide valid AWS credentials. The AWS SDK relies on the AWS SDK credential provider chain to authenticate with AWS services. If you are using temporary credentials (such as those obtained through AWS STS, IAM roles, or SSO), be aware that these credentials have an expiration time. AWS SDK exceptions will occur and the plugin will not work properly if your credentials expire without being refreshed or replaced. To avoid interruptions:

  • Ensure your credential provider supports automatic refresh (most AWS SDK credential providers do this automatically)
  • Monitor credential expiration times in production environments
  • Configure appropriate session durations for temporary credentials
  • Implement proper error handling for credential-related failures

For more information on configuring AWS credentials, see our AWS credentials documentation.

How to use the Federated Authentication Plugin with the AWS Advanced Python Wrapper

Enabling the Federated Authentication Plugin

Note


AWS IAM database authentication is needed to use the Federated Authentication Plugin. This is because after the plugin acquires SAML assertion from the identity provider, the SAML Assertion is then used to acquire an AWS IAM token. The AWS IAM token is then subsequently used to access the database.

  1. Enable AWS IAM database authentication on an existing database or create a new database with AWS IAM database authentication on the AWS RDS Console:
  2. Set up an IAM Identity Provider and IAM role. The IAM role should be using the IAM policy set up in step 1.
  3. Add the plugin code federated_auth to the plugins value, or to the current driver profile.
  4. Specify parameters that are required or specific to your case.

Federated Authentication Plugin Parameters

ParameterValueRequiredDescriptionDefault ValueExample Value
db_userStringYesThe user name of the IAM user with access to your database.
If you have previously used the IAM Authentication Plugin, this would be the same IAM user.
For information on how to connect to your Aurora Database with IAM, see this documentation.
Nonesome_user_name
idp_usernameStringYesThe user name for the idp_endpoint server. If this parameter is not specified, the plugin will fallback to using the user parameter.Nonejimbob@example.com
idp_passwordStringYesThe password associated with the idp_endpoint username. If this parameter is not specified, the plugin will fallback to using the password parameter.Nonesome_random_password
idp_endpointStringYesThe hosting URL for the service that you are using to authenticate into AWS Aurora.Noneec2amaz-ab3cdef.example.com
iam_role_arnStringYesThe ARN of the IAM Role that is to be assumed to access AWS Aurora.Nonearn:aws:iam::123456789012:role/adfs_example_iam_role
iam_idp_arnStringYesThe ARN of the Identity Provider.Nonearn:aws:iam::123456789012:saml-provider/adfs_example
iam_regionStringYesThe IAM region where the IAM token is generated.Noneus-east-2
idp_nameStringNoThe name of the Identity Provider implementation used.adfsadfs
idp_portIntegerNoThe port that the host for the authentication service listens at.4431234
rp_identifierStringNoThe relaying party identifier.urn:amazon:webservicesurn:amazon:webservices
iam_hostStringNoOverrides the host that is used to generate the IAM token.Nonedatabase.cluster-hash.us-east-1.rds.amazonaws.com
iam_default_portStringNoThis property overrides the default port that is used to generate the IAM token. The default port is determined based on the underlying driver protocol. For now, there is support for PostgreSQL and MySQL. Target drivers with different protocols will require users to provide a default port.None1234
iam_token_expirationIntegerNoOverrides the default IAM token cache expiration in seconds870123
http_request_connect_timeoutIntegerNoThe timeout value in seconds to send the HTTP request data used by the FederatedAuthPlugin.6060
ssl_secureBooleanNoWhether the SSL session is to be secure and the server's certificates will be verifiedTrueFalse

Sample code

MySQLFederatedAuthentication.py PGFederatedAuthentication.py

Using Federated Authentication with Global Databases

When using Federated authentication with Amazon Aurora Global Databases, the IAM user or role requires the additional rds:DescribeGlobalClusters permission. This permission allows the wrapper to resolve the Global Database endpoint to the appropriate regional cluster for IAM token generation.

Example IAM policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "rds-db:connect",
                "rds:DescribeGlobalClusters"
            ],
            "Resource": "*"
        }
    ]
}