fix(auth): 重构登录认证,并支持跳转到关联服务如图纸标注

This commit is contained in:
sophie committed 2026-07-29 13:22:31 +08:00
1 parent ce1fd59f61
commit affe139bf9
51 files changed
+1939 -132

No files matched your search

+12
View File
@@ -82,12 +82,14 @@ def test_identity_from_claims_validates_issuer_and_normalizes_fields():
'iss': 'https://casdoor.test/',
'sub': 'subject-1',
'preferred_username': 'alice',
'employeeId': 'E1001',
'displayName': 'Alice Zhang',
'email': 'alice@example.com',
'affiliation': 'IT',
}, expected_issuer='https://casdoor.test')
assert identity.username == 'alice'
assert identity.display_name == 'Alice Zhang'
assert identity.employee_id == 'E1001'
assert identity.department == 'IT'
with pytest.raises(IdentityValidationError):
identity_from_claims({
@@ -107,6 +109,16 @@ def test_identity_from_claims_uses_configured_issuer_when_userinfo_omits_iss():
assert identity.subject == 'subject-1'
def test_identity_from_claims_reads_employee_id_from_casdoor_properties():
"""Casdoor 将自定义工号放在 properties 时,公共解析器仍输出 employee_id。"""
identity = identity_from_claims({
'sub': 'subject-1',
'preferred_username': '26040006',
'properties': {'employee_id': '26040006'},
}, expected_issuer='https://casdoor.test')
assert identity.employee_id == '26040006'
def test_casdoor_config_repr_does_not_expose_secret(app):
"""配置对象可诊断但不得在 repr 中泄漏 Casdoor client_secret。"""
app.config.update(