IdPHandler

A flask_saml2.idp.ServiceProvider handles requests from Identity Providers via flask_saml2.idp.IdPHandler instances.

See Configuration for configuration options.

class flask_saml2.sp.IdPHandler(sp, *, entity_id, display_name=None, sso_url=None, slo_url=None, certificate=None, **kwargs)

Represents an Identity Provider that the running Service Provider knows about. This class should be subclassed for Identity Providers that need specific configurations.

get_idp_sso_url()

Get the Single Sign On URL for this IdP.

get_idp_slo_url()

Get the Single Log Out URL for this IdP.

get_sp_acs_url()

Get the Attribute Consumer Service URL on the current SP this IdP should send responses to.

get_authn_request(template=<class 'flask_saml2.sp.xml_templates.AuthnRequest'>, **parameters)

Make a AuthnRequest to send to this IdP.

get_logout_request(auth_data, template=<class 'flask_saml2.sp.xml_templates.LogoutRequest'>, **parameters)

Make a LogoutRequest for the authenticated user to send to this IdP.

make_login_request_url(relay_state=None)

Make a LoginRequest url and query string for this IdP.

Return type

str

decode_saml_string(saml_string)

Decode an incoming SAMLResponse into an XML string.

Return type

bytes

encode_saml_string(saml_string)

Encoding an XML string into a SAMLRequest.

Return type

str

get_response_parser(saml_response)

Make a ResponseParser instance to handle this response.

get_auth_data(response)

Create an AuthData instance from a SAML Response. The response is validated first.

Return type

AuthData

format_datetime(value)

Format a datetime for this IdP. Some IdPs are picky about their date formatting, and don’t support the format produced by datetime.datetime.isoformat().

Return type

str