You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Joshua Kornblum (JIRA)" <ji...@apache.org> on 2019/08/09 14:55:00 UTC
[jira] [Updated] (AIRFLOW-5156) Add other authentication mechanisms
to HttpHook
[ https://issues.apache.org/jira/browse/AIRFLOW-5156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joshua Kornblum updated AIRFLOW-5156:
-------------------------------------
Description:
It looks like the only supported authentication for HttpHooks is basic auth.
The hook code shows
{quote}_if conn.login:_
_session.auth = (conn.login, conn.password)_
{quote}
requests library supports any auth that inherits AuthBase – in my scenario we need ntlmauth for API on IIS server. [https://2.python-requests.org/en/master/user/advanced/#custom-authentication]
I would suggest option to pass auth object in constructor then add to if/else control flow like
{quote}_if self.auth is not None:_
_session.auth = self.auth_
_elif conn.login:_
_session.auth = (conn.login, conn.password)_
{quote}
One would have to fetch the connection themselves and then fill out auth and then pass that to hook which is flexible although a little awkard.
{quote}api_conn = BaseHook().get_connection('my_api')
auth = HttpNtlmAuth(api_conn.login, api_conn.password)
HttpSensor(task_id='sensing', auth=auth, ....)
{quote}
was:
It looks like the only supported authentication for HttpHooks is basic auth.
The hook code shows
{quote}_if conn.login:_
_session.auth = (conn.login, conn.password)_
{quote}
requests library supports any auth that inherits AuthBase – in my scenario we need ntlmauth for API on IIS server. [https://2.python-requests.org/en/master/user/advanced/#custom-authentication]
I would suggest option to pass auth object in constructor then add to if/else control flow like
{quote}_if self.auth is not None:_
_session.auth = self.auth_
_elif conn.login:_
_session.auth = (conn.login, conn.password)_
{quote}
One would have to fetch the connection themselves and then fill out auth and then pass that to hook which is flexible although a little awkard.
{quote}api_conn = HttpHook('my_api').get_connection()
auth = HttpNtlmAuth(api_conn.login, api_conn.password)
HttpSensor(task_id='sensing', auth=auth, ....)
{quote}
> Add other authentication mechanisms to HttpHook
> -----------------------------------------------
>
> Key: AIRFLOW-5156
> URL: https://issues.apache.org/jira/browse/AIRFLOW-5156
> Project: Apache Airflow
> Issue Type: Improvement
> Components: hooks
> Affects Versions: 1.10.4
> Reporter: Joshua Kornblum
> Priority: Minor
>
> It looks like the only supported authentication for HttpHooks is basic auth.
> The hook code shows
> {quote}_if conn.login:_
> _session.auth = (conn.login, conn.password)_
> {quote}
> requests library supports any auth that inherits AuthBase – in my scenario we need ntlmauth for API on IIS server. [https://2.python-requests.org/en/master/user/advanced/#custom-authentication]
> I would suggest option to pass auth object in constructor then add to if/else control flow like
> {quote}_if self.auth is not None:_
> _session.auth = self.auth_
> _elif conn.login:_
> _session.auth = (conn.login, conn.password)_
> {quote}
> One would have to fetch the connection themselves and then fill out auth and then pass that to hook which is flexible although a little awkard.
> {quote}api_conn = BaseHook().get_connection('my_api')
> auth = HttpNtlmAuth(api_conn.login, api_conn.password)
> HttpSensor(task_id='sensing', auth=auth, ....)
> {quote}
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)