style: format SSO service
All checks were successful
State Corp Backend CI/CD / Quality gate (push) Successful in 4m19s
State Corp Backend CI/CD / Build linux/amd64 images once (push) Successful in 3m57s
State Corp Backend CI/CD / Refresh and release internal main (push) Has been skipped
State Corp Backend CI/CD / Release customer main (push) Has been skipped
State Corp Backend CI/CD / Release dev (push) Successful in 38s
All checks were successful
State Corp Backend CI/CD / Quality gate (push) Successful in 4m19s
State Corp Backend CI/CD / Build linux/amd64 images once (push) Successful in 3m57s
State Corp Backend CI/CD / Refresh and release internal main (push) Has been skipped
State Corp Backend CI/CD / Release customer main (push) Has been skipped
State Corp Backend CI/CD / Release dev (push) Successful in 38s
This commit is contained in:
@@ -150,9 +150,13 @@ def _validate_token_lifetime(payload: dict) -> tuple[int, int]:
|
|||||||
|
|
||||||
def _normalized_groups(payload: dict) -> tuple[str, ...]:
|
def _normalized_groups(payload: dict) -> tuple[str, ...]:
|
||||||
groups = payload.get("groups", [])
|
groups = payload.get("groups", [])
|
||||||
if not isinstance(groups, list) or len(groups) > 100 or any(
|
if (
|
||||||
not isinstance(group, str) or not group.strip() or len(group) > 255
|
not isinstance(groups, list)
|
||||||
for group in groups
|
or len(groups) > 100
|
||||||
|
or any(
|
||||||
|
not isinstance(group, str) or not group.strip() or len(group) > 255
|
||||||
|
for group in groups
|
||||||
|
)
|
||||||
):
|
):
|
||||||
raise SsoAuthenticationError("Некорректные группы SSO-пользователя.")
|
raise SsoAuthenticationError("Некорректные группы SSO-пользователя.")
|
||||||
return tuple(dict.fromkeys(group.strip() for group in groups))
|
return tuple(dict.fromkeys(group.strip() for group in groups))
|
||||||
@@ -307,9 +311,15 @@ def provision_sso_user(claims: SsoClaims):
|
|||||||
identity.role_managed_by_sso = True
|
identity.role_managed_by_sso = True
|
||||||
identity.save(
|
identity.save(
|
||||||
update_fields=[
|
update_fields=[
|
||||||
"last_authenticated_at", "external_groups", "okpo", "user_type_code",
|
"last_authenticated_at",
|
||||||
"default_organisation", "is_integrated_structure", "ex_loop",
|
"external_groups",
|
||||||
"role_managed_by_sso", "updated_at",
|
"okpo",
|
||||||
|
"user_type_code",
|
||||||
|
"default_organisation",
|
||||||
|
"is_integrated_structure",
|
||||||
|
"ex_loop",
|
||||||
|
"role_managed_by_sso",
|
||||||
|
"updated_at",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
if identity.role_managed_by_sso:
|
if identity.role_managed_by_sso:
|
||||||
|
|||||||
Reference in New Issue
Block a user