apache/airflow-client-python

API client configuration lack of support to pass verify_ssl for oauth based token authentication

BalaMuralibi opened this issue · 0 comments

Issue:
I am using airflow client with our own authentication based in azure AD , API is throwing forbidden error as stated below.

I think it is due to ssl cert verification is causing the issue, It would be great to have verify_ssl = true/false as parameter to configuration.

Github Code

https://github.com/apache/airflow-client-python/blob/8bf55dbc64d72ea318027c49ceda8d59490494c2/airflow_client/client/configuration.py#L118C3-L127C20

Suggestion for workaround

Can someone recommend any workaround to resolve my issue ?

Sample Code

import airflow_client.client
from pprint import pprint
from airflow_client.client.api import config_api


auth_backend = airflow.customauth

configuration = airflow_client.client.Configuration(
    host="http://localhost/api/v1",
    access_token='Bearer xxxxxxxxxxxx' 
)


# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = config_api.ConfigApi(api_client)

    try:
        # Get current configuration
        api_response = api_instance.get_config()
        pprint(api_response)
    except airflow_client.client.ApiException as e:
        print("Exception when calling ConfigApi->get_config: %s\n" % e)    

Error:

Exception when calling VariableApi->get_variables: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 22 Mar 2024 13:29:05 GMT', 'Content-Type': 'application/problem+json', 'Content-Length': '185', 'Connection': 'keep-alive', 'x-robots-tag':
'noindex, nofollow', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains'})
HTTP response body: {
"detail": null,
"status": 403,
"title": "Forbidden",
"type": "https://airflow.apache.org/docs/apache-airflow/2.8.1/stable-rest-api-ref.html#section/Errors/PermissionDenied"
}