aboutsummaryrefslogtreecommitdiff
path: root/mu4web/user/local.py
blob: c7936d6fa00fbb386c3ed33594519a805abaa0fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
User authentication through local password store.

Currently (hard codedly) loads the file password.json from the current
path. Take care.
"""

from .. import password
from ..password import Passwords
from typing import cast
import os
from . import User

passwords: Passwords = password.Passwords(cast(os.PathLike[str], 'passwords.json'))


class LocalUser(User):
    """Authenticate user through local password file."""

    def validate(self, password: str) -> bool:  # noqa: 201
        return passwords.validate(self._username, password)