Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong error message returned when Authorization header is present but the "Bearer " prefix is missing #421

Closed
omasseau opened this issue Mar 1, 2022 · 1 comment

Comments

@omasseau
Copy link

omasseau commented Mar 1, 2022

When the Authorization header is found but its value does not contain a space (because the caller forgot to add 'Bearer ' at the start), then openid returns the error message "no Authorization header found".
This is misleading when troubleshooting as the cause of the error is not the Authorization header that is not present but its value that is incorrect.

  if header == nil or header:find(" ") == nil then
    err = "no Authorization header found"
    log(DEBUG, err)
    return nil, err
  end

--> header:find(" ") == nil is the problem here.

Environment
  • lua-resty-openidc 1.7.5
Expected behaviour

A more appropriate error should be returned (like "no Bearer authorization header value found") :)

Actual behaviour

"no Authorization header found" error is returned

@bodewig bodewig closed this as completed in a468d13 Mar 5, 2022
@bodewig
Copy link
Collaborator

bodewig commented Mar 5, 2022

True, I've moved the 0 check down to the next if statement where it will now say "no Bearer authorization header value found"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants