[ 
https://issues.apache.org/jira/browse/AIRFLOW-5156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17085811#comment-17085811
 ] 

ASF GitHub Bot commented on AIRFLOW-5156:
-----------------------------------------

randr97 commented on pull request #8429: [AIRFLOW-5156] Added auth type to 
HttpHook
URL: https://github.com/apache/airflow/pull/8429
 
 
   ---
   Make sure to mark the boxes below before creating PR: [x]
   
   - [x] Description above provides context of the change
   - [x] Unit tests coverage for changes (not needed for documentation changes)
   - [x] Commits follow "[How to write a good git commit 
message](http://chris.beams.io/posts/git-commit/)"
   - [x] Relevant documentation is updated including usage instructions.
   - [x] I will engage committers as explained in [Contribution Workflow 
Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   ---
   In case of fundamental code change, Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in 
[UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   Read the [Pull Request 
Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)
 for more information.
   
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> 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
>            Assignee: Rohit S S
>            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
(v8.3.4#803005)

Reply via email to