-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathcredentials.py
More file actions
37 lines (22 loc) · 829 Bytes
/
credentials.py
File metadata and controls
37 lines (22 loc) · 829 Bytes
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
"""Credentials for authentication strategies."""
from __future__ import annotations
from dataclasses import dataclass, field
class Credentials:
"""Marker base class for auth credentials."""
@dataclass(slots=True)
class UsernamePasswordCredentials(Credentials):
"""Credentials using username and password."""
username: str
password: str = field(repr=False)
@dataclass(slots=True)
class TokenCredentials(Credentials):
"""Credentials using an (API) token."""
token: str = field(repr=False)
@dataclass(slots=True)
class LocalTokenCredentials(TokenCredentials):
"""Credentials using a local API token."""
@dataclass(slots=True)
class RexelOAuthCodeCredentials(Credentials):
"""Credentials using Rexel OAuth2 authorization code."""
code: str = field(repr=False)
redirect_uri: str