Be more verbose
This commit is contained in:
parent
aa5b414af2
commit
83f531e680
@ -165,6 +165,7 @@ def require_basic_auth(f):
|
||||
try:
|
||||
auth_type, auth_string = auth_header.split(' ', 1)
|
||||
if auth_type.lower() != 'basic':
|
||||
logger.info("Invalid authentication header '{auth_type}'")
|
||||
return authenticate()
|
||||
|
||||
# Decode base64 credentials
|
||||
@ -172,9 +173,11 @@ def require_basic_auth(f):
|
||||
username, password = credentials.split(':', 1)
|
||||
|
||||
if not (username == API_USERNAME and password == API_PASSWORD):
|
||||
logger.info(f"Invalid authentication with username='{username}' and password='{password}'")
|
||||
return authenticate()
|
||||
|
||||
except (ValueError, base64.binascii.Error):
|
||||
logger.info("Invalid authentication encoding")
|
||||
return authenticate()
|
||||
|
||||
return f(*args, **kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user