Fix reconnect, add auth on pool creation
Support pool creation from url including db, username, and password
This commit is contained in:
17
asyncio_mongo/auth.py
Normal file
17
asyncio_mongo/auth.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user