Comments (6)
Hi @Jopie01 you are correct.
The issue is that not all Admin WAMP Procedures are exposed via the Admin HTTP API right now.
Just to check, for a user in your realm to be able to authenticate using a particular methods you need:
- The realm to have the method listed in its
authmethods
property - The realm to have a sources rule where
usernames
is the stringall
or is a list of usernames which includes the user.
We are currently working on implementing and documenting all the HTTP API (I added Issue #21 to track this activity ).
In the meantime, you can operate on your Realm's sources using the WAMP API, please check the docs for bondy.source.add
.
You could use Wick as you use CURL to call that procedure 😄 .
For example to allow myusername
to authenticate into com.myrealm
using password
when connecting from any network you would use.
./wick --url ws://localhost:18081/ws \
--realm com.leapsight.bondy \
call bondy.source.add \
"com.myrealm" \
'{
"usernames":["myusername"],
"authmethod":"password",
"cidr":"0.0.0.0/0"
}' | jq
from bondy.
@Jopie01 there is another option via HTTP.
You can use the (undocumented) /services/call
HTTP API
curl -X "POST" "http://localhost:18081/services/call" \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Accept: application/json; charset=utf-8' \
-d $'{
"procedure": "bondy.source.add",
"arguments": [
"com.myrealm",
{
"usernames":["myusername"],
"authmethod":"password",
"cidr":"0.0.0.0/0"
}
],
"options": {},
"arguments_kw": {}
}'
from bondy.
@aramallo Thanks for the answer. I have already a running instance of Bondy with two users, but these are configured in the security_config.json
and that works well. But now I want to add a third user which I want to add through the api.
When I execute
curl -X "POST" "http://localhost:18081/services/call" \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Accept: application/json; charset=utf-8' \
-d $'{
"procedure": "bondy.source.add",
"arguments": [
"com.example.realm",
{
"usernames":["client1", "client2", "client3"],
"authmethod":"cryptosign",
"cidr":"0.0.0.0/0"
}
],
"options": {},
"arguments_kw": {}
}'
I get this error back:
{
"code": "bondy.error.http_gateway.invalid_expression",
"description": "This might be due to an error in the action expression (mops) itself or as a result of a key missing in the response to a gateway action (WAMP or HTTP call).",
"message": "There is no value for path 'requestbodyargs' in the HTTP Request context."
}
Just to mention that I want to add "client3" as the new user. The other two users are already there. I don't know if it is enough to only send the new user and that Bondy will take care to add the new user to the already existing list of usernames.
from bondy.
Arggg. Sorry @Jopie01 my bad, I was using an old snippet.
Can you try with the following?
curl -X "POST" "http://localhost:18081/services/call" \
-H 'Content-Type: application/json; charset=utf-8' \
-H 'Accept: application/json; charset=utf-8' \
-d $'{
"procedure": "bondy.source.add",
"options": {},
"args": [
"com.example.realm",
{
"usernames":["client1", "client2", "client3"],
"authmethod":"cryptosign",
"cidr":"0.0.0.0/0"
}
],
"kwargs": {}
}'
args
instead of arguments
and kwargs
instead of arguments_kw
.
from bondy.
Re your question
The other two users are already there. I don't know if it is enough to only send the new user and that Bondy will take care to add the new user to the already existing list of usernames.
Yes, you could just send the request with "usernames": ["client3"]
, as internally this will create a separate record per user (the other two users are already there)
from bondy.
@aramallo, thanks for the answers. Everything now works perfectly! Also the Wick one works.
from bondy.
Related Issues (11)
- Test integration w/JIRA
- [1.0.0-beta.68] OAuth2 - client_credentials should not return refresh token? HOT 1
- Expose all the Bondy Admin WAMP API Procedures via HTTP HOT 6
- Implement the Grant (permissions) WAMP API
- Replace and test `bondy_peer_discovery_agent` with the new `partisan_peer_discovery_agent`
- User update APIs wrongly assume a credential has changed
- Cannot enable or disable users in realm HOT 3
- Cannot run Bondy after tag 1.0.0-beta.20 HOT 4
- [beta.30] login with wamp and password crashes the process. HOT 6
- Error when running docker command HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bondy.