I would like to customize community login page. At the same time I have enabled SSO authentication for the community.
Is it possible to add "SSO Login button" to the custom login page?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityRefer this link where it says
Login to Salesforce Org where the custom domain was configured as a Salesforce Administrator and navigate to Setup>>Domain Management>>My Domain. Once the "My Domain" page loads scroll down to the section titled "Login Page Branding" and click edit. Next to the "Authentication Service" section there are two check boxes Login Page and IdentityConnect. Ensure the IdentityConnect checkbox is checked if not check it and Save. Checking this box enables the Identity Connect SSO (Single Sign On) button to show on the domain login screen.
Better to use the getSamlSsoUrl from the AuthConfiguration class:
String communityUrl = '<Site URL of the Community>';
String startUrl = '/s';
Auth.AuthConfiguration authConfig = new Auth.AuthConfiguration(communityUrl, startUrl);
List<SamlSsoConfig> samlConfigList = [SELECT DeveloperName, Id FROM SamlSsoConfig WHERE DeveloperName = : 'SSO Unique Name'];
Id samlId = samlConfigList[0].Id;
String sso = Auth.AuthConfiguration.getSamlSsoUrl(communityUrl, startUrl, samlId);
system.debug(sso);
Find the answer by myself.
Go to the Setup -> Single Sign-On Settings
Open required SSO configuration and copy "Identity Provider Login URL" value.
Add regular apex:commandButton and action in the controller that returns Page reference to the "Identity Provider Login URL"