27leaves / thruway-minimal-example

0 stars 0 forks source link

config.JSON example #1

Open raires opened 6 years ago

raires commented 6 years ago

Hi, I'm trying to change my config.JSON to work with ticket instead wampcra wss://release.flatout-technologies.com/router/ can you post the code that you had used on this GIT? Thank you

27leaves commented 6 years ago

I'm not sure what you're trying to do. Do you mean on the server or client?

27leaves commented 6 years ago

For the client, on https://github.com/voryx/thruway.js/issues/10, davidwdan explains how to authenticate by ticket.

raires commented 6 years ago

Let me try to explain what is the idea... I want to connect/sign in using my own database to store the users, but I need to connect to crossbar somehow... now I'm using wampcra (static) and that's working fine, but, I can't manipulate users there on the config.json file i.e.: "auth": { "wampcra": { "type": "static", "users": { "joe": { "secret": "userPass", "role": "frontend", "iterations": 1000, "keylen": 20 } } } } //------------------- My understanding is: if I loging into my system using something similar to this example: https://github.com/ngrx/platform/tree/master/example-app and create my user storage on my database, access the crossbar using ticket (dynamic) is the best way! right?

raires commented 6 years ago

this is the maximum that I get... cannot authenticate using any of the offered authmethods [u'ticket']

thePunIssuer commented 6 years ago

You would need a "management"-client that connects and registers an authentication function:

function authenticator(args) {
  var realm = args[0], user = args[1], authData = args[2];
  var ticket = authData.ticket;
  // check if the ticket belongs to the user
  return {
    role: <role the user belongs to>
  };
}

session.register("system.authenticator", authenticator); //AutobahnJs API

To make crossbar use the given authentication function, you'd configure:

"auth": {
  "ticket": {
    "type":"dynamic",
    "authenticator":"system.authenticator"
  }
}

Unless that client is written in python, it needs a separate way to connect. In our case we configured crossbar to open a second, localhost-only socket for that.