Does a GET request to "_session".
{"ok": true, "userCtx": {"name": "username", "roles": ["customrole"]}, "info": {"authentication_db": "_users", "authentication_handlers": ["oauth", "cookie", "default"], "authenticated": "cookie"}}
A user session, as created by login. When there is no session, userCtx.name is null.
Creates a new db with the name of the authentication db and executes the callback function with the db as parameter.
- Hashes the password
- Adds an empty roles array to the user_doc when not specified
- Adds an _id, composed of "org.couchdb.user:" and name, to the user_doc when not specified
- Saves the user_doc with options as parameters in the userDb
- Performs the success callback on the saved user_doc
The saved user_doc.
The user_doc is saved in the userDb.
Does a POST request to "_session" with username and password, they have to be present in the options hash. Throws a 404 error when the password is wrong or there is no user with that username stored in the userDb.
A created session with the user name and roles.
{"ok": true, "name": "username", "roles": ["customrole"]}
A signed up user, saved in an authentication db.
Does a DELETE request to "_session".
The session's user name is set to null and the custom role is removed from the roles array.
{"ok": true}