huace-aigc-auth-client 1.1.1__tar.gz → 1.1.3__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.
- {huace_aigc_auth_client-1.1.1/huace_aigc_auth_client.egg-info → huace_aigc_auth_client-1.1.3}/PKG-INFO +4 -4
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/QUICK_START.txt +1 -1
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/README.md +3 -3
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/huace_aigc_auth_client/__init__.py +1 -1
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/huace_aigc_auth_client/legacy_adapter.py +18 -3
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/huace_aigc_auth_client/sdk.py +5 -3
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3/huace_aigc_auth_client.egg-info}/PKG-INFO +4 -4
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/pyproject.toml +1 -1
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/LICENSE +0 -0
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/MANIFEST.in +0 -0
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/huace_aigc_auth_client.egg-info/SOURCES.txt +0 -0
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/huace_aigc_auth_client.egg-info/dependency_links.txt +0 -0
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/huace_aigc_auth_client.egg-info/requires.txt +0 -0
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/huace_aigc_auth_client.egg-info/top_level.txt +0 -0
- {huace_aigc_auth_client-1.1.1 → huace_aigc_auth_client-1.1.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: huace-aigc-auth-client
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
4
4
|
Summary: 华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能
|
|
5
5
|
Author-email: Huace <support@huace.com>
|
|
6
6
|
License: MIT
|
|
@@ -46,7 +46,7 @@ AIGC_AUTH_APP_ID=your_app_id
|
|
|
46
46
|
AIGC_AUTH_APP_SECRET=your_app_secret
|
|
47
47
|
|
|
48
48
|
# 可选:鉴权服务地址(默认为生产环境)
|
|
49
|
-
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/api/v1
|
|
49
|
+
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/aigc-auth/api/v1
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
如需通过 Nginx 代理:
|
|
@@ -75,7 +75,7 @@ client = AigcAuthClient()
|
|
|
75
75
|
client = AigcAuthClient(
|
|
76
76
|
app_id="your_app_id",
|
|
77
77
|
app_secret="your_app_secret",
|
|
78
|
-
base_url="https://aigc-auth.huacemedia.com/api/v1"
|
|
78
|
+
base_url="https://aigc-auth.huacemedia.com/aigc-auth/api/v1"
|
|
79
79
|
)
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -353,7 +353,7 @@ except AigcAuthError as e:
|
|
|
353
353
|
# .env 文件
|
|
354
354
|
AIGC_AUTH_APP_ID=your_app_id
|
|
355
355
|
AIGC_AUTH_APP_SECRET=your_app_secret
|
|
356
|
-
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/api/v1
|
|
356
|
+
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/aigc-auth/api/v1
|
|
357
357
|
|
|
358
358
|
# 同步配置
|
|
359
359
|
AIGC_AUTH_SYNC_ENABLED=true
|
|
@@ -12,7 +12,7 @@ pip install huace-aigc-auth-client
|
|
|
12
12
|
# .env 文件
|
|
13
13
|
AIGC_AUTH_APP_ID=your_app_id
|
|
14
14
|
AIGC_AUTH_APP_SECRET=your_app_secret
|
|
15
|
-
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/api/v1
|
|
15
|
+
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/aigc-auth/api/v1
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
基本使用
|
|
@@ -21,7 +21,7 @@ AIGC_AUTH_APP_ID=your_app_id
|
|
|
21
21
|
AIGC_AUTH_APP_SECRET=your_app_secret
|
|
22
22
|
|
|
23
23
|
# 可选:鉴权服务地址(默认为生产环境)
|
|
24
|
-
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/api/v1
|
|
24
|
+
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/aigc-auth/api/v1
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
如需通过 Nginx 代理:
|
|
@@ -50,7 +50,7 @@ client = AigcAuthClient()
|
|
|
50
50
|
client = AigcAuthClient(
|
|
51
51
|
app_id="your_app_id",
|
|
52
52
|
app_secret="your_app_secret",
|
|
53
|
-
base_url="https://aigc-auth.huacemedia.com/api/v1"
|
|
53
|
+
base_url="https://aigc-auth.huacemedia.com/aigc-auth/api/v1"
|
|
54
54
|
)
|
|
55
55
|
```
|
|
56
56
|
|
|
@@ -328,7 +328,7 @@ except AigcAuthError as e:
|
|
|
328
328
|
# .env 文件
|
|
329
329
|
AIGC_AUTH_APP_ID=your_app_id
|
|
330
330
|
AIGC_AUTH_APP_SECRET=your_app_secret
|
|
331
|
-
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/api/v1
|
|
331
|
+
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/aigc-auth/api/v1
|
|
332
332
|
|
|
333
333
|
# 同步配置
|
|
334
334
|
AIGC_AUTH_SYNC_ENABLED=true
|
|
@@ -174,6 +174,18 @@ class LegacySystemAdapter(ABC):
|
|
|
174
174
|
"""
|
|
175
175
|
raise NotImplementedError("Subclass must implement _update_user_async method")
|
|
176
176
|
|
|
177
|
+
@abstractmethod
|
|
178
|
+
async def _delete_user_async(self, username: str) -> bool:
|
|
179
|
+
"""异步删除用户(子类必须实现)
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
username: 用户名
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
bool: 删除成功返回 True
|
|
186
|
+
"""
|
|
187
|
+
raise NotImplementedError("Subclass must implement _delete_user_async method")
|
|
188
|
+
|
|
177
189
|
@abstractmethod
|
|
178
190
|
async def get_all_users_async(self) -> List[LegacyUserData]:
|
|
179
191
|
"""获取所有用户(子类必须实现,用于批量同步)
|
|
@@ -283,7 +295,7 @@ class LegacySystemAdapter(ABC):
|
|
|
283
295
|
Returns:
|
|
284
296
|
Dict: 处理结果
|
|
285
297
|
"""
|
|
286
|
-
if event == "user.created" or event == "user.updated":
|
|
298
|
+
if event == "user.created" or event == "user.updated" or event == "user.login":
|
|
287
299
|
# 转换数据格式
|
|
288
300
|
legacy_data = self.transform_auth_to_legacy(data)
|
|
289
301
|
|
|
@@ -308,7 +320,10 @@ class LegacySystemAdapter(ABC):
|
|
|
308
320
|
elif event == "user.deleted":
|
|
309
321
|
# 禁用用户而不是删除
|
|
310
322
|
username = data.get("username")
|
|
311
|
-
|
|
323
|
+
if not username:
|
|
324
|
+
logger.error("username is required for user.deleted event")
|
|
325
|
+
return {"success": False, "message": "username is required for user.deleted event"}
|
|
326
|
+
await self._delete_user_async(username)
|
|
312
327
|
|
|
313
328
|
return {"success": True, "message": "User disabled"}
|
|
314
329
|
|
|
@@ -479,7 +494,7 @@ class UserSyncService:
|
|
|
479
494
|
"department": user_info.department,
|
|
480
495
|
"company": user_info.company,
|
|
481
496
|
"is_admin": user_info.is_admin,
|
|
482
|
-
"status":
|
|
497
|
+
"status": user_info.status,
|
|
483
498
|
}
|
|
484
499
|
|
|
485
500
|
async def sync_on_login_async(self, auth_user_info) -> Dict[str, Any]:
|
|
@@ -42,6 +42,7 @@ class UserInfo:
|
|
|
42
42
|
department: Optional[str] = None
|
|
43
43
|
company: Optional[str] = None
|
|
44
44
|
is_admin: Optional[bool] = None
|
|
45
|
+
status: Optional[str] = None
|
|
45
46
|
|
|
46
47
|
def __post_init__(self):
|
|
47
48
|
if self.roles is None:
|
|
@@ -91,7 +92,7 @@ class AigcAuthClient:
|
|
|
91
92
|
client = AigcAuthClient(
|
|
92
93
|
app_id="your_app_id",
|
|
93
94
|
app_secret="your_app_secret",
|
|
94
|
-
base_url="https://aigc-auth.huacemedia.com/api/v1" # 可选
|
|
95
|
+
base_url="https://aigc-auth.huacemedia.com/aigc-auth/api/v1" # 可选
|
|
95
96
|
)
|
|
96
97
|
|
|
97
98
|
# 验证 token
|
|
@@ -127,7 +128,7 @@ class AigcAuthClient:
|
|
|
127
128
|
self.base_url = (
|
|
128
129
|
base_url or
|
|
129
130
|
os.getenv("AIGC_AUTH_BASE_URL") or
|
|
130
|
-
"https://aigc-auth.huacemedia.com/api/v1"
|
|
131
|
+
"https://aigc-auth.huacemedia.com/aigc-auth/api/v1"
|
|
131
132
|
)
|
|
132
133
|
self.timeout = timeout
|
|
133
134
|
self.cache_ttl = cache_ttl
|
|
@@ -329,7 +330,8 @@ class AigcAuthClient:
|
|
|
329
330
|
permissions=data.get("permissions", []),
|
|
330
331
|
department=data.get("department"),
|
|
331
332
|
company=data.get("company"),
|
|
332
|
-
is_admin=data.get("is_admin")
|
|
333
|
+
is_admin=data.get("is_admin"),
|
|
334
|
+
status=data.get("status")
|
|
333
335
|
)
|
|
334
336
|
|
|
335
337
|
def check_permissions(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: huace-aigc-auth-client
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
4
4
|
Summary: 华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能
|
|
5
5
|
Author-email: Huace <support@huace.com>
|
|
6
6
|
License: MIT
|
|
@@ -46,7 +46,7 @@ AIGC_AUTH_APP_ID=your_app_id
|
|
|
46
46
|
AIGC_AUTH_APP_SECRET=your_app_secret
|
|
47
47
|
|
|
48
48
|
# 可选:鉴权服务地址(默认为生产环境)
|
|
49
|
-
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/api/v1
|
|
49
|
+
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/aigc-auth/api/v1
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
如需通过 Nginx 代理:
|
|
@@ -75,7 +75,7 @@ client = AigcAuthClient()
|
|
|
75
75
|
client = AigcAuthClient(
|
|
76
76
|
app_id="your_app_id",
|
|
77
77
|
app_secret="your_app_secret",
|
|
78
|
-
base_url="https://aigc-auth.huacemedia.com/api/v1"
|
|
78
|
+
base_url="https://aigc-auth.huacemedia.com/aigc-auth/api/v1"
|
|
79
79
|
)
|
|
80
80
|
```
|
|
81
81
|
|
|
@@ -353,7 +353,7 @@ except AigcAuthError as e:
|
|
|
353
353
|
# .env 文件
|
|
354
354
|
AIGC_AUTH_APP_ID=your_app_id
|
|
355
355
|
AIGC_AUTH_APP_SECRET=your_app_secret
|
|
356
|
-
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/api/v1
|
|
356
|
+
AIGC_AUTH_BASE_URL=https://aigc-auth.huacemedia.com/aigc-auth/api/v1
|
|
357
357
|
|
|
358
358
|
# 同步配置
|
|
359
359
|
AIGC_AUTH_SYNC_ENABLED=true
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|