Mongogrant is a utility to grant username and password credentials for read and readWrite roles on various databases on various hosts to owners of email addresses.
A server administrator has fine-grained control via allow/deny rules for granting tokens and credentials. People request an email that contains a one-time link. That link gives a user a fetch token. All tokens expire and expiration time is customizable. People then use the mongogrant client to make requests like
from mongogrant.client import Client
# config file on disk has tokens and host/db aliases
# `Client()` with no args looks to
# ~/.mongogrant.json for config
client = Client()
# pymongo.database.Database with read role
source_db = client.db("ro:dev/core")
# readWrite role. config stores "staging" host alias
# and "core" db alias
target_db = client.db("rw:staging/core")
# ...Do database stuff!
You can run a "server" on your laptop in a Jupyer notebook and manage allow/deny rules, grant / revoke grants of credentials, etc. A small Flask app (untested so far) is included as an example for deploying a server to which clients can connect to obtain tokens and credentials.
Set up a server
from mongogrant.config import Config
from mongogrant.server import Server, check, path, seed, Mailgun
server = Server(Config(check=check, path=path, seed=seed()))
server.set_mgdb("mongodb://mgserver:mgserverpass@my.host.com/mongogrant")
server.set_mailer(Mailgun, dict(
api_key="YOUR_KEY",
base_url="https://api.mailgun.net/v3/YOUR_DOMAIN",
from_addr="mongogrant@YOUR_DOMAIN"))
server.set_admin_client(
host="other1.host.com",
username="mongoadmin",
password="mongoadminpass")
server.set_admin_client(
host="other2.host.com",
username="mongoadmin",
password="mongoadminpass")
Metadata
Release files for mongogrant 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mongogrant-0.1.3.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mongogrant-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.1 kB
Release files / mongogrant-0.1.3.tar.gz
| Download URL | mongogrant-0.1.3.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a6134ab1888bc0f5503cf9ba9b1846ddbabbc89050c8818e588878e9a108794
|
|
BLAKE2b-256 checksum How to use checksums |
c8cdbc1fb82a544fb423b86ae68fd5c1845c75fdbb894efd6b88f3a1c5e63570
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / mongogrant-0.1.3-py3-none-any.whl
| Download URL | mongogrant-0.1.3-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9db8987b3918c87af58e0537702e11618012515bcf757d1974cb5eb6ad68c2d4
|
|
BLAKE2b-256 checksum How to use checksums |
e81d9b5ac3273b4a398c3aa0b6298282f82e3c818a11b3a7aaf6b949a60c903b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |