def initialize_session(self, request, callback, **callback_kwargs): from realms.models import RealmAuthenticationSession ras = RealmAuthenticationSession(realm=self.instance, callback=callback, callback_kwargs=callback_kwargs) ras.save() saml2_client = self.get_saml2_client() request_id, request_info = saml2_client.prepare_for_authenticate( relay_state=str(ras.pk)) # save request ID in auth session ras.backend_state = {"request_id": request_id} ras.save() return dict(request_info["headers"])["Location"]
def initialize_session(self, request, callback, **callback_kwargs): from realms.models import RealmAuthenticationSession ras = RealmAuthenticationSession( realm=self.instance, callback=callback, callback_kwargs=remove_null_character(callback_kwargs)) ras.save() saml2_client = self.get_saml2_client() # can throw error # like saml2.s_utils.UnsupportedBinding: urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect # if the IdP configuration and thus the metadata is wrong, but these should be caught at creation time # in the realm form. request_id, request_info = saml2_client.prepare_for_authenticate( relay_state=str(ras.pk)) # save request ID in auth session ras.backend_state = {"request_id": request_id} ras.save() return dict(request_info["headers"])["Location"]