Skip to content

Commit e80d8bc

Browse files
committed
fix limit issues
1 parent 3730092 commit e80d8bc

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/clerk_backend_api/security/authenticaterequest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from http.cookies import SimpleCookie
22
from typing import Any, Dict, List, Optional
3-
from warnings import warn
43

54
from .machine import is_machine_token, get_token_type
65
from .types import Requestish, AuthenticateRequestOptions, RequestState, AuthStatus, AuthErrorReason

src/clerk_backend_api/security/types.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from enum import Enum
44
from typing import Any, Dict, List, Union, Optional, Protocol, Mapping
55

6-
76
class TokenVerificationErrorReason(Enum):
87

98
JWK_FAILED_TO_LOAD = (
@@ -236,7 +235,7 @@ def message(self) -> Optional[str]:
236235
return self.reason.value[1]
237236

238237
def to_auth(self) -> AuthObject:
239-
from clerk_backend_api.security.machine import get_token_type
238+
from clerk_backend_api.security.machine import get_token_type #pylint: disable=C0415
240239
if self.status == AuthStatus.SIGNED_IN:
241240
if self.payload is None:
242241
raise ValueError("Payload must be provided for authenticated states.")
@@ -267,30 +266,30 @@ def to_auth(self) -> AuthObject:
267266
factor_verification_age=self.payload.get('fva'),
268267
claims=self.payload,
269268
)
270-
elif token_type == TokenType.OAUTH_TOKEN:
269+
270+
if token_type == TokenType.OAUTH_TOKEN:
271271
return OAuthMachineAuthObject(id=self.payload.get('id'),
272272
user_id=self.payload.get('subject'),
273273
client_id=self.payload.get('client_id'),
274274
name=self.payload.get('name'),
275275
scopes=self.payload.get('scopes'))
276-
elif token_type == TokenType.API_KEY:
276+
if token_type == TokenType.API_KEY:
277277
return APIKeyMachineAuthObject(id=self.payload.get('id'),
278278
user_id=self.payload.get('subject'),
279279
org_id=self.payload.get('org_id'),
280280
name=self.payload.get('name'),
281281
scopes=self.payload.get('scopes'),
282282
claims=self.payload.get('claims'))
283-
elif token_type == TokenType.MACHINE_TOKEN:
283+
if token_type == TokenType.MACHINE_TOKEN:
284284
return M2MMachineAuthObject(id=self.payload.get('id'),
285285
machine_id=self.payload.get('subject'),
286286
client_id=self.payload.get('client_id'),
287287
name=self.payload.get('name'),
288288
scopes=self.payload.get('scopes'),
289289
claims=self.payload.get('claims'))
290290

291-
else:
292-
raise ValueError(f"Unsupported token type: {self.token_type}")
293-
else :
291+
raise ValueError(f"Unsupported token type: {token_type}")
292+
else:
294293
raise ValueError("Cannot convert to AuthObject in unauthenticated state.")
295294

296295

0 commit comments

Comments
 (0)