Implement transaction handling
This commit is contained in:
parent
161c6aa027
commit
a65dee8962
16 changed files with 331 additions and 94 deletions
|
@ -1,7 +1,7 @@
|
|||
import base64
|
||||
import binascii
|
||||
from starlette.authentication import (
|
||||
AuthCredentials, AuthenticationBackend, AuthenticationError, SimpleUser
|
||||
AuthCredentials, AuthenticationBackend, AuthenticationError
|
||||
)
|
||||
|
||||
from app.database import SessionLocal
|
||||
|
@ -24,7 +24,7 @@ class BasicAuthBackend(AuthenticationBackend):
|
|||
username, _, password = decoded.partition(":")
|
||||
|
||||
with SessionLocal() as db:
|
||||
chargepoint = db.query(ChargePoint).filter(ChargePoint.friendly_name == username).first()
|
||||
chargepoint = db.query(ChargePoint).filter(ChargePoint.identity == username).first()
|
||||
if chargepoint is None:
|
||||
raise AuthenticationError('Invalid basic auth credentials')
|
||||
if chargepoint.password != password:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue