|
1 | 1 | import datetime |
2 | 2 | import secrets |
| 3 | +from abc import ABC, abstractmethod |
3 | 4 | from typing import Any |
4 | 5 | from urllib.parse import urlencode |
5 | 6 |
|
@@ -48,7 +49,7 @@ def __str__(self) -> str: |
48 | 49 | return str(self.provider_id) |
49 | 50 |
|
50 | 51 |
|
51 | | -class OAuthProvider: |
| 52 | +class OAuthProvider(ABC): |
52 | 53 | authorization_url = "" |
53 | 54 |
|
54 | 55 | def __init__( |
@@ -76,14 +77,14 @@ def get_authorization_url_params(self, *, request: Request) -> dict: |
76 | 77 | "response_type": "code", |
77 | 78 | } |
78 | 79 |
|
79 | | - def refresh_oauth_token(self, *, oauth_token: OAuthToken) -> OAuthToken: |
80 | | - raise NotImplementedError() |
| 80 | + @abstractmethod |
| 81 | + def refresh_oauth_token(self, *, oauth_token: OAuthToken) -> OAuthToken: ... |
81 | 82 |
|
82 | | - def get_oauth_token(self, *, code: str, request: Request) -> OAuthToken: |
83 | | - raise NotImplementedError() |
| 83 | + @abstractmethod |
| 84 | + def get_oauth_token(self, *, code: str, request: Request) -> OAuthToken: ... |
84 | 85 |
|
85 | | - def get_oauth_user(self, *, oauth_token: OAuthToken) -> OAuthUser: |
86 | | - raise NotImplementedError() |
| 86 | + @abstractmethod |
| 87 | + def get_oauth_user(self, *, oauth_token: OAuthToken) -> OAuthUser: ... |
87 | 88 |
|
88 | 89 | def get_authorization_url(self, *, request: Request) -> str: |
89 | 90 | return self.authorization_url |
|
0 commit comments