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

chore(plugins): improve logging when anonymous not found #12833

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Apr 5, 2024

If the anonymous consumer isn't found, then the loader doesn't return an error, just nil. This causes the function kong.client.authenticate() to throw an error which is correct but not helpful to the enduser.

This fixes the error handling to properly report what is wrong. Also removed throwing errors in some handlers, and replaced it with the more proper return 500 code, to be able to run exit routines on those errors.

Summary

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix FTI-5861

If the anonymous consumer isn't found, then the loader
doesn't return an error, just nil. This causes the function
kong.client.authenticate() to throw an error which is correct
but not helpful to the enduser.

This fixes the error handling to properly report what is wrong.
Also removed throwing errors in some handlers, and replaced it with
the more proper return 500 code, to be able to run exit routines
on those errors.
kong/plugins/basic-auth/access.lua Outdated Show resolved Hide resolved
Copy link
Contributor

@vm-001 vm-001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test case are required

kong/plugins/oauth2/access.lua Outdated Show resolved Hide resolved
kong/plugins/ldap-auth/access.lua Outdated Show resolved Hide resolved
kong/plugins/key-auth/handler.lua Outdated Show resolved Hide resolved
kong/plugins/jwt/handler.lua Outdated Show resolved Hide resolved
kong/plugins/hmac-auth/access.lua Outdated Show resolved Hide resolved
@vm-001 vm-001 changed the title fix(plugins): fix auth-plugins if anonymous not found chore(plugins): improve logging when anonymous not found Apr 7, 2024
@AntoineJac
Copy link
Contributor

@vm-001 , any chance we have this PR merged? Thanks

@team-eng-enablement team-eng-enablement added author/community PRs from the open-source community (not Kong Inc) and removed author/community PRs from the open-source community (not Kong Inc) labels Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants