SameerMesiah97 opened a new pull request, #61969:
URL: https://github.com/apache/airflow/pull/61969

   **Description**
   
   This change centralizes OAuth `grant_type` validation in `SnowflakeHook` by 
introducing a `_validate_grant_type` method and a `SUPPORTED_GRANT_TYPES` 
constant.
   
   Validation logic that was previously implemented inline in 
`_get_conn_params` and `_get_valid_oauth_token` now delegates to 
`_validate_grant_type`, providing a single validation entry point for supported 
OAuth grant types.
   
   **Rationale**
   
   `grant_type` validation was previously implemented in multiple locations 
within the hook. Consolidating this logic into a single validation method 
ensures consistent enforcement of supported values and reduces duplication 
across OAuth-related code paths. Validation is performed during OAuth 
resolution rather than during static connection parameter construction, 
preserving the separation between configuration parsing and authentication 
enforcement and avoiding impact on non-OAuth authentication flows such as 
Azure-based authentication. Error messages for invalid or missing `grant_type` 
values have been consolidated under the new validation method.
   
   **Notes**
   
   Removed the redundant inline `client_credentials `grant type check in 
`_get_valid_oauth_token`.
   
   **Tests**
   
   Added a parametrized unit test covering supported, unsupported, and missing 
`grant_type` values to ensure centralized validation behaves consistently 
across valid and invalid inputs.
   
   **Backwards Compatibility**
   
   Method signatures of public APIs have not been altered. No behavior changes 
have been introduced. Error messages for invalid or missing `grant_type` values 
have been standardized as part of the centralized validation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to