Hi I created a controller for vf page used in community where in user will be redirected to a a certain Interact page, now in the Interact page there is a login button where in User will be prompted to an SSO SAML login page, If successful user will now be redirected to the community home page.

My issue is, once user successfully logged in the SSO SAML login page, in the same browser and tried to access the community, I want him to be redirected to the community home page.

Is there anyway we can get the SAML Response and use it in the controller to check if user allready logged in the SSO SAML so no need to redirect in the Interact page.

This is my controller code so far.

This is my goal. Scenario 1 *User access community URL *Redirected to interact page. *Click login button - Redirected to SSO SAML login page *Once logged in - Redirected to Community Home Page.

Scenario 2 *User allready logged in SSO SAML Login page in same browser *User access community URL *User redirected to Community Home Page - Not Interact Page

 * An apex page controller that exposes the site login functionality of Physician Dashboard Community

global with sharing class PC_Roche_Physician_Dashboard_Controller {

    global PC_Roche_Physician_Dashboard_Controller(){}

    global pageReference forwardToPage(){
      System.debug('CURRENTPAGEREFERENCE>>>>>' + System.currentPageReference());
      System.debug('USERINFOTYPE' + Userinfo.getUserType());
      if(Userinfo.getUserType() == 'Guest'){
        return new PageReference(Site.getPathPrefix() + '/s/rocheinteract');
       return new PageReference('');
  • You can redirect the user to the home page from the ELSE part in your code. If the user is already logged in, the user type will not be Guest. – Aayush K Jan 24 at 18:22

Your Answer

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

Browse other questions tagged or ask your own question.