Skip to content

Commit f8d7f95

Browse files
authored
Update readme, add instructions on how to add auth during generation (#33)
Because openapi schema is not listing the supported authentication schemas under security-section. The generated openapi client will not pass on any authenticaion configuration at all. Before generating the client, the relevant sections must be added. For more background, see apache/airflow#17172 and apache/airflow#17174
1 parent bf439f3 commit f8d7f95

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,11 @@ import airflow_client.client
6262
from pprint import pprint
6363
from airflow_client.client.api import config_api
6464
65-
# The client must use the authentication and authorization parameters
66-
# in accordance with the API server security policy.
67-
# Examples for each auth method are provided below, use the example that
68-
# satisfies your auth use case.
6965
#
70-
# In case of the basic authentication below, make sure that Airflow is
71-
# configured with the basic_auth as backend:
72-
#
73-
# auth_backend = airflow.api.auth.backend.basic_auth
74-
#
75-
# Make sure that your user/name are configured properly
66+
# In case of the basic authentication below. Make sure:
67+
# - Airflow is configured with the basic_auth as backend:
68+
# auth_backend = airflow.api.auth.backend.basic_auth
69+
# - Make sure that the client has been generated with securitySchema Basic.
7670
7771
# Configure HTTP basic authorization: Basic
7872
configuration = airflow_client.client.Configuration(
@@ -108,6 +102,19 @@ git clone [email protected]:apache/airflow-client-python.git
108102
109103
# clone Airflow repo (if not already)
110104
git clone [email protected]:apache/airflow.git
105+
```
106+
Edit the file `airflow/airflow/api_connexion/openapi/v1.yaml`
107+
Make sure it has the following `securitySchema`s listed under security `section`
108+
```yaml
109+
security:
110+
- Basic: []
111+
- GoogleOpenId: []
112+
- Kerberos: []
113+
```
114+
If your deployment of Airflow uses any different authentication mechanism than the three listed above, you might need to make further changes to the `v1.yaml` and generate your own client, see [OpenAPI Schema specification](https://swagger.io/docs/specification/authentication/) for details.
115+
(*These changes should not be commited to the upstream `v1.yaml` [as it will generate misleading openapi documentaion](https://github.com/apache/airflow/pull/17174)*)
116+
117+
```bash
111118
cd airflow
112119
113120
# bump up the version in python.sh & run the following command

0 commit comments

Comments
 (0)