apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.23k stars 3.58k forks source link

What is the development process of the client authentication plug-in? #11746

Open beyondyinjl2 opened 3 years ago

beyondyinjl2 commented 3 years ago

update standalone.conf authenticationEnabled=true authenticationProviders=com.talkweb.iot.test.VVAuthenticationProvider brokerClientAuthenticationPlugin=com.talkweb.iot.test.VVAuthentication

VVAuthentication implements Authentication VVAuthenticationProvider implements AuthenticationProvider

Put the jar package into the pulsar home lib directory

Start up bin/pulsar standalone java.util.concurrent.CompletionException: org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292) ~[?:1.8.0_171] at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308) ~[?:1.8.0_171] at java.util.concurrent.CompletableFuture.uniRun(CompletableFuture.java:700) ~[?:1.8.0_171] at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:687) ~[?:1.8.0_171] at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) [?:1.8.0_171] at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977) [?:1.8.0_171] at org.apache.pulsar.client.impl.ClientCnx.handleError(ClientCnx.java:686) [org.apache.pulsar-pulsar-client-original-2.8.0.jar:2.8.0] at org.apache.pulsar.common.protocol.PulsarDecoder.channelRead(PulsarDecoder.java:176) [org.apache.pulsar-pulsar-common-2.8.0.jar:2.8.0] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) [io.netty-netty-codec-4.1.63.Final.jar:4.1.63.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) [io.netty-netty-codec-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) [io.netty-netty-transport-4.1.63.Final.jar:4.1.63.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [io.netty-netty-common-4.1.63.Final.jar:4.1.63.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [io.netty-netty-common-4.1.63.Final.jar:4.1.63.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-common-4.1.63.Final.jar:4.1.63.Final] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171] Caused by: org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate ... 23 more 16:04:08.597 [pulsar-client-io-79-1] ERROR org.apache.pulsar.client.impl.ClientCnx - [id: 0xd00d1e2e, L:/127.0.0.1:52559 ! R:localhost/127.0.0.1:6650] Failed to authenticate the client 16:04:08.597 [pulsar-client-io-79-1] WARN org.apache.pulsar.client.impl.ClientCnx - [id: 0xd00d1e2e, L:/127.0.0.1:52559 ! R:localhost/127.0.0.1:6650] Received unknown request id from server: -1 16:04:08.597 [main] ERROR org.apache.pulsar.functions.worker.PulsarWorkerService - Error Starting up in worker org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate at org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:965) ~[org.apache.pulsar-pulsar-client-api-2.8.0.jar:2.8.0] at org.apache.pulsar.client.impl.ConsumerBuilderImpl.subscribe(ConsumerBuilderImpl.java:97) ~[org.apache.pulsar-pulsar-client-original-2.8.0.jar:2.8.0] at org.apache.pulsar.functions.worker.LeaderService.start(LeaderService.java:88) ~[org.apache.pulsar-pulsar-functions-worker-2.8.0.jar:2.8.0] at org.apache.pulsar.functions.worker.PulsarWorkerService.start(PulsarWorkerService.java:492) [org.apache.pulsar-pulsar-functions-worker-2.8.0.jar:2.8.0] at org.apache.pulsar.broker.PulsarService.startWorkerService(PulsarService.java:1490) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:793) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.PulsarStandalone.start(PulsarStandalone.java:296) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.PulsarStandaloneStarter.main(PulsarStandaloneStarter.java:121) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] 16:04:08.597 [pulsar-client-io-79-1] INFO org.apache.pulsar.client.impl.ClientCnx - [id: 0xd00d1e2e, L:/127.0.0.1:52559 ! R:localhost/127.0.0.1:6650] Disconnected 16:04:08.597 [main] ERROR org.apache.pulsar.broker.PulsarService - Failed to start Pulsar service: org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate java.lang.RuntimeException: org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate at org.apache.pulsar.functions.worker.PulsarWorkerService.start(PulsarWorkerService.java:571) ~[org.apache.pulsar-pulsar-functions-worker-2.8.0.jar:2.8.0] at org.apache.pulsar.broker.PulsarService.startWorkerService(PulsarService.java:1490) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:793) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.PulsarStandalone.start(PulsarStandalone.java:296) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.PulsarStandaloneStarter.main(PulsarStandaloneStarter.java:121) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] Caused by: org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate at org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:965) ~[org.apache.pulsar-pulsar-client-api-2.8.0.jar:2.8.0] at org.apache.pulsar.client.impl.ConsumerBuilderImpl.subscribe(ConsumerBuilderImpl.java:97) ~[org.apache.pulsar-pulsar-client-original-2.8.0.jar:2.8.0] at org.apache.pulsar.functions.worker.LeaderService.start(LeaderService.java:88) ~[org.apache.pulsar-pulsar-functions-worker-2.8.0.jar:2.8.0] at org.apache.pulsar.functions.worker.PulsarWorkerService.start(PulsarWorkerService.java:492) ~[org.apache.pulsar-pulsar-functions-worker-2.8.0.jar:2.8.0] ... 4 more 16:04:08.598 [main] ERROR org.apache.pulsar.PulsarStandaloneStarter - Failed to start pulsar service. org.apache.pulsar.broker.PulsarServerException: java.lang.RuntimeException: org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:821) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.PulsarStandalone.start(PulsarStandalone.java:296) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.PulsarStandaloneStarter.main(PulsarStandaloneStarter.java:121) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] Caused by: java.lang.RuntimeException: org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate at org.apache.pulsar.functions.worker.PulsarWorkerService.start(PulsarWorkerService.java:571) ~[org.apache.pulsar-pulsar-functions-worker-2.8.0.jar:2.8.0] at org.apache.pulsar.broker.PulsarService.startWorkerService(PulsarService.java:1490) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:793) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] ... 2 more Caused by: org.apache.pulsar.client.api.PulsarClientException$AuthenticationException: Unable to authenticate at org.apache.pulsar.client.api.PulsarClientException.unwrap(PulsarClientException.java:965) ~[org.apache.pulsar-pulsar-client-api-2.8.0.jar:2.8.0] at org.apache.pulsar.client.impl.ConsumerBuilderImpl.subscribe(ConsumerBuilderImpl.java:97) ~[org.apache.pulsar-pulsar-client-original-2.8.0.jar:2.8.0] at org.apache.pulsar.functions.worker.LeaderService.start(LeaderService.java:88) ~[org.apache.pulsar-pulsar-functions-worker-2.8.0.jar:2.8.0] at org.apache.pulsar.functions.worker.PulsarWorkerService.start(PulsarWorkerService.java:492) ~[org.apache.pulsar-pulsar-functions-worker-2.8.0.jar:2.8.0] at org.apache.pulsar.broker.PulsarService.startWorkerService(PulsarService.java:1490) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:793) ~[org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] ... 2 more 16:04:16.698 [Thread-1] INFO org.apache.pulsar.broker.service.GracefulExecutorServicesTerminationHandler - Starting termination handler for 4 executors. 16:04:16.699 [Thread-1] INFO org.apache.pulsar.broker.service.GracefulExecutorServicesTerminationHandler - Shutdown completed. 16:04:21.078 [globalEventExecutor-2-7] INFO org.apache.pulsar.broker.service.GracefulExecutorServicesTerminationHandler - Starting termination handler for 7 executors. 16:04:21.079 [globalEventExecutor-2-7] INFO org.apache.pulsar.broker.service.GracefulExecutorServicesTerminationHandler - Shutdown completed. 16:04:21.204 [Thread-1] ERROR org.apache.bookkeeper.client.MetadataUpdateLoop - UpdateLoop(ledgerId=936,loopId=50175a6e) Error writing metadata to store org.apache.bookkeeper.client.BKException$BKClientClosedException: BookKeeper client is closed at org.apache.bookkeeper.meta.CleanupLedgerManager.close(CleanupLedgerManager.java:245) ~[org.apache.bookkeeper-bookkeeper-server-4.14.1.jar:4.14.1] at org.apache.bookkeeper.client.BookKeeper.close(BookKeeper.java:1439) ~[org.apache.bookkeeper-bookkeeper-server-4.14.1.jar:4.14.1] at org.apache.distributedlog.BookKeeperClient.close(BookKeeperClient.java:273) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at org.apache.distributedlog.impl.BKNamespaceDriver.doClose(BKNamespaceDriver.java:404) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at org.apache.distributedlog.impl.BKNamespaceDriver.close(BKNamespaceDriver.java:385) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at com.google.common.io.Closeables.close(Closeables.java:78) ~[com.google.guava-guava-30.1-jre.jar:?] at org.apache.distributedlog.util.Utils.close(Utils.java:544) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at org.apache.distributedlog.BKDistributedLogNamespace.close(BKDistributedLogNamespace.java:340) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at org.apache.bookkeeper.stream.server.service.DLNamespaceProviderService.doClose(DLNamespaceProviderService.java:135) ~[org.apache.bookkeeper-stream-storage-server-4.14.1.jar:4.14.1] at org.apache.bookkeeper.common.component.AbstractLifecycleComponent.close(AbstractLifecycleComponent.java:123) ~[org.apache.bookkeeper-bookkeeper-common-4.14.1.jar:4.14.1] at org.apache.bookkeeper.common.component.LifecycleComponentStack.lambda$close$6(LifecycleComponentStack.java:154) ~[org.apache.bookkeeper-bookkeeper-common-4.14.1.jar:4.14.1] at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406) [com.google.guava-guava-30.1-jre.jar:?] at org.apache.bookkeeper.common.component.LifecycleComponentStack.close(LifecycleComponentStack.java:154) [org.apache.bookkeeper-bookkeeper-common-4.14.1.jar:4.14.1] at org.apache.bookkeeper.stream.server.StreamStorageLifecycleComponent.doClose(StreamStorageLifecycleComponent.java:60) [org.apache.bookkeeper-stream-storage-server-4.14.1.jar:4.14.1] at org.apache.bookkeeper.common.component.AbstractLifecycleComponent.close(AbstractLifecycleComponent.java:123) [org.apache.bookkeeper-bookkeeper-common-4.14.1.jar:4.14.1] at org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble.stop(LocalBookkeeperEnsemble.java:492) [org.apache.pulsar-pulsar-zookeeper-utils-2.8.0.jar:2.8.0] at org.apache.pulsar.PulsarStandaloneStarter$1.run(PulsarStandaloneStarter.java:102) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0] 16:04:21.209 [Thread-1] ERROR org.apache.bookkeeper.client.MetadataUpdateLoop - UpdateLoop(ledgerId=938,loopId=358b2563) Error writing metadata to store org.apache.bookkeeper.client.BKException$BKClientClosedException: BookKeeper client is closed at org.apache.bookkeeper.meta.CleanupLedgerManager.close(CleanupLedgerManager.java:245) ~[org.apache.bookkeeper-bookkeeper-server-4.14.1.jar:4.14.1] at org.apache.bookkeeper.client.BookKeeper.close(BookKeeper.java:1439) ~[org.apache.bookkeeper-bookkeeper-server-4.14.1.jar:4.14.1] at org.apache.distributedlog.BookKeeperClient.close(BookKeeperClient.java:273) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at org.apache.distributedlog.impl.BKNamespaceDriver.doClose(BKNamespaceDriver.java:404) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at org.apache.distributedlog.impl.BKNamespaceDriver.close(BKNamespaceDriver.java:385) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at com.google.common.io.Closeables.close(Closeables.java:78) ~[com.google.guava-guava-30.1-jre.jar:?] at org.apache.distributedlog.util.Utils.close(Utils.java:544) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at org.apache.distributedlog.BKDistributedLogNamespace.close(BKDistributedLogNamespace.java:340) ~[org.apache.distributedlog-distributedlog-core-4.14.1.jar:4.14.1] at org.apache.bookkeeper.stream.server.service.DLNamespaceProviderService.doClose(DLNamespaceProviderService.java:135) ~[org.apache.bookkeeper-stream-storage-server-4.14.1.jar:4.14.1] at org.apache.bookkeeper.common.component.AbstractLifecycleComponent.close(AbstractLifecycleComponent.java:123) ~[org.apache.bookkeeper-bookkeeper-common-4.14.1.jar:4.14.1] at org.apache.bookkeeper.common.component.LifecycleComponentStack.lambda$close$6(LifecycleComponentStack.java:154) ~[org.apache.bookkeeper-bookkeeper-common-4.14.1.jar:4.14.1] at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406) [com.google.guava-guava-30.1-jre.jar:?] at org.apache.bookkeeper.common.component.LifecycleComponentStack.close(LifecycleComponentStack.java:154) [org.apache.bookkeeper-bookkeeper-common-4.14.1.jar:4.14.1] at org.apache.bookkeeper.stream.server.StreamStorageLifecycleComponent.doClose(StreamStorageLifecycleComponent.java:60) [org.apache.bookkeeper-stream-storage-server-4.14.1.jar:4.14.1] at org.apache.bookkeeper.common.component.AbstractLifecycleComponent.close(AbstractLifecycleComponent.java:123) [org.apache.bookkeeper-bookkeeper-common-4.14.1.jar:4.14.1] at org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble.stop(LocalBookkeeperEnsemble.java:492) [org.apache.pulsar-pulsar-zookeeper-utils-2.8.0.jar:2.8.0] at org.apache.pulsar.PulsarStandaloneStarter$1.run(PulsarStandaloneStarter.java:102) [org.apache.pulsar-pulsar-broker-2.8.0.jar:2.8.0]

liangyuanpeng commented 3 years ago

You can add some log in AuthenticationProvider#initialize and AuthenticationProvider#getAuthMethodName , and you can get the log when pulsar service start if you had set authenticationEnabled=true and authenticationProviders={your provider}.

It can confirom that your prodiver is start.

codelipenghui commented 2 years ago

The issue had no activity for 30 days, mark with Stale label.