feat(fab): Add configurable role key for Azure OAuth groups#61585
Conversation
Add AUTH_OAUTH_ROLE_KEYS configuration to allow Azure AD OAuth to use 'groups' claim instead of hardcoded 'roles' claim. This enables organizations using Azure AD groups for access control to map group memberships to Airflow roles without requiring custom app role definitions. Changes: - Add AUTH_OAUTH_ROLE_KEYS config support in get_oauth_user_info - Default to 'roles' for backward compatibility - Add test case for Azure OAuth with groups configuration - Add documentation for Azure AD group-based authorization
|
We should ensure the tests run within an application context. |
For your next PRs that refer to a specific issue - please also comment on the issue that you ask to be assigned for, and check please if others asked for that just before you - so there won't be a situation where two people work on the same issue in parallel. Thank you! |
|
Thanks for the heads-up! I wasn't aware of the strict assignment protocol as a new contributor. I'll make sure to claim the issue first next time. Thanks for reviewing! |
40cc26c to
05f33ed
Compare
…KEYS - Add has_app_context() check in get_oauth_user_info() to support both production and test environments - Update test to use real Flask app context instead of mocking current_app
05f33ed to
00a3f06
Compare
- Removed has_app_context() conditional in Azure OAuth handler - Added Flask app context to tests to simulate production environment - Updated test_get_oauth_user_info to provide Flask context for all providers - Updated test_get_oauth_user_info_azure_with_groups_config with app.config setup Per committer feedback: "this function is always called within the request context"
|
LGTM - but would love @vincbeck to confirm :) |
…1585) * feat(fab): Add configurable role key for Azure OAuth groups Add AUTH_OAUTH_ROLE_KEYS configuration to allow Azure AD OAuth to use 'groups' claim instead of hardcoded 'roles' claim. This enables organizations using Azure AD groups for access control to map group memberships to Airflow roles without requiring custom app role definitions. Changes: - Add AUTH_OAUTH_ROLE_KEYS config support in get_oauth_user_info - Default to 'roles' for backward compatibility - Add test case for Azure OAuth with groups configuration - Add documentation for Azure AD group-based authorization * Fix Azure OAuth to support configurable role key via AUTH_OAUTH_ROLE_KEYS - Add has_app_context() check in get_oauth_user_info() to support both production and test environments - Update test to use real Flask app context instead of mocking current_app * Remove has_app_context() check per review feedback - Removed has_app_context() conditional in Azure OAuth handler - Added Flask app context to tests to simulate production environment - Updated test_get_oauth_user_info to provide Flask context for all providers - Updated test_get_oauth_user_info_azure_with_groups_config with app.config setup Per committer feedback: "this function is always called within the request context"
…1585) * feat(fab): Add configurable role key for Azure OAuth groups Add AUTH_OAUTH_ROLE_KEYS configuration to allow Azure AD OAuth to use 'groups' claim instead of hardcoded 'roles' claim. This enables organizations using Azure AD groups for access control to map group memberships to Airflow roles without requiring custom app role definitions. Changes: - Add AUTH_OAUTH_ROLE_KEYS config support in get_oauth_user_info - Default to 'roles' for backward compatibility - Add test case for Azure OAuth with groups configuration - Add documentation for Azure AD group-based authorization * Fix Azure OAuth to support configurable role key via AUTH_OAUTH_ROLE_KEYS - Add has_app_context() check in get_oauth_user_info() to support both production and test environments - Update test to use real Flask app context instead of mocking current_app * Remove has_app_context() check per review feedback - Removed has_app_context() conditional in Azure OAuth handler - Added Flask app context to tests to simulate production environment - Updated test_get_oauth_user_info to provide Flask context for all providers - Updated test_get_oauth_user_info_azure_with_groups_config with app.config setup Per committer feedback: "this function is always called within the request context"
…1585) * feat(fab): Add configurable role key for Azure OAuth groups Add AUTH_OAUTH_ROLE_KEYS configuration to allow Azure AD OAuth to use 'groups' claim instead of hardcoded 'roles' claim. This enables organizations using Azure AD groups for access control to map group memberships to Airflow roles without requiring custom app role definitions. Changes: - Add AUTH_OAUTH_ROLE_KEYS config support in get_oauth_user_info - Default to 'roles' for backward compatibility - Add test case for Azure OAuth with groups configuration - Add documentation for Azure AD group-based authorization * Fix Azure OAuth to support configurable role key via AUTH_OAUTH_ROLE_KEYS - Add has_app_context() check in get_oauth_user_info() to support both production and test environments - Update test to use real Flask app context instead of mocking current_app * Remove has_app_context() check per review feedback - Removed has_app_context() conditional in Azure OAuth handler - Added Flask app context to tests to simulate production environment - Updated test_get_oauth_user_info to provide Flask context for all providers - Updated test_get_oauth_user_info_azure_with_groups_config with app.config setup Per committer feedback: "this function is always called within the request context"
…1585) * feat(fab): Add configurable role key for Azure OAuth groups Add AUTH_OAUTH_ROLE_KEYS configuration to allow Azure AD OAuth to use 'groups' claim instead of hardcoded 'roles' claim. This enables organizations using Azure AD groups for access control to map group memberships to Airflow roles without requiring custom app role definitions. Changes: - Add AUTH_OAUTH_ROLE_KEYS config support in get_oauth_user_info - Default to 'roles' for backward compatibility - Add test case for Azure OAuth with groups configuration - Add documentation for Azure AD group-based authorization * Fix Azure OAuth to support configurable role key via AUTH_OAUTH_ROLE_KEYS - Add has_app_context() check in get_oauth_user_info() to support both production and test environments - Update test to use real Flask app context instead of mocking current_app * Remove has_app_context() check per review feedback - Removed has_app_context() conditional in Azure OAuth handler - Added Flask app context to tests to simulate production environment - Updated test_get_oauth_user_info to provide Flask context for all providers - Updated test_get_oauth_user_info_azure_with_groups_config with app.config setup Per committer feedback: "this function is always called within the request context"
…1585) * feat(fab): Add configurable role key for Azure OAuth groups Add AUTH_OAUTH_ROLE_KEYS configuration to allow Azure AD OAuth to use 'groups' claim instead of hardcoded 'roles' claim. This enables organizations using Azure AD groups for access control to map group memberships to Airflow roles without requiring custom app role definitions. Changes: - Add AUTH_OAUTH_ROLE_KEYS config support in get_oauth_user_info - Default to 'roles' for backward compatibility - Add test case for Azure OAuth with groups configuration - Add documentation for Azure AD group-based authorization * Fix Azure OAuth to support configurable role key via AUTH_OAUTH_ROLE_KEYS - Add has_app_context() check in get_oauth_user_info() to support both production and test environments - Update test to use real Flask app context instead of mocking current_app * Remove has_app_context() check per review feedback - Removed has_app_context() conditional in Azure OAuth handler - Added Flask app context to tests to simulate production environment - Updated test_get_oauth_user_info to provide Flask context for all providers - Updated test_get_oauth_user_info_azure_with_groups_config with app.config setup Per committer feedback: "this function is always called within the request context"
Add AUTH_OAUTH_ROLE_KEYS configuration to allow Azure AD OAuth to use 'groups' claim instead of hardcoded 'roles' claim.
This enables organizations using Azure AD groups for access control to map group memberships to Airflow roles without requiring custom app role definitions.
Changes:
closes: #61567
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.