| 1 |
from __future__ import annotations |
| 2 |
|
| 3 |
from allauth.socialaccount.providers.base import ProviderAccount |
| 4 |
from allauth.socialaccount.providers.jupyterhub.views import JupyterHubOAuth2Adapter |
| 5 |
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider |
| 6 |
|
| 7 |
|
| 8 |
class JupyterHubAccount(ProviderAccount): |
| 9 |
pass |
| 10 |
|
| 11 |
|
| 12 |
class JupyterHubProvider(OAuth2Provider): |
| 13 |
id = "jupyterhub" |
| 14 |
name = "JupyterHub" |
| 15 |
account_class = JupyterHubAccount |
| 16 |
oauth2_adapter_class = JupyterHubOAuth2Adapter |
| 17 |
|
| 18 |
def extract_uid(self, data): |
| 19 |
return str(data.get("name")) |
| 20 |
|
| 21 |
def extract_common_fields(self, data): |
| 22 |
return dict(name=data.get("name", "")) |
| 23 |
|
| 24 |
|
| 25 |
provider_classes = [JupyterHubProvider] |