xn-auth 0.2.2.dev2__tar.gz → 0.2.2.dev3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xn-auth
3
- Version: 0.2.2.dev2
3
+ Version: 0.2.2.dev3
4
4
  Summary: Auth adapter for XN-Api framework
5
5
  Author-email: Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
@@ -1,7 +1,5 @@
1
- import logging
2
1
  from datetime import timedelta
3
2
 
4
- from fastapi import HTTPException as BaseHTTPException
5
3
  from fastapi.openapi.models import HTTPBase, SecuritySchemeType
6
4
  from fastapi.security.base import SecurityBase
7
5
  from fastapi.security.utils import get_authorization_scheme_param
@@ -13,26 +11,14 @@ from starlette.authentication import AuthenticationError
13
11
  from starlette.requests import HTTPConnection
14
12
  from starlette.responses import Response
15
13
  from tortoise.timezone import now
14
+ from x_model import HTTPException
16
15
 
17
- from x_auth.enums import FailReason, AuthFailReason
16
+ from x_auth.enums import AuthFailReason
18
17
  from x_auth.pydantic import AuthUser
19
18
 
20
19
  cookie_name = "access_token"
21
20
 
22
21
 
23
- class HTTPException(BaseHTTPException):
24
- def __init__(
25
- self,
26
- reason: FailReason | AuthFailReason,
27
- parent: Exception | str = None,
28
- status_: status = status.HTTP_400_BAD_REQUEST,
29
- hdrs: dict = None,
30
- ) -> None:
31
- detail = f"{reason.name}{f': {parent}' if parent else ''}"
32
- logging.error(detail)
33
- super().__init__(status_, detail, hdrs)
34
-
35
-
36
22
  class AuthException(HTTPException, AuthenticationError):
37
23
  def __init__(
38
24
  self,
@@ -25,14 +25,6 @@ class Role(IntEnum):
25
25
  return [scope.name for scope in Scope if self.value & scope.value]
26
26
 
27
27
 
28
- class FailReason(IntEnum):
29
- path = 8
30
- query = 9
31
- body = 10
32
- method = 11
33
- protocol = 12
34
-
35
-
36
28
  class AuthFailReason(IntEnum):
37
29
  no_token = 0
38
30
  username = 1
@@ -1,6 +1,6 @@
1
1
  from tortoise import fields
2
2
  from x_auth.pydantic import AuthUser
3
- from x_model.model import Model as BaseModel, TsTrait
3
+ from x_model.models import Model as BaseModel, TsTrait
4
4
 
5
5
  from x_auth.enums import UserStatus, Role, Scope
6
6
 
@@ -1,11 +1,13 @@
1
1
  from datetime import timedelta
2
2
  from tortoise.exceptions import IntegrityError, ConfigurationError
3
+ from x_model import FailReason
4
+
3
5
  from x_auth.backend import AuthBackend
4
6
 
5
7
  from x_auth.depend import Depend
6
- from x_auth.enums import FailReason, AuthFailReason
8
+ from x_auth.enums import AuthFailReason
7
9
  from x_auth import jwt_encode, HTTPException, AuthException, BearerSecurity
8
- from x_auth.model import User
10
+ from x_auth.models import User
9
11
  from x_auth.pydantic import AuthUser, UserReg, Token
10
12
 
11
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xn-auth
3
- Version: 0.2.2.dev2
3
+ Version: 0.2.2.dev3
4
4
  Summary: Auth adapter for XN-Api framework
5
5
  Author-email: Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
@@ -8,7 +8,7 @@ x_auth/__init__.py
8
8
  x_auth/backend.py
9
9
  x_auth/depend.py
10
10
  x_auth/enums.py
11
- x_auth/model.py
11
+ x_auth/models.py
12
12
  x_auth/pydantic.py
13
13
  x_auth/router.py
14
14
  xn_auth.egg-info/PKG-INFO
File without changes
File without changes
File without changes
File without changes
File without changes