apexauthlib 0.1.0__tar.gz → 0.1.1__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.
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.3
2
+ Name: apexauthlib
3
+ Version: 0.1.1
4
+ Summary: Apex authorization library for services
5
+ Author: Apex Dev
6
+ Author-email: dev@apex.ge
7
+ Requires-Python: >=3.12
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Requires-Dist: apexdevkit
12
+ Requires-Dist: fastapi
13
+ Requires-Dist: httpx
14
+ Requires-Dist: uvicorn
15
+ Description-Content-Type: text/markdown
16
+
17
+ # apexauthlib
18
+ Central authorization library for apex services
19
+
@@ -0,0 +1,2 @@
1
+ # apexauthlib
2
+ Central authorization library for apex services
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "apexauthlib"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Apex authorization library for services"
5
5
  authors = [{ name = "Apex Dev", email = "dev@apex.ge" }]
6
6
  readme = "README.md"
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: apexauthlib
3
- Version: 0.1.0
4
- Summary: Apex authorization library for services
5
- Author-email: Apex Dev <dev@apex.ge>
6
- Requires-Python: >=3.12
7
- Description-Content-Type: text/markdown
8
- License-File: LICENSE
9
- Dynamic: license-file
10
-
11
- # apexauthlib
12
- Authorization library for apex services
@@ -1,2 +0,0 @@
1
- # apexauthlib
2
- Authorization library for apex services
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: apexauthlib
3
- Version: 0.1.0
4
- Summary: Apex authorization library for services
5
- Author-email: Apex Dev <dev@apex.ge>
6
- Requires-Python: >=3.12
7
- Description-Content-Type: text/markdown
8
- License-File: LICENSE
9
- Dynamic: license-file
10
-
11
- # apexauthlib
12
- Authorization library for apex services
@@ -1,13 +0,0 @@
1
- LICENSE
2
- README.md
3
- pyproject.toml
4
- apexauthlib/__init__.py
5
- apexauthlib.egg-info/PKG-INFO
6
- apexauthlib.egg-info/SOURCES.txt
7
- apexauthlib.egg-info/dependency_links.txt
8
- apexauthlib.egg-info/top_level.txt
9
- apexauthlib/fastapi/__init__.py
10
- apexauthlib/fastapi/auth.py
11
- apexauthlib/integration/__init__.py
12
- apexauthlib/integration/api.py
13
- tests/test_api.py
@@ -1 +0,0 @@
1
- apexauthlib
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
@@ -1,86 +0,0 @@
1
- from dataclasses import dataclass
2
-
3
- from apexdevkit.formatter import DataclassFormatter
4
- from apexdevkit.http import FakeHttp, FluentHttp, HttpMethod
5
- from apexdevkit.http.fake import FakeResponse
6
- from faker import Faker
7
-
8
- from apexauthlib.integration import AuthApiProvider
9
- from apexauthlib.integration.api import AuthApi
10
-
11
-
12
- @dataclass(frozen=True)
13
- class TestPermissions:
14
- role: str
15
- read: bool
16
- write: bool
17
-
18
-
19
- def test_login() -> None:
20
- http = FakeHttp(FakeResponse({"access_token": "token"}))
21
- service_name = Faker().text()
22
- api = AuthApiProvider[TestPermissions](
23
- FluentHttp(http), service_name, DataclassFormatter(TestPermissions)
24
- )
25
-
26
- result = api.login("user", "9")
27
-
28
- assert result == "token"
29
-
30
- http.intercepted(HttpMethod.post).on_endpoint("/auth/login")
31
-
32
- assert http.data == {
33
- "grant_type": "password",
34
- "username": "user",
35
- "password": "9",
36
- "scope": "",
37
- "client_id": "string",
38
- "client_secret": "string",
39
- }
40
-
41
-
42
- def test_user() -> None:
43
- http = FakeHttp(FakeResponse({"id": "1"}))
44
- service_name = Faker().text()
45
- api = AuthApi[TestPermissions](
46
- FluentHttp(http), service_name, DataclassFormatter(TestPermissions), "token"
47
- )
48
-
49
- result = api.user()
50
-
51
- assert result == "1"
52
-
53
- http.intercepted(HttpMethod.get).on_endpoint("/auth/user")
54
-
55
- assert http.headers == {
56
- "Authorization": "Bearer token",
57
- }
58
-
59
-
60
- def test_metadata() -> None:
61
- http = FakeHttp(
62
- FakeResponse(
63
- {
64
- "data": {
65
- "metadata": {
66
- "metadata": {"role": "admin", "read": True, "write": True}
67
- }
68
- }
69
- }
70
- )
71
- )
72
-
73
- service_name = Faker().text()
74
- api = AuthApi[TestPermissions](
75
- FluentHttp(http), service_name, DataclassFormatter(TestPermissions), "token"
76
- )
77
-
78
- result = api.metadata_for("1")
79
-
80
- assert result == TestPermissions("admin", True, True)
81
-
82
- http.intercepted(HttpMethod.get).on_endpoint(f"/services/{service_name}/metadata/1")
83
-
84
- assert http.headers == {
85
- "Authorization": "Bearer token",
86
- }
File without changes