Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dinvlad committed Aug 22, 2020
1 parent 3fc1a42 commit 9d9ca40
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions google_yubikey/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ def _check_request_headers():
log.debug(request.method + ' ' + request.path)
if request.path == '/':
return None
elif request.headers.get('X-Forwarded-For') or \
request.headers.get('Metadata-Flavor') != 'Google' or \
request.headers.get('Host') not in GCEMetadata.HOSTS + [GCEMetadata.IP]:
headers = request.headers
if headers.get('X-Forwarded-For') or \
headers.get('Metadata-Flavor') != 'Google' or \
headers.get('Host') not in GCEMetadata.HOSTS + [GCEMetadata.IP]:
return abort(401)
else:
return None
return None

@app.after_request
def _add_response_headers(response: Response):
Expand Down

0 comments on commit 9d9ca40

Please sign in to comment.