현재 작업 전체 반영

This commit is contained in:
Yun Chan 2026-06-27 16:08:41 +09:00
parent 5560638e54
commit c0dddab594
85 changed files with 11322 additions and 539 deletions

View file

@ -41,13 +41,24 @@ SAML_ATTRIBUTE_DISPLAY_NAME_NAMES = {
"cn",
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
}
SAML_ATTRIBUTE_COHORT_NAMES = {
"cohort",
"cohort_id",
"cohortIds",
"cohorts",
"class",
"group",
"groups",
}
@dataclass(frozen=True, slots=True)
class SamlIdentity:
subject: str
email: str
display_name: str
role_hint: str | None = None
cohort_hint: str | None = None
def acs_url_for_entity_id(entity_id: str) -> str:
@ -120,7 +131,14 @@ def parse_fixture_response(encoded_response: str) -> SamlIdentity:
or email
)
role_hint = _first_attribute(attributes, SAML_ATTRIBUTE_ROLE_NAMES)
return SamlIdentity(email=email, display_name=display_name or email, role_hint=role_hint)
cohort_hint = _first_attribute(attributes, SAML_ATTRIBUTE_COHORT_NAMES)
return SamlIdentity(
subject=name_id or email,
email=email,
display_name=display_name or email,
role_hint=role_hint,
cohort_hint=cohort_hint or None,
)
def _first_text(root: ElementTree.Element, selector: str) -> str: