We're setting up SSO for our community. It currently works, in that if the user goes to the standard Salesforce login page they are presented with an option log in via SSO.
Which is cool.
But I want them to be able to log in via my custom Angular app sitting on a Visualforce page.
The function executed by the login via SSO button is something like this:
IdpOptions.useIdp(
'SingleSignOnName',
'https://myInstance.force.com/api/saml/authn-request.jsp?saml_request_id=[SAML request Id]&saml_acs=[login url]&saml_binding_type=HttpPost&Issuer=https%3A%2F%2FmyInstance.my.salesforce.com&samlSsoConfig=[configId]&RelayState=[relayState]'
);
How do I construct that in code? Javascript, Apex, Visualforce voodoo, I don't care which. Whatever it takes for me to generate that link with all the parameters for the user to log in via our custom app.
Here's what I have so far:
The missing components to that url are:
SAML request Id
login url
configId
relayState
The login url
itself has 2 paramters:
org Id
configId
I can store the configId
in a custom setting (get it from the url of the Single Sign-On Setting in Setup). Same goes for the org id
.
The relayState
is just the redirect location after the user is logged in.
So all I'm really looking for is how to generate the SAML request Id
. I'm still not entirely sure what it is.