From 862bd59bce5b9e8a7550431eac94d2c15593c82b Mon Sep 17 00:00:00 2001 From: Joshua Carp Date: Tue, 18 Sep 2018 22:08:10 -0400 Subject: [PATCH] [AIRFLOW-3089] Drop hard-coded url scheme in google auth redirect. The google auth provider hard-codes the `_scheme` in the callback url to `https` so that airflow generates correct urls when run behind a proxy that terminates tls. But this means that google auth can't be used when running without https--for example, during local development. Also, hard-coding `_scheme` isn't the correct solution to the problem of running behind a proxy. Instead, the proxy should be configured to set the `X-Forwarded-Proto` header to `https`; Flask interprets this header and generates the appropriate callback url without hard-coding the scheme. --- airflow/contrib/auth/backends/google_auth.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/airflow/contrib/auth/backends/google_auth.py b/airflow/contrib/auth/backends/google_auth.py index bc7d552f59e93..ddbcb1222f2c0 100644 --- a/airflow/contrib/auth/backends/google_auth.py +++ b/airflow/contrib/auth/backends/google_auth.py @@ -112,8 +112,7 @@ def login(self, request): log.debug('Redirecting user to Google login') return self.google_oauth.authorize(callback=url_for( 'google_oauth_callback', - _external=True, - _scheme='https'), + _external=True), state=request.args.get('next') or request.referrer or None) def get_google_user_profile_info(self, google_token):