ephraimbuddy commented on pull request #15295:
URL: https://github.com/apache/airflow/pull/15295#issuecomment-817607888


   > I can never understand Flask contexts and will just ask the dump question: 
Can (should?) this use the request context instead and why (not)? API 
authentication feels like a request-level thing to me, although Flask’s 
application context is actually per-request so the request context might not 
actually meant to be used for request-level stuff anyway, I have no idea.
   
   From the docs, `flask.g` is a good place to store resources during a 
request: https://flask.palletsprojects.com/en/1.1.x/api/#flask.g. 
   Even though it's in the application context, it gets destroyed after each 
request. It's possible to store in request context but I think that storing it 
in flask.g is also good since they also admitted that it's a good place to 
store resources during a request.
   
   > BTW why does g.login_from_api need to be set in two places? I’d assume 
there’s a callback that all requests flow through that can be used to set 
context for API authentication?
   
   This is because login can be configured to be processed through the header 
in flask login and appbuilder uses flask login. It's not configured in airflow 
but some other persons may configure login through the header.


-- 
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]


Reply via email to