-
-
Notifications
You must be signed in to change notification settings - Fork 173
/
Copy pathreject.py
48 lines (34 loc) · 1.32 KB
/
reject.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# This file is part of Xpra.
# Copyright (C) 2014 Antoine Martin <[email protected]>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.
from collections.abc import Sequence
from xpra.auth.common import SessionData
from xpra.net.digest import get_salt, choose_digest
from xpra.util.objects import typedict
class Authenticator:
def __init__(self, **kwargs):
self.challenge_sent = False
self.prompt: str = kwargs.pop("prompt", "password")
self.passed: bool = False
def requires_challenge(self) -> bool:
return True
def get_challenge(self, digests: Sequence[str]) -> tuple[bytes, str]:
self.challenge_sent = True
return get_salt(), choose_digest(digests)
def choose_salt_digest(self, digest_modes: Sequence[str]) -> str:
return choose_digest(digest_modes)
def get_uid(self) -> int:
return -1
def get_gid(self) -> int:
return -1
def get_passwords(self) -> Sequence[str]:
return ()
def get_password(self) -> str:
return ""
def authenticate(self, _caps: typedict) -> bool: # pylint: disable=unused-argument
return False
def get_sessions(self) -> SessionData | None:
return None
def __repr__(self):
return "reject"