Fix auth_header

If a colon is in the password, user and password are not well detected.
For example if user="me" and password="pass:word" the function give
user="me:pass" password="word"
This commit is contained in:
ewilly 2023-01-12 20:24:42 +01:00 committed by Alexandre Aubin
parent 226e3bdf4c
commit e2114c0df5

View file

@ -275,7 +275,7 @@ function validate_or_clear_basic_auth_header_provided_by_client()
-- Try to authenticate the user,
-- or remove the Auth header if not valid
_, _, user, password = string.find(ngx.decode_base64(b64_cred), "^(.+):(.+)$")
_, _, user, password = string.find(ngx.decode_base64(b64_cred), "^([^:]+):(.+)$")
user = authenticate(user, password)
if user then
logger.debug("User got authenticated through basic auth")