jam.saml.metadata¶
metadata
¶
Functions:
| Name | Description |
|---|---|
generate_idp_metadata |
Generate SAML IdP metadata XML. |
generate_sp_metadata |
Generate SAML SP metadata XML. |
parse_metadata |
Parse SAML 2.0 metadata XML. |
generate_idp_metadata
¶
generate_idp_metadata(
entity_id: str,
sso_url: str,
certificate: str | None = None,
want_authn_requests_signed: bool = False,
) -> str
Generate SAML IdP metadata XML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_id
|
str
|
IdP entity ID. |
required |
sso_url
|
str
|
Single Sign-On endpoint URL. |
required |
certificate
|
str | None
|
PEM certificate string (included in KeyDescriptor). |
None
|
want_authn_requests_signed
|
bool
|
Whether IdP requires signed AuthnRequests. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
SAML metadata XML string. |
generate_sp_metadata
¶
generate_sp_metadata(
entity_id: str,
acs_url: str,
certificate: str | None = None,
authn_requests_signed: bool = False,
) -> str
Generate SAML SP metadata XML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entity_id
|
str
|
SP entity ID. |
required |
acs_url
|
str
|
Assertion Consumer Service URL. |
required |
certificate
|
str | None
|
PEM certificate string (included in KeyDescriptor). |
None
|
authn_requests_signed
|
bool
|
Whether SP signs AuthnRequests. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
SAML metadata XML string. |
parse_metadata
¶
parse_metadata(metadata_xml: str) -> SAMLMetadata
Parse SAML 2.0 metadata XML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata_xml
|
str
|
Raw metadata XML string. |
required |
Returns:
| Type | Description |
|---|---|
SAMLMetadata
|
SAMLMetadata with entity_id, role, endpoints, and certificate. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If neither IdP nor SP descriptor is found. |