wooden-arm-26381
07/14/2022, 1:45 PMmetadata_service_authentication
?
I’m trying to get my recipes to use an extra header for authorization purposes. I could already confirm with the GraphQL endpoint that my headers containing the Google IAP token and the DataHub personal access token work. Example:
curl --location --request POST '<https://example.com/api/graphql>' \
--header 'Authorization: Bearer <personal access token>' \
--header 'Proxy-Authorization: Bearer <IAP token>' \
--header 'Content-Type: application/json' \
--data-raw '{"query": "{\n me {\n corpUser {\n username\n }\n }\n}"}'
However, when trying to ingest using recipes, it seems like the emitter ignores the extra_headers
field containing the proxy token. Example:
sink:
type: "datahub-rest"
config:
server: "<https://example.com:443>"
token: "<personal access token>"
extra_headers:
Proxy-Authorization: "Bearer <IAP token>"
Looking at the source code, it should be possible to set a custom header: https://github.com/datahub-project/datahub/blob/master/metadata-ingestion/src/datahub/emitter/rest_emitter.py#L82
Interestingly, the extra_headers
field seems to work when no second (personal access) token is required and the proxy token is set as Authorization
instead of `Proxy-Authorization`:
sink:
type: "datahub-rest"
config:
server: "<https://example.com:443>"
extra_headers:
Authorization: "Bearer <IAP token>"
Of course, just setting the proxy token as token
directly works too.
I’m on v0.8.40.2.
Any help greatly appreciated!
Cheersbland-orange-95847
07/15/2022, 7:44 AMbig-carpet-38439
07/19/2022, 10:46 PMwooden-arm-26381
07/20/2022, 11:11 AMbig-carpet-38439
07/20/2022, 6:06 PMbig-carpet-38439
07/20/2022, 6:06 PMbland-orange-95847
07/20/2022, 6:39 PMconfig.server
value is pointing to our proxy server which redirects than to DataHub REST API. Or what do you mean?bland-orange-95847
07/20/2022, 6:41 PMcofig.token
is set to DataHub API token and config.extra_headers.Proxy-Authorization
our proxy token.
Or is the format of our extra-headers
definition not correct?big-carpet-38439
07/20/2022, 8:14 PMbig-carpet-38439
07/20/2022, 8:15 PMbland-orange-95847
07/21/2022, 4:51 AMProxy-Authorization
for our proxy. But it seemed like it does not get picked up correctly.bland-orange-95847
07/21/2022, 4:53 AMextra_headers
simply work and it does if we do not need two tokens. (but that is not our case)
Would it even be possible to set `Authorization`and Proxy-Authorization
in one extra_header
? How would it look like from format etc?square-activity-64562
07/26/2022, 3:28 PMDATAHUB_DEBUG=true
env variable @wooden-arm-26381 to see if that gives you some information about what might be going wrong here? I don't have datahub behind IAP to test this out but that env variable should print out the curl commands being used. That might help in debugging this problem further.wooden-arm-26381
07/27/2022, 7:56 AMdatahub --debug ingest -c recipe.yaml
gives following output:
[2022-07-27 09:09:21,073] INFO {datahub.cli.ingest_cli:99} - DataHub CLI version: 0.8.40.2
[2022-07-27 09:09:21,076] DEBUG {datahub.cli.ingest_cli:105} - Using config: {'source': {'type': 'bigquery', 'config': {'project_id': 'my-gcp-project_id', 'env': 'DEV', 'include_views': False, 'table_pattern': {'deny': ['.*']}, 'include_table_lineage': False}}, 'sink': {'type': 'datahub-rest', 'config': {'server': '<https://example.com:443>', 'token': '<personal access token>', 'extra_headers': {'Proxy-Authorization': 'Bearer <IAP token>'}}}}
Looks like the recipe got rendered correctly but I’m getting this error:
[2022-07-27 09:09:21,515] ERROR {datahub.entrypoints:165} - Unable to connect to <https://example.com:443/config> with status_code: 401. Maybe you need to set up authentication? Please check your configuration and make sure you are talking to the DataHub GMS (usually <datahub-gms-host>:8080) or Frontend GMS API (usually <frontend>:9002/api/gms).
I’m using the same URL as without metadata authentication.
But accessing GraphQL with activated authentication via curl still worked.square-activity-64562
07/27/2022, 8:51 AMwooden-arm-26381
07/27/2022, 9:00 AMwooden-arm-26381
07/27/2022, 12:42 PMsquare-activity-64562
07/27/2022, 12:51 PM