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

feat: add hide_credentials for multi-auth plugin #11152

Closed

Conversation

madhawa-gunasekara
Copy link
Member

Fixes #11069 11069

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@madhawa-gunasekara madhawa-gunasekara changed the title add hide_credentials for multi-auth plugin feat: add hide_credentials for multi-auth plugin Apr 15, 2024
@madhawa-gunasekara madhawa-gunasekara force-pushed the issue-11069 branch 2 times, most recently from 73d0293 to 7460aef Compare April 15, 2024 12:35
@shreemaan-abhishek
Copy link
Contributor

Hi I don't understand this feature well. Could you please describe this in more detail in the linked issue?

@madhawa-gunasekara
Copy link
Member Author

Hi @shreemaan-abhishek,

multi-auth plugin works as a wrapper to enable multiple authentication for routes. but I found there is a bug where users can't use a common header name for multiple authentication with credential hiding option. which we need fixed, most of the cases users need to hide their credentials. I fixed that with this pull request. this fix will allow users to use a common header to use multiple authentication with credential hiding.

@shreemaan-abhishek
Copy link
Contributor

does this bug exist only in jwt-auth when used with multi-auth? I suppose other auth plugins would need fixing too.

@madhawa-gunasekara
Copy link
Member Author

Hi @shreemaan-abhishek,

most of the auth plugins use http headers, few use query params and cookies, jwt-auth and key-auth are some of them. In this fix we clear the auth-details after iterating thru all the auth plugins. Therefore I moved a generic code snippet where it clears the cookies to utils, to avoid code redundency.
AFAIK with this fix all the auth-plugins are covered with multi-auth plugin.

apisix/plugins/multi-auth.lua Outdated Show resolved Hide resolved
apisix/plugins/multi-auth.lua Outdated Show resolved Hide resolved
apisix/utils/plugin-util.lua Outdated Show resolved Hide resolved
t/plugin/multi-auth.t Outdated Show resolved Hide resolved
t/plugin/multi-auth.t Outdated Show resolved Hide resolved
t/plugin/multi-auth.t Outdated Show resolved Hide resolved
@shreemaan-abhishek
Copy link
Contributor

AFAIK with this fix all the auth-plugins are covered with multi-auth plugin.

please cover them with test cases. Thank you.

@shreemaan-abhishek
Copy link
Contributor

@madhawa-gunasekara please avoid force pushing and resolve the lint failure thanks.


local _M = {}


Copy link
Contributor

Choose a reason for hiding this comment

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

only two blanklines are needed


return table_concat(t, "; ")
end

Copy link
Contributor

Choose a reason for hiding this comment

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

one more blank line needed

docs/en/latest/plugins/multi-auth.md Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

feat: Enable hide_credentials for multi-auth plugin
2 participants