Skip to content

Add more log statements for authorization#13691

Closed
adarshsanjeev wants to merge 1 commit intoapache:masterfrom
adarshsanjeev:authorizer-exception-log
Closed

Add more log statements for authorization#13691
adarshsanjeev wants to merge 1 commit intoapache:masterfrom
adarshsanjeev:authorizer-exception-log

Conversation

@adarshsanjeev
Copy link
Contributor

Adds logging and for the case that an exception is thrown during authorization


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

} catch (Exception e) {
log.error(e, "Planner threw an exception during authorization");
throw new RuntimeException("Could not authorize resources for query", e);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this?

This code translates the unauthorized exception into a runtime exception, which will change the code flow. The desired flow is that we throw the unauthorized exception which is caught by a Jersey handler up the hander stack. (I seem to recall issues when I tried to intercept that error as you've done here.)

If we want to log auth errors, that would be the place. Else, in the SQL resource, we already log errors. And, the statement logs failures at the end of the query process.

As a result, this step seems unnecessary. What problem is this trying to solve?

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