diff --git a/app/util/websocket_auth_backend.py b/app/util/websocket_auth_backend.py index a3260a6..cf1146a 100644 --- a/app/util/websocket_auth_backend.py +++ b/app/util/websocket_auth_backend.py @@ -1,6 +1,5 @@ import base64 import binascii -from uuid import UUID from starlette.authentication import ( AuthCredentials, AuthenticationBackend, AuthenticationError, SimpleUser ) @@ -23,13 +22,9 @@ class BasicAuthBackend(AuthenticationBackend): raise AuthenticationError('Invalid basic auth credentials') username, _, password = decoded.partition(":") - try: - id = UUID(username) - except (ValueError) as exc: - raise AuthenticationError('Invalid basic auth credentials') with SessionLocal() as db: - chargepoint = db.query(ChargePoint).filter(ChargePoint.id == id).first() + chargepoint = db.query(ChargePoint).filter(ChargePoint.friendly_name == username).first() if chargepoint is None: raise AuthenticationError('Invalid basic auth credentials') if chargepoint.password != password: