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

KAFKA-8760; New Java Authorizer API (KIP-504) #7268

Merged
merged 3 commits into from Sep 2, 2019

Conversation

rajinisivaram
Copy link
Contributor

New Java Authorizer API and a new out-of-the-box authorizer that implements the new interface.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

def authorizeTopicDescribe(partition: TopicPartition) =
authorize(request.session, Describe, Resource(Topic, partition.topic, LITERAL))
def partitionAuthorized[T](elements: List[T], topic: T => String): (Seq[T], Seq[T]) = {
val authorizedTopics = filterAuthorized(request, DESCRIBE, TOPIC, elements.toList.map(topic))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: elements.toList.map(topic) => elements.map(topic)


@Test
def testNoAclFound(): Unit = {
assertFalse("when acls = [], authorizer should deny op.",authorize(aclAuthorizer, requestContext, READ, resource))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: missing space between arguments

val ZkUrlProp = AclAuthorizer.ZkUrlProp
val ZkConnectionTimeOutProp = AclAuthorizer.ZkConnectionTimeOutProp
val ZkSessionTimeOutProp = AclAuthorizer.ZkSessionTimeOutProp
val ZkMaxInFlightRequests = AclAuthorizer.ZkSessionTimeOutProp
Copy link
Contributor

Choose a reason for hiding this comment

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

AclAuthorizer.ZkSessionTimeOutProp => AclAuthorizer.ZkMaxInFlightRequests

}

@Test(expected = classOf[IllegalArgumentException])
def testAuthorizeThrowsOnNoneLiteralResource(): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: testAuthorizeThrowsOnNoneLiteralResource => testAuthorizeThrowsOnNonLiteralResource

@rajinisivaram
Copy link
Contributor Author

@omkreddy Thanks for the review, updated the PR.

@omkreddy
Copy link
Contributor

omkreddy commented Sep 2, 2019

@rajinisivaram Thanks for the PR. LGTM.

@rajinisivaram
Copy link
Contributor Author

@omkreddy Thanks for the review, merging to trunk.

@rajinisivaram rajinisivaram merged commit 3647948 into apache:trunk Sep 2, 2019
* Returns any exception during create. If exception is null, the request has succeeded.
*/
public ApiException exception() {
return exception;
Copy link
Contributor

Choose a reason for hiding this comment

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

Did we consider using Optional here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, opened another PR for this: #7294


private final ApiException exception;

public AclCreateResult() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be private given SUCCESS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants