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

How to skip or authorize not authorized to access topics #208

Closed
MichaelDz6 opened this issue Nov 4, 2020 · 4 comments · Fixed by #341
Closed

How to skip or authorize not authorized to access topics #208

MichaelDz6 opened this issue Nov 4, 2020 · 4 comments · Fixed by #341
Labels

Comments

@MichaelDz6
Copy link

When I'm requesting all topics by going to localhost:9000/ I'm getting this exception:


[errorAtts: {timestamp=Wed Nov 04 22:11:27 CET 2020, status=500, error=Internal Server Error, message=Request processing failed; nested exception is kafdrop.service.KafkaAdminClientException: java.util.concurrent.ExecutionException:

 

org.apache.kafka.common.errors.TopicAuthorizationException: Not authorized to access topics: [Topic authorization failed.], trace=kafdrop.service.KafkaAdminClientException: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TopicAuthorizationException: Not authorized to access topics: [Topic authorization failed.]

                at kafdrop.service.KafkaHighLevelAdminClient.describeTopicConfigs(KafkaHighLevelAdminClient.java:114)

                at kafdrop.service.KafkaMonitorImpl.getTopicMetadata(KafkaMonitorImpl.java:121)

                at kafdrop.service.KafkaMonitorImpl.getTopics(KafkaMonitorImpl.java:102)

                at kafdrop.controller.BrokerController.brokerDetails(BrokerController.java:43)

                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

                at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                at java.base/java.lang.reflect.Method.invoke(Method.java:566)

                at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)

                at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)

                at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)

                at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892)

                at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)

                at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)

                at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039)

                at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)

                at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)

                at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)](url)

Does that mean that I have to authenticate in order to access some of topics? How can I do it?

It's possible that I might not get access to those topics, in that case would it be possible to just skip unauthorised topics? Can someone indicate where in the code I would need to make changes?

@eswardpm
Copy link

for scenarios like this, I usually build the project locally by modifying KafkaHighLevelAdminClient.describeTopicConfigs method to include only the topics that's needed.

final var resources = topicNames.stream()
.filter(name -> name.contains("your_topic"))
.map(topic -> new ConfigResource(Type.TOPIC, topic))
.collect(Collectors.toList());

@jorkzijlstra
Copy link
Contributor

jorkzijlstra commented May 17, 2021

What is actually the reason to throw the TopicAuthorizationException exception?

Simply changing this line https://github.com/obsidiandynamics/kafdrop/blob/master/src/main/java/kafdrop/service/KafkaHighLevelAdminClient.java#L112 and have it also return a Map.of() makes it skip the topic and load the page.

@github-actions
Copy link

github-actions bot commented Jan 7, 2022

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jan 7, 2022
@github-actions
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

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

Successfully merging a pull request may close this issue.

4 participants