Support » Plugin: SAML 2.0 Single Sign-On » How do I access the SAML response object from outside the plugin?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter whiteship3

    (@whiteship3)

    As no response was provided here, we went ahead and coded up a solution that provided this access via browser cookie. The change was made in lib/classes/saml_client.php (version 0.9.2 of the plugin) as an example of how it might be done (this has been tested and does work).

    in public function authenticate() – following this line:
    $attrs = $this->saml->getAttributes();

    We added the following 2 lines of code:

    $results = base64_encode(serialize($attrs)); // serialize and encode SAML Response
          $ckset = setcookie("saml-response",
                             $results,
                             0,    // expire with session
    		         "/");  // valid for all WP domain

    Accordingly, in our receiving WP page, we add the following code:

    if (isset($_COOKIE["saml-response"])) {
             $r= $_COOKIE["saml-response"];
             $saml_resp = unserialize(base64_decode($r));
           }

    Would you consider our contribution to the code base (or an alternative implementation of your choosing) so that future versions of your plugin will retain this functionality?

    Hi whiteship3;

    Its possible to enable the logs or a debug mode to verify the data coming from the IDP.?

    Regards

    Thread Starter whiteship3

    (@whiteship3)

    Hello @yanis97,
    I’m not sure if you’re asking me a general question, or suggesting that this might be a solution. When I was debugging this I would write out the $attrs string into a temp file. That would store the information for later viewing. However, using the filesystem is not an appropriate solution for this problem because it doesn’t handle concurrency very well (multiple users logging in at the same time would cause the file to be overwritten multiple times. Also, making separate files for each user/session would overly complicate matters and potentially impact performance).
    I am not aware of any debug mode or other mechanism that would solve this issue – nor would I want to run the system in debug mode in a production environment.

    Hi whiteship3;

    I would like to verify the data coming from the IDP for a session of a user : I’am on a test environment and I can use file system (no problem).
    My aim is to control the data between the IDP and my WP site if I have error connexion.

    Regards

    Thread Starter whiteship3

    (@whiteship3)

    If you’re asking how to see the data coming back in the SAML response, you can simply serialize the object (or use print_r) and write the $attr object into a file on the file system.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I access the SAML response object from outside the plugin?’ is closed to new replies.