Skip to content
Will Trimble edited this page Sep 9, 2019 · 4 revisions

OAuth

TODO: add documentation

Basic access authentication

While not recommended for production, basic auth can be useful for testing and development. Users are stored with their username and password in the mongo database.

Enable with basic auth using:

shock-server --basic=true --users=admin

Users listed under --users are only users with admin rights !

Add normal user to database:

docker exec -ti test_shock-mongo_1 mongo

use ShockDB;
db.Users.insert({ username: "user1", password: "secret"}) 
db.Users.findOne()

or update password
db.Users.findOne({ username: "user1"})
db.Users.update({ username: "user1"}, { $set : {password: "newsecret" }}) 

For each user create base64-encoded credentials that can be used to access Shock.

echo -n 'user1:secret' | base64
curl -H 'Authorization: basic dXNlcjE6c2VjcmV0'  <shock-api>/node...

Clone this wiki locally