Files
asyncio-mongo_tailablecursor/asyncio_mongo/auth.py
Don Brown ca538a08ce Fix reconnect, add auth on pool creation
Support pool creation from url including db, username, and password
2014-02-23 11:22:33 -08:00

17 lines
373 B
Python

import asyncio
class Authenticator:
def authenticate(self, db):
raise NotImplementedError()
class CredentialsAuthenticator():
def __init__(self, username, password):
self.username = username
self.password = password
@asyncio.coroutine
def authenticate(self, db):
yield from db.authenticate(self.username, self.password)