6
6
import urllib .parse
7
7
import warnings
8
8
from dataclasses import dataclass
9
- from typing import TYPE_CHECKING , Dict , List , Optional , Tuple , Union
9
+ from typing import TYPE_CHECKING , Dict , List , Literal , Optional , Tuple , Union
10
10
11
11
from . import constants
12
12
from .hf_api import whoami
@@ -39,10 +39,8 @@ class OAuthOrgInfo:
39
39
Whether the org has a payment method set up. Hugging Face field.
40
40
role_in_org (`Optional[str]`, *optional*):
41
41
The user's role in the org. Hugging Face field.
42
- pending_sso (`Optional[bool]`, *optional*):
43
- Indicates if the user granted the OAuth app access to the org but didn't complete SSO. Hugging Face field.
44
- missing_mfa (`Optional[bool]`, *optional*):
45
- Indicates if the user granted the OAuth app access to the org but didn't complete MFA. Hugging Face field.
42
+ security_restrictions (`Optional[List[Literal["ip", "token-policy", "mfa", "sso"]]]`, *optional*):
43
+ Array of security restrictions that the user hasn't completed for this org. Possible values: "ip", "token-policy", "mfa", "sso". Hugging Face field.
46
44
"""
47
45
48
46
sub : str
@@ -52,8 +50,7 @@ class OAuthOrgInfo:
52
50
is_enterprise : bool
53
51
can_pay : Optional [bool ] = None
54
52
role_in_org : Optional [str ] = None
55
- pending_sso : Optional [bool ] = None
56
- missing_mfa : Optional [bool ] = None
53
+ security_restrictions : Optional [List [Literal ["ip" , "token-policy" , "mfa" , "sso" ]]] = None
57
54
58
55
59
56
@dataclass
@@ -221,8 +218,7 @@ def parse_huggingface_oauth(request: "fastapi.Request") -> Optional[OAuthInfo]:
221
218
is_enterprise = org .get ("isEnterprise" ),
222
219
can_pay = org .get ("canPay" ),
223
220
role_in_org = org .get ("roleInOrg" ),
224
- pending_sso = org .get ("pendingSSO" ),
225
- missing_mfa = org .get ("missingMFA" ),
221
+ security_restrictions = org .get ("securityRestrictions" ),
226
222
)
227
223
for org in orgs_data
228
224
]
0 commit comments