0

I need a way to check if the user is signed in to the identity provider in the background.

We have a community that users interact with via an Angular app on a Visualforce page. We have it set up so they can log in via username\password or SSO from our identity provider.
If the user is logged in I can tell and then change the UI to display their name instead of the Login button.

However, if the user is already logged in to the identity provider, I can't really tell in Salesforce that they're logged in, because they have no active session yet.
If the user is already logged in to the identity provider, we would like to silently log them in to our community.

Now, I could make a call to Auth.AuthConfiguration.getSamlSsoUrl(communityUrl, startUrl, samlId) and return a PageReference and that will log the user in. But that is a bad user experience because it removes them from the page they want to view.

So how can I send a SAML request to the identity provider in the background, just to see if the user is logged in? And then silently log them in?

0

Turns out that this is impossible, and I had misunderstood the scope of the task.

Specifically, when a user navigates to the users only section of the Angular app, instead of prompting them for login credentials just immediately send the SSO request via

String ssoUrl = Auth.AuthConfiguration.getSamlSsoUrl(communityUrl, startUrl, samlId);
PageReference pageRef = new PageReference(ssoUrl);
return pageRef;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.