php - How can I set up WAMP authentication from a Thruway client to a Crossbar router? -


i'm going around in circles trying work...

here's situation:

i have php web app makes remote procedure calls (rpcs) several microservices via crossbar.io router using thruway. anonymous calls working perfectly, want add authentication.

here crossbar configuration:

{   "controller": {   },   "workers": [     {       "type": "router",       "realms": [         {           "name": "dashboard",           "roles": [             {               "name": "microservice",               "permissions": [                 {                   "uri": "*",                   "publish": true,                   "subscribe": true,                   "call": true,                   "register": true                 }               ]             }           ]         }       ],       "transports": [         {           "type": "websocket",           "endpoint": {             "type": "tcp",             "port": 80           },           "auth": {             "wampcra": {               "type": "static",               "users": {                 "client1": {                   "secret": "secret1",                   "role": "microservice"                 }               }             }           }         }       ]     }   ] } 

the crossbar server (i hope) set router only. clients/workers on other servers. i've been following this example crossbar config - specifically, this configuration file. there couple of important differences between example , config: example server configured both router , serves static web pages (which mine not) , example server includes python component (if i'm reading correctly) not material authentication process.

in development environment i'm trying authentication work 1 client. here's client code:

<?php  // include autoloader // require __dir__ . '/vendor/autoload.php';  use thruway\clientsession; use thruway\peer\client; use thruway\transport\pawltransportprovider; use thruway\authentication\clientwampcraauthenticator;  // create wamp client // $client = new client('dashboard');   $auth = new clientwampcraauthenticator("client1", "secret1"); $client->addclientauthenticator($auth);  // add wamp transport provider // $client->addtransportprovider(     new pawltransportprovider('ws://192.168.1.10/') );  // handle "open" (connect) event // $client->on('open', function (clientsession $session) {      // register getimagedata procedure     //     $session->register('service.client1.get', function ($data) {         return (new client)->get();     });  });  // start client // $client->start(); 

the problem "challenge" message never sent server. when client attempts connect, following debug message:

2015-07-07t13:58:17.7451860 debug      [thruway\transport\pawltransportprovider 204] received: [3,{"message":"no user authid 'anonymous' in user database"},"wamp.error.not_authorized"] 

can explain additional configuration need server challenge client?

i found it...

i must have overlooked in examples i've seen today. solution add $client->setauthid('client1'); before call $client->addclientauthenticator($auth);


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -