Customer Portal

Get Involved. Join the Conversation.

Topic

    Anurag Mittal
    Create contact if no contact found during SSO Log-In on...Answered
    Topic posted March 29, 2016 by Anurag MittalGold Crown: 30,000+ Points, last edited September 19, 2018 by Anurag MittalGreen Ribbon: 100+ Points 
    340 Views, 7 Comments
    Title:
    Create contact if no contact found during SSO Log-In on customer portal
    Content:

    Hi All,

    I have enabled SSO on customer portal, how can I create contact if contact doesn't exist on OSvC side. I went through the doc and its says "Contact records cannot be created through the SSO process, so only existing customers can be logged in. (The public API can be used to create or update contacts if necessary.)"

    Does it mean before SAML insertion I have to check whether contact exist in OSvC or not, if not then create Contact using web service call and then do SAML insertion?? Or does it mean I have to create my own custom controller (instead of using standard OpenLogin.php) to create contact using ROQL based on subject of SAML??

    Can any one guide me on this....

    Regards,

    Anurag Mittal  

    Version:
    november 2015

    Best Comment

    Scott Harwell

    Yes, we have implemented this before, though I don't have the code in front of me currently.  It might have been the pre_pta_decode hook, even though the request is SAML, but I don't quite remember.  There is definitely a way to get it before the SAML action happens.

    See if the SAML assertion is in the post data (CI post array or $_POST), rather than the hook data in the pre_login hook.

    Comment

     

    • Scott Harwell

      You are correct.  You can use a pre_login hook to capture the SAML assertion and query CPHP to see if the record exists.  If not, then you can create the record using the data supplied in the assertion.  Then, once your hook completes, there would always be a record to associated the assertion with.

      The downsides to this are that you'll likely have limited data about the contact, maybe just email address.

    • Anurag Mittal

      Scott,

      Thanks for replying.

      pre_login hook don't give much info. It just send array('data' => array('source' => 'SAML')). I don't get SAML assertion. Have you tried this? Do you get full SAML assertion? 


       

    • Scott Harwell

      Yes, we have implemented this before, though I don't have the code in front of me currently.  It might have been the pre_pta_decode hook, even though the request is SAML, but I don't quite remember.  There is definitely a way to get it before the SAML action happens.

      See if the SAML assertion is in the post data (CI post array or $_POST), rather than the hook data in the pre_login hook.

    • Anurag Mittal

      Yes $_POST returns SAML in the pre_login hook.

      Thanks a lot for pointing this.

      Regards,

      Anurag Mittal

      • ridhima.khosla

        Hi Anurag,

        I have similar issue. I am not getting the SAML response values using $_POST. 

        Can you elaborate on how you got this resolved.

         

        Thanks,

        RK

    • Alok Gupta

      I tried setting up pre_login and can only see pre_login hook being called if the contact already exist inside the OSvC. Am I missing anything here? I get the following error if contact does not exist in the service cloud ...../error/error_id/saml18/subject/contact.emails.address

      Thanks!

    • Nadeem Ali

      Hey, I have got the same problem right now. and I also check the pre_login hook, but pre_login hooks work only when the contact already exists in the OSvC. but when that contact is not in OSvC how could we create it. because it did not hit the pre_login, so where could I write custom code to create contact.