KannarFr opened a new issue #110:
URL: https://github.com/apache/pulsar-client-node/issues/110


   On 
https://github.com/apache/pulsar-client-node/blob/master/src/Authentication.cc#L52
   
   We check if authentication is supported but we should authorize plugins as 
https://github.com/CleverCloud/biscuit-pulsar,
   
   I wrote AuthenticationBiscuit class:
   
   ```
   //const PulsarBinding = require('bindings')('Pulsar');
   const PulsarBinding = 
require("./node_modules/pulsar-client/build/Release/Pulsar.node")
   
   class AuthenticationBiscuit {
     constructor(params) {
       this.binding = new PulsarBinding.Authentication('biscuit', params);
     }
   }
   
   module.exports = AuthenticationBiscuit;
   ```
   
   That I'm using this way:
   
   ```
   const Pulsar = require('pulsar-client');
   
   const AuthenticationBiscuit = require('./AuthenticationBiscuit');
   
   (async () => {
     const auth = new AuthenticationBiscuit("<BISCUIT>");
   
     // Create a client
     const client = new Pulsar.Client({
       serviceUrl: '<URL>'
       authentication: auth,
     });
   
     // Create a producer
     const producer = await client.createProducer({
       topic: 'persistent://...',
     });
   ```
   
   But got the following error:
   
   ```
   kannar@pond ~/git/cc/pulsar-node-test % node test.js                         
                                                                                
                                                                                
 [130][17:15:30 - 10/08/2020]
   (node:17030) UnhandledPromiseRejectionWarning: Error: Unsupported 
authentication method
       at new AuthenticationBiscuit 
(/home/kannar/git/cc/pulsar-node-test/AuthenticationBiscuit.js:6:20)
       at /home/kannar/git/cc/pulsar-node-test/test.js:6:16
       at Object.<anonymous> (/home/kannar/git/cc/pulsar-node-test/test.js:31:3)
       at Module._compile (internal/modules/cjs/loader.js:1236:30)
       at Object.Module._extensions..js (internal/modules/cjs/loader.js:1257:10)
       at Module.load (internal/modules/cjs/loader.js:1085:32)
       at Function.Module._load (internal/modules/cjs/loader.js:950:14)
       at Function.executeUserEntryPoint [as runMain] 
(internal/modules/run_main.js:60:12)
       at internal/main/run_main_module.js:17:47
   (Use `node --trace-warnings ...` to show where the warning was created)
   (node:17030) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 
This error originated either by throwing inside of an async function without a 
catch block, or by rejecting a promise which was not handled with .catch(). To 
terminate the node process on unhandled promise rejection, use the CLI flag 
`--unhandled-rejections=strict` (see 
https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 
1)
   (node:17030) [DEP0018] DeprecationWarning: Unhandled promise rejections are 
deprecated. In the future, promise rejections that are not handled will 
terminate the Node.js process with a non-zero exit code.
   ```
   
   Can we drop the checks to authorize auth/authz plugins as biscuit?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to