Configure AWS IAM Identity Center

Warning

The AWS auth manager is alpha/experimental at the moment and may be subject to change without warning.

In order to use the AWS auth manager, you first need to configure AWS IAM Identity Center. AWS IAM Identity Center is used by the AWS auth manager for authentication purposes (login and logout). Following configuration, the Airflow environment administrator can manage users and groups with Identity Center service.

Create resources

The AWS auth manager needs two resources in AWS IAM Identity Center: an instance and an application. You must create them manually.

Create the instance

The AWS auth manager leverages SAML 2.0 as the underlying technology powering authentication against AWS Identity Center.

There are several instance types, but only Organization level instances can use SAML 2.0 applications. See more details about instances types here.

Please follow AWS documentation to create the AWS IAM Identity Center instance at the organization level.

Create the application

Please follow the instructions below to create the AWS IAM Identity Center application.

  1. Open the IAM Identity Center console.

  2. Choose Applications.

  3. Choose the Customer managed tab.

  4. Choose Add application.

  5. On the Select application type page, under Setup preference, choose I have an application I want to set up.

  6. Under Application type, choose SAML 2.0.

  7. Choose Next.

  8. On the Configure application page, under Configure application, enter a Display name for the application, such as Airflow. Then, enter a Description.

  9. Under IAM Identity Center metadata, copy the address of the IAM Identity Center SAML metadata file.

Note

You will need to set this address in Airflow configuration later.

  1. Under Application metadata, choose Manually type your metadata values. Then, provide the Application ACS URL and Application SAML audience as follows.

    Important

    Replace <base_url> by the base URL of your Airflow UI. It should be defined in AIRFLOW__API__BASE_URL (e.g. localhost:8080 if Airflow is running locally).

  • Application ACS URL: <base_url>/auth/login_callback

  • Application SAML audience: aws-auth-manager-saml-client

  1. Choose Submit. The application is now created.

Attribute mappings configuration

Once the application is created, you need to configure the attribute mappings.

  1. Go to the details page of the application that you just created.

  2. Choose Actions.

  3. Under Actions, choose Edit attribute mappings.

  4. On the Attribute mappings page, you need to configure the different attribute mappings between your identity source and AWS IAM Identity Center. For more information on attribute mappings, see the IAM Identity Center documentation. The AWS auth manager needs two attributes: id and groups. If you use the default Identity Center directory as identity source, you can use the configuration below:

    • id

      • User attribute in the application: id

      • Maps to this string value or user attribute in IAM Identity Center: ${user:AD_GUID}

      • Format: basic

    • groups

      • User attribute in the application: groups

      • Maps to this string value or user attribute in IAM Identity Center: ${user:groups}

      • Format: basic

  5. Once both attributes id and groups are defined, choose Save changes.

Configure Airflow

You need to set in Airflow configuration:

  • The <base_url> specified in AWS IAM Identity Center configuration previously

  • The IAM Identity Center SAML metadata file copied previously

[api]
base_url = <base_url>

[aws_auth_manager]
saml_metadata_url = <saml_metadata_file_url>

or

export AIRFLOW__API__BASE_URL='<base_url>'
export AIRFLOW__AWS_AUTH_MANAGER__SAML_METADATA_URL='<saml_metadata_file_url>'

Logging in from the access portal (IdP-initiated SSO)

By default the AWS auth manager only accepts a SAML response that answers a login started from Airflow itself. When you open <base_url>/auth/login, Airflow sends an AuthnRequest to Identity Center and remembers its id in a short-lived, signed, HttpOnly cookie; the response is accepted only if it echoes that id back in InResponseTo.

This binding matters because a SAML assertion is signed by the identity provider, which authenticates the identity in the response — it says nothing about which browser asked for it. Without the binding, an assertion issued for one login would be accepted by a browser that never started it, signing that browser in as the assertion’s subject rather than as the person using it.

The cost is that clicking the Airflow tile in the AWS IAM Identity Center access portal no longer works: that flow produces an assertion nobody asked for, and Airflow cannot tell it apart from a replayed one. If you need it, enable it explicitly:

[aws_auth_manager]
allow_idp_initiated_login = True

or

export AIRFLOW__AWS_AUTH_MANAGER__ALLOW_IDP_INITIATED_LOGIN='True'

With this enabled, Airflow still requires the assertion to be signed by the configured identity provider, and still refuses one that carries an InResponseTo value — an unsolicited assertion answers no request, so a response that names one is a solicited assertion being replayed. What it gives up is the guarantee that the browser receiving the response is the one that asked for it. Leave it disabled unless the access portal flow is required.

Was this entry helpful?