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

Adjusting SqlStatementResource and SqlTaskResource to set request attribute via a new method. #14878

Merged
merged 3 commits into from
Aug 26, 2023

Conversation

cryptoe
Copy link
Contributor

@cryptoe cryptoe commented Aug 20, 2023

Adjusting SqlStatementResource and SqlTaskResource to set request attribute via a new method in AuthUtils which sets the request attribute since we donot have any Resources to validate against.

Please note that this PR is a code readability change and does not effect the functionality of both these API's.
This was one of the feedback for : #14416

Copy link
Contributor

@LakshSingla LakshSingla left a comment

Choose a reason for hiding this comment

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

Few nits, PR looks good

return;
}
if (request.getAttribute(AuthConfig.DRUID_AUTHORIZATION_CHECKED) != null) {
throw new ISE("Request already had authorization check.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
throw new ISE("Request already had authorization check.");
throw DruidException.defensive("Request already had authorization check.");

public static void setRequestAuthorizationAttributeIfNeeded(final HttpServletRequest request)
{
if (request.getAttribute(AuthConfig.DRUID_ALLOW_UNSECURED_PATH) != null) {
// do nothing
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems shallow, can you please expand on this or remove the comment?

Copy link
Contributor

@LakshSingla LakshSingla left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! 🚀

@LakshSingla LakshSingla merged commit 9fcbf05 into apache:master Aug 26, 2023
74 checks passed
@LakshSingla LakshSingla added this to the 28.0 milestone Oct 12, 2023
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.

2 participants