]> Entropealabs - wampex_router.git/commitdiff
adds bondy config and readme about running bondy locally
authorChristopher <chris@entropealabs.com>
Fri, 21 Feb 2020 01:34:16 +0000 (19:34 -0600)
committerChristopher <chris@entropealabs.com>
Fri, 21 Feb 2020 01:34:16 +0000 (19:34 -0600)
.gitignore
README.md
bondy_config/bondy.conf [new file with mode: 0644]
bondy_config/security_config.json [new file with mode: 0644]

index 9f7b2369465be5cf88a3d3ae4f5fee64d8c060d1..4502da9b2f5a7afcd67a1323d1908c10b5f62667 100644 (file)
 # Ignore .fetch files in case you like to edit your project deps locally.
 /.fetch
 
+bondy_config/*
+
+!bondy_config/bondy.conf
+!bondy_config/security_config.json
+
 # If the VM crashes, it generates a dump, let's ignore it too.
 erl_crash.dump
 
index 85cc0317724ea0923388967cb774151dcc60eb95..fa232255f0655286b7ca89cebb72aef5e3b9790a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -179,3 +179,37 @@ The Session management is handled by a state machine, written using [StatesLangu
 ```
 
 You can copy and paste this snippet into the JSON input at https://citybaseinc.github.io/states-language-editor/ to edit and visualize the state machine.
+
+## Local Development
+
+You'll need compliant WAMP Router to run the tests, and do development in general. I recommend the [Bondy Router](https://gitlab.com/leapsight/bondy), it's written in Erlang.
+
+There's a Docker image available, so we'll use that to get up and running quickly.
+
+Make sure you are in the `WAMPex` directory before running this command.
+
+```bash
+docker run \
+    -p 18080:18080 \
+    -p 18081:18081 \
+    -p 18082:18082 \
+    -p 18086:18086 \
+    -v $PWD/bondy_config:/bondy/etc \
+    -d leapsight/bondy:0.8.8-slim
+```
+
+This will setup a default realm `com.myrealm`.
+
+This config allows anonymous users as well as authenticated ones. In reality you wouldn't want to enable both, but for testing, it's useful.
+
+Now we need to add our user for testing authentication.
+
+```bash
+curl -X "POST" "http://localhost:18081/realms/com.myrealm/users" \
+     -H 'Content-Type: application/json; charset=utf-8' \
+     -H 'Accept: application/json; charset=utf-8' \
+     -d $'{
+  "username": "entone",
+  "password": "test1234"
+}'
+```
diff --git a/bondy_config/bondy.conf b/bondy_config/bondy.conf
new file mode 100644 (file)
index 0000000..79ed8ca
--- /dev/null
@@ -0,0 +1,7 @@
+distributed_cookie = bondy
+nodename = bondy@127.0.0.1
+aae.data_exchange_timeout = 1m
+aae.enabled = on
+security.allow_anonymous_user = on
+security.automatically_create_realms = off
+security.config_file = $(platform_etc_dir)/security_config.json
diff --git a/bondy_config/security_config.json b/bondy_config/security_config.json
new file mode 100644 (file)
index 0000000..1e148fd
--- /dev/null
@@ -0,0 +1,36 @@
+[
+  {
+    "uri": "com.myrealm",
+    "description": "A test realm",
+    "authmethods": [
+      "wampcra"
+    ],
+    "security_enabled": true,
+    "users": [],
+    "sources": [
+      {
+        "usernames": "all",
+        "authmethod": "password",
+        "cidr": "0.0.0.0/0",
+        "meta": {
+          "description": "Allows all users from any network authenticate using password credentials."
+        }
+      }
+    ],
+    "grants": [
+      {
+        "permissions": [
+          "wamp.register",
+          "wamp.unregister",
+          "wamp.subscribe",
+          "wamp.unsubscribe",
+          "wamp.call",
+          "wamp.cancel",
+          "wamp.publish"
+        ],
+        "uri": "*",
+        "roles": "all"
+      }
+    ]
+  }
+]