From: Christopher Date: Fri, 21 Feb 2020 01:34:16 +0000 (-0600) Subject: adds bondy config and readme about running bondy locally X-Git-Url: http://git.entropealabs.com/?a=commitdiff_plain;h=d4ed0b3a661fbdb54e6f55f50a554e55466f97ce;p=wampex.git adds bondy config and readme about running bondy locally --- diff --git a/.gitignore b/.gitignore index 9f7b236..4502da9 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,11 @@ # 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 diff --git a/README.md b/README.md index 85cc031..fa23225 100644 --- 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 index 0000000..79ed8ca --- /dev/null +++ b/bondy_config/bondy.conf @@ -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 index 0000000..1e148fd --- /dev/null +++ b/bondy_config/security_config.json @@ -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" + } + ] + } +]