Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

Adding authorization capabilities to Dr. Kafka to restrict privileged operations #143

Merged
merged 1 commit into from
May 21, 2019

Conversation

ambud
Copy link
Contributor

@ambud ambud commented May 17, 2019

Summary
Dr. Kafka now has some privileged operations exposed via API like broker decomissioning and maintenance mode. These operations should be restricted to admin users only. This PR allows a configurable authorization provider to be added to Dr. Kafka to limit this access.

Description

  • Access is restricted to dr_kafka_admin role
  • Restrictions can be applied using standard JAX-RS annotations
  • Authorization Filter is responsible to map group to role
  • Pluggable authorization filters can be implemented by implementing com.pinterest.doctorkafka.security.DrKafkaAuthorizationFilter
  • Sample implementation is provided via com.pinterest.doctorkafka.security.ExampleAuthorizationFilter

*/
@Provider
@Priority(1000)
public class ExampleAuthorizationFilter implements DrKafkaAuthorizationFilter {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this class be used by the users by default? if that is the cause, shall we call it DefaultAuthorizationFilter?

Copy link
Contributor Author

@ambud ambud May 20, 2019

Choose a reason for hiding this comment

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

It can't be used by default since it follows certain conventions, anyone attempting to enable authorization restrictions in Dr. Kafka needs to implement their own AuthorizationFilter since every environment is different as AuthorizationFilter's functionality is dependent on the Authentication mechanism used which varies based on environment and implementation (e.g. basic auth, kerberos, oauth etc.)
The purpose of providing this class is to share with users how they can potentially implement their own AuthorizationFilter.

This PR doesn't change the default behavior of Dr. Kafka which is currently is no authorization restriction.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain the " certain conventions" in details in the comments, and how the users are configured? That will help the users to understand more about the sample authorization filter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

*/
@Provider
@Priority(1000)
public class ExampleAuthorizationFilter implements DrKafkaAuthorizationFilter {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain the " certain conventions" in details in the comments, and how the users are configured? That will help the users to understand more about the sample authorization filter.

docs/APIs.md Outdated Show resolved Hide resolved
docs/APIs.md Outdated Show resolved Hide resolved
@yuyang08
Copy link
Contributor

Thanks for making the change!

@yuyang08 yuyang08 merged commit e8af094 into pinterest:master May 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants