|
11 | 11 |
|
12 | 12 | """
|
13 | 13 |
|
| 14 | +import logging |
14 | 15 | import xmlsec
|
15 | 16 |
|
| 17 | + |
16 | 18 | from onelogin.saml2 import compat
|
17 | 19 | from onelogin.saml2.authn_request import OneLogin_Saml2_Authn_Request
|
18 | 20 | from onelogin.saml2.constants import OneLogin_Saml2_Constants
|
|
24 | 26 | from onelogin.saml2.xmlparser import tostring
|
25 | 27 |
|
26 | 28 |
|
| 29 | +logger = logging.getLogger(__name__) |
| 30 | + |
| 31 | + |
27 | 32 | class OneLogin_Saml2_Auth(object):
|
28 | 33 | """
|
29 | 34 |
|
@@ -389,22 +394,29 @@ def _create_authn_request(
|
389 | 394 |
|
390 | 395 | def login_post(self, return_to=None, **authn_kwargs):
|
391 | 396 | authn_request = self._create_authn_request(**authn_kwargs)
|
| 397 | + |
| 398 | + url = self.get_sso_url() |
| 399 | + data = authn_request.get_request(deflate=False, base64_encode=False) |
392 | 400 | saml_request = OneLogin_Saml2_Utils.b64encode(
|
393 | 401 | OneLogin_Saml2_Utils.add_sign(
|
394 |
| - authn_request.get_request(deflate=False, base64_encode=False), |
| 402 | + data, |
395 | 403 | self.__settings.get_sp_key(), self.__settings.get_sp_cert(),
|
396 | 404 | sign_algorithm=OneLogin_Saml2_Constants.RSA_SHA256,
|
397 | 405 | digest_algorithm=OneLogin_Saml2_Constants.SHA256,),
|
398 | 406 |
|
399 | 407 | )
|
| 408 | + logger.debug( |
| 409 | + "Returning form-data to the user for a AuthNRequest to %s with SAMLRequest %s", |
| 410 | + url, OneLogin_Saml2_Utils.b64decode(saml_request).decode('utf-8') |
| 411 | + ) |
400 | 412 | parameters = {'SAMLRequest': saml_request}
|
401 | 413 |
|
402 | 414 | if return_to is not None:
|
403 | 415 | parameters['RelayState'] = return_to
|
404 | 416 | else:
|
405 | 417 | parameters['RelayState'] = OneLogin_Saml2_Utils.get_self_url_no_query(self.__request_data)
|
406 | 418 |
|
407 |
| - return self.get_sso_url(), parameters |
| 419 | + return url, parameters |
408 | 420 |
|
409 | 421 | def login(self, return_to=None, **authn_kwargs):
|
410 | 422 | """
|
|
0 commit comments