opengater-globalauth-client 0.1.5__py3-none-any.whl → 0.2.0__py3-none-any.whl
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.
- opengater_globalauth_client/__init__.py +1 -1
- opengater_globalauth_client/broker/events.py +2 -0
- opengater_globalauth_client/broker/publisher.py +18 -24
- opengater_globalauth_client/models.py +1 -0
- {opengater_globalauth_client-0.1.5.dist-info → opengater_globalauth_client-0.2.0.dist-info}/METADATA +1 -1
- {opengater_globalauth_client-0.1.5.dist-info → opengater_globalauth_client-0.2.0.dist-info}/RECORD +7 -7
- {opengater_globalauth_client-0.1.5.dist-info → opengater_globalauth_client-0.2.0.dist-info}/WHEEL +0 -0
|
@@ -35,6 +35,7 @@ class UserCreatedEvent(BrokerMessage):
|
|
|
35
35
|
user_id: str
|
|
36
36
|
auth_type: str
|
|
37
37
|
identifier: str
|
|
38
|
+
language: str = "ru"
|
|
38
39
|
extra_data: dict | None = None
|
|
39
40
|
trust: TrustInfo
|
|
40
41
|
|
|
@@ -99,6 +100,7 @@ class CreateUserCommand(BrokerMessage):
|
|
|
99
100
|
|
|
100
101
|
auth_type: Literal["telegram"]
|
|
101
102
|
identifier: str
|
|
103
|
+
language: str = "ru"
|
|
102
104
|
extra_data: dict | None = None
|
|
103
105
|
|
|
104
106
|
# Registration source (optional, mutually exclusive)
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
2
|
RabbitMQ publisher for GlobalAuth commands.
|
|
3
3
|
"""
|
|
4
|
-
from
|
|
4
|
+
from uuid import UUID
|
|
5
|
+
from typing import Literal
|
|
6
|
+
from pydantic import BaseModel, field_validator
|
|
5
7
|
|
|
6
8
|
from faststream.rabbit import RabbitBroker
|
|
7
9
|
|
|
@@ -34,12 +36,13 @@ class GlobalAuthPublisher:
|
|
|
34
36
|
)
|
|
35
37
|
```
|
|
36
38
|
"""
|
|
37
|
-
|
|
39
|
+
|
|
38
40
|
COMMANDS_QUEUE = "globalauth.commands"
|
|
39
|
-
|
|
40
|
-
def __init__(self, broker: RabbitBroker):
|
|
41
|
+
|
|
42
|
+
def __init__(self, broker: RabbitBroker, service_slug: str):
|
|
41
43
|
self.broker = broker
|
|
42
|
-
|
|
44
|
+
self.service_slug = service_slug
|
|
45
|
+
|
|
43
46
|
async def _publish(self, message: BaseModel) -> None:
|
|
44
47
|
"""Publish message to commands queue"""
|
|
45
48
|
await self.broker.publish(
|
|
@@ -47,15 +50,10 @@ class GlobalAuthPublisher:
|
|
|
47
50
|
queue=self.COMMANDS_QUEUE,
|
|
48
51
|
persist=True,
|
|
49
52
|
)
|
|
50
|
-
|
|
53
|
+
|
|
51
54
|
async def create_user(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
identifier: str,
|
|
55
|
-
extra_data: dict | None = None,
|
|
56
|
-
invited_by_id: str | None = None,
|
|
57
|
-
event_id: str | None = None,
|
|
58
|
-
event_service: str | None = None,
|
|
55
|
+
self,
|
|
56
|
+
command: CreateUserCommand
|
|
59
57
|
) -> None:
|
|
60
58
|
"""
|
|
61
59
|
Send create_user command to GlobalAuth.
|
|
@@ -65,6 +63,7 @@ class GlobalAuthPublisher:
|
|
|
65
63
|
Args:
|
|
66
64
|
auth_type: Authentication type ("telegram")
|
|
67
65
|
identifier: User identifier (e.g., telegram_id)
|
|
66
|
+
language: User language code (default: "ru")
|
|
68
67
|
extra_data: Additional data (username, first_name, etc.)
|
|
69
68
|
invited_by_id: UUID of inviter (referral)
|
|
70
69
|
event_id: Event/campaign ID
|
|
@@ -80,6 +79,7 @@ class GlobalAuthPublisher:
|
|
|
80
79
|
await publisher.create_user(
|
|
81
80
|
auth_type="telegram",
|
|
82
81
|
identifier="123456789",
|
|
82
|
+
language="en",
|
|
83
83
|
invited_by_id="uuid-of-inviter"
|
|
84
84
|
)
|
|
85
85
|
|
|
@@ -92,17 +92,11 @@ class GlobalAuthPublisher:
|
|
|
92
92
|
)
|
|
93
93
|
```
|
|
94
94
|
"""
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
extra_data=extra_data,
|
|
99
|
-
invited_by_id=invited_by_id,
|
|
100
|
-
event_id=event_id,
|
|
101
|
-
event_service=event_service,
|
|
102
|
-
)
|
|
103
|
-
|
|
95
|
+
if not command.event_service:
|
|
96
|
+
command.event_service = self.service_slug
|
|
97
|
+
|
|
104
98
|
await self._publish(command)
|
|
105
|
-
|
|
99
|
+
|
|
106
100
|
async def send_command(self, command: str, **kwargs) -> None:
|
|
107
101
|
"""
|
|
108
102
|
Send generic command to GlobalAuth.
|
|
@@ -114,7 +108,7 @@ class GlobalAuthPublisher:
|
|
|
114
108
|
**kwargs: Command parameters
|
|
115
109
|
"""
|
|
116
110
|
message = {"command": command, **kwargs}
|
|
117
|
-
|
|
111
|
+
|
|
118
112
|
await self.broker.publish(
|
|
119
113
|
message,
|
|
120
114
|
queue=self.COMMANDS_QUEUE,
|
{opengater_globalauth_client-0.1.5.dist-info → opengater_globalauth_client-0.2.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opengater-globalauth-client
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Client library for GlobalAuth authentication service
|
|
5
5
|
Project-URL: Homepage, https://github.com/opengater/globalauth-client
|
|
6
6
|
Project-URL: Documentation, https://github.com/opengater/globalauth-client#readme
|
{opengater_globalauth_client-0.1.5.dist-info → opengater_globalauth_client-0.2.0.dist-info}/RECORD
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
opengater_globalauth_client/__init__.py,sha256=
|
|
1
|
+
opengater_globalauth_client/__init__.py,sha256=bLctcfnnrf5dlIIKvIpsF6YDR_N7h9VOS54p6MQd0jw,3102
|
|
2
2
|
opengater_globalauth_client/client.py,sha256=PPePBs_6uaYPxKhqVZOWjS7hG8bx9flA7QLOnKQy6HM,12393
|
|
3
3
|
opengater_globalauth_client/exceptions.py,sha256=0lw1UMrh7B-f6q-TAHgv5euiDwGo9PjmV7SkewSM3MQ,830
|
|
4
|
-
opengater_globalauth_client/models.py,sha256=
|
|
4
|
+
opengater_globalauth_client/models.py,sha256=qU5jTqIJwa-RkX7e3qqH0i2sQI7s3fqWkmylALA1IZ8,2696
|
|
5
5
|
opengater_globalauth_client/broker/__init__.py,sha256=ih8b1xYcdUZSXZY1DwVqsnDbe8O_ch6ckYwYSyAnM_Q,632
|
|
6
6
|
opengater_globalauth_client/broker/consumer.py,sha256=2CCkp1MD5igFYDh3qlkrRtKR7E0Lk1EQ7dWxwGVEoQo,6057
|
|
7
|
-
opengater_globalauth_client/broker/events.py,sha256=
|
|
8
|
-
opengater_globalauth_client/broker/publisher.py,sha256=
|
|
7
|
+
opengater_globalauth_client/broker/events.py,sha256=5335_6MJtDa8cMLyhUPJBq5JylNiHc3T6U-7RaBhj5c,2724
|
|
8
|
+
opengater_globalauth_client/broker/publisher.py,sha256=VgKK9FICkGaiRnoFTPEDPT1fmdvLq6xUQF8Y09JOQHA,3538
|
|
9
9
|
opengater_globalauth_client/fastapi/__init__.py,sha256=Jjk9eJD1-GIXMprJT0NAkmAb7rqFT0DPqx0s8eEI3c8,486
|
|
10
10
|
opengater_globalauth_client/fastapi/dependencies.py,sha256=P5C9PWIOsKrDwtF8LlPStPzFaMMjqXU85mQ1vuc_gn8,6912
|
|
11
11
|
opengater_globalauth_client/fastapi/middleware.py,sha256=_ySEvBH4C86VIdtuevTO8MlpSvIG8r_liLN4mpFaAls,5656
|
|
12
|
-
opengater_globalauth_client-0.
|
|
13
|
-
opengater_globalauth_client-0.
|
|
14
|
-
opengater_globalauth_client-0.
|
|
12
|
+
opengater_globalauth_client-0.2.0.dist-info/METADATA,sha256=GDWPTEDbqKpo1Sq77E6AUb3sESfKPIpDvhUenjHRPJs,5901
|
|
13
|
+
opengater_globalauth_client-0.2.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
opengater_globalauth_client-0.2.0.dist-info/RECORD,,
|
{opengater_globalauth_client-0.1.5.dist-info → opengater_globalauth_client-0.2.0.dist-info}/WHEEL
RENAMED
|
File without changes
|