0

I am reaching out to know whether I can use URL.getCurrentRequestUrl().getQuery() API in Custom Connected App Handler Class to extract parameters passed in IDP URL (when browser is redirected to idp url). I am using Salesforce as a SAML IDP.

I am sure my next question will be whether I can pass parameters in IDP url or not. Thanks in advance...

We don't want to store these parameters/attributes in Salesforce and we want to add these parameters in SAML Reponse.

1 Answer 1

1

Here is the scenario I tried:

  • Used Salesforce as SAML IDP.
  • Created connected app (SF to SF) with SAML enabled and configured. One SF org as IDP and another as SP
  • Created APEX plugin class in SF IDP Org to modify response to add attributes passed in IDP url (Doesn’t exists in User Object)
  • Used URL.getCurrentRequestUrl().getQuery() to capture attributes passed as query string parameter in APEX plugin class.
  • Performed log in using IDP url with additional attributes passed.
  • Logs enabled to capture activity of code execution. Modify response method called in Apex Plugin class, retrieved user and executed URL.getCurrentRequestUrl().getQuery() API. Result:
  • Returned URL.getCurrentRequestUrl() as Salesforce Instance URL.
  • URL.getCurrentRequestUrl().getQuery() returned NULL values.

Conclusion: We cannot pass attributes in SF IDP URL which doesn't exists in SF. This method cannot be used in Connected App handler APEX class. This make more sense when used in APEX Controller in context with VF page where you want to capture query string of current request.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .