Skip to content

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

Merged
LakshSingla merged 3 commits intoapache:masterfrom
cryptoe:refactoring_auth_utils
Aug 26, 2023
Merged

Adjusting SqlStatementResource and SqlTaskResource to set request attribute via a new method.#14878
LakshSingla merged 3 commits intoapache:masterfrom
cryptoe:refactoring_auth_utils

Conversation

@cryptoe
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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