Skip to content

Commit

Permalink
[AIRFLOW-3089] Drop hard-coded url scheme in google auth redirect. (#…
Browse files Browse the repository at this point in the history
…3919)

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.
  • Loading branch information
jmcarp authored and Fokko Driesprong committed Oct 13, 2018
1 parent e232f4d commit 110382d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions airflow/contrib/auth/backends/google_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,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):
Expand Down

0 comments on commit 110382d

Please sign in to comment.