potiuk commented on PR #34924:
URL: https://github.com/apache/airflow/pull/34924#issuecomment-1769118838

   >  Another solution would be to return NotImplemented by default and 
try/catch this exception. If this exception is thrown, then no Kerberos
   
   
   I'd say we could just leave a base `kerberos_auth`  that will be 
PARAMETERIZED with `find_user` method, You could do it in this way:
   
   kerberos_auth_base.py:
   
   ```
   def requires_authentication(function: T, find_user: Callable[..right type 
here]):
       ,,,,,
        
        g.user = find_user(username=ctx.kerberos_user)
   ```
   
   fab/kerberos_auth.py:
   
   ```
   from .. import kerberos_auth_base
   from functools import partial
   
   requires_authentication = 
partial(kerberos_auth_base(find_user=get_airflow_app().appbuilder.sm.find_user)
   ```
   
   
   Might be a bit over-the-top, but I think it solves reusability in a very 
nice way
   


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

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to