This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, go to https://wso2.com/documentation/.

Logging in to Salesforce using the Identity Server

This topic provides instructions on how to log into Salesforce using your WSO2 Identity Server credentials.

Configuring Salesforce

  1. Sign up as a Salesforce developer.
    1. Fill out the relevant information found in the following URL: https://developer.salesforce.com/signup
    2. Click Sign me up.
    3. You will receive a security token by email to confirm your new account. If you did not receive the email successfully, you will be able to reset it by following the steps given here.
  2. Log in with your new credentials as a Salesforce developer. Do this by clicking Login link in the top right hand side of https://developer.salesforce.com/.
  3. Click Allow to enable Salesforce to access your basic information.
  4. Once you are logged in, create a new domain and access it. To do this, do the following steps.
    1. Go to Domain Management in the left navigation pane and click My Domain.
    2. In the page that appears, come up with a name for your domain. You can check if the domain is available by clicking the Check Availability button.
    3. Check and agree with the Terms and Conditions before clicking Register Domain to register your new domain.

      Tip: The registration process may take some time. Use this time to get familiar with Salesforce and read through the Salesforce developer documentation.

    4. Once the domain is registered to your account, click the Click here to login button to test this out.
  5. On the left navigation menu, go to Security Controls and click Single Sign-On Settings.
  6. In the page that appears, click Edit and then select the SAML Enabled checkbox to enable federated single sign-on using SAML.
  7. Click Save to save this configuration change.
  8. Click New under SAML Single Sign-On Settings. The following screen appears.
    Ensure that you configure the following properties.

    FieldValue
    NameSSO
    API NameSSO
    Issuerlocalhost
    Entity Idhttps://saml.salesforce.com
    Identity Provider Certificate

    wso2.crt

    Note: To create the Identity Provider Certificate, open your Command Line interface, traverse to the <IS_HOME>/repository/resources/security/ directory. Next you must execute the following command.

    keytool -export -alias wso2carbon -file wso2.crt -keystore wso2carbon.jks -storepass wso2carbon

    Once this command is run, the wso2.crt file is generated and can be found in the <IS_HOME>/repository/resources/security/ directory. Click Choose File and navigate to this location in order to obtain and upload this file.

    Request Signing CertificateDefault Certificate
    Request Signature MethodRSA-SHA1
    Assertion Decryption CertificateAssertion not encrypted
    SAML Identity Type

    Assertion contains User's salesforce.com username

    SAML Identity Location

    Identity is in the NameIdentifier element of the Subject statement

    Identity Provider Login URLhttps://localhost:9443/samlsso
    Identity Provider Logout URLhttps://localhost:9443/samlsso
    Custom Error URLLeave blank

    Service Provider Initiated Request Binding

    HTTP POST
    User Provisioning EnabledLeave blank
  9. Click Save to save your configurations.
  10. Go to Domain Management in the left navigation pane and click My Domain.
  11. Click Deploy to Users. Click Ok to the confirmation message that appears.
  12. In the page that appears, you must configure the Authentication Configuration section. Scroll down to this section and click Edit.
  13. Under Authentication Service, select SSO instead of Login Page.
  14. Click Save.

Configuring the Identity Server

  1. Sign in. Enter your username and password to log on to the Management Console
  2. Navigate to the Main menu to access the Identity menu. Click Add under Service Providers.
  3. Fill in the Service Provider Name and provide a brief Description of the service provider. Only Service Provider Name is a required field and we use Salesforce as the name for this example.
  4. Click Register.
  5. Expand the Inbound Authentication Configuration and the SAML2 Web SSO Configuration and click Configure.
  6. In the form that appears, fill out the following configuration details required for single sign-on.

     See the following table for details.

    FieldValueDescription
    Issuerhttps://saml.salesforce.comThis is the <saml:Issuer> element that contains the unique identifier of the service provider. This is also the issuer value specified in the SAML Authentication Request issued by the service provider. When configuring single-sign-on across Carbon servers, ensure that this value is equal to the ServiceProviderID value mentioned in the <IS_HOME>/repository/conf/security/authenticators.xml file of the relying party Carbon server.
    Assertion Consumer URLhttps://identityprovisioning-dev-ed.my.salesforce.com?so=00D90000000ySEnThis is the URL to which the browser should be redirected to after the authentication is successful. This is the Assertion Consumer Service (ACS) URL of the service provider. The identity provider redirects the SAML2 response to this ACS URL. However, if the SAML2 request is signed and SAML2 request contains the ACS URL, the Identity Server will honor the ACS URL of the SAML2 request. In this case, you must use your Salesforce login URL. In Salesforce, click Security Controls on your left menu and then click Single Sign-On Settings. In the page that appears, click on the SSO settings that you created to view the details. Use the Salesforce Login URL listed there for this value.
    NameID FormatThe default value can be used here.This defines the name identifier formats supported by the identity provider. The service provider and identity provider usually communicate with each other regarding a specific subject. That subject should be identified through a Name-Identifier (NameID) , which should be in some format so that It is easy for the other party to identify it based on the format. Name identifiers are used to provide information regarding a user.
    Use fully qualified username in the NameIDSelectedA fully qualified username is basically the user name with the user store domain. In short, the username must be in the following format: {user store domain}{user name}.
    Enable Response SigningSelected

    Select Enable Response Signing to sign the SAML2 Responses returned after the authentication process.

    Enable Assertion SigningSelected

    Select Enable Assertion Signing to sign the SAML2 Assertions returned after the authentication. SAML2 relying party components expect these assertions to be signed by the Identity Server.

    Enable Attribute ProfileSelectedSelect Enable Attribute Profile to enable this and add a claim by entering the claim link and clicking the Add Claim button. The Identity Server provides support for a basic attribute profile where the identity provider can include the user’s attributes in the SAML Assertions as part of the attribute statement. Once you select the checkbox to Include Attributes in the Response Always, the identity provider always includes the attribute values related to the selected claims in the SAML attribute statement.
  7. Click Register to save your configurations.
  8. Since Salesforce user names are actually email addresses, we must configure the Identity Server for email authentication. Do the following steps to achieve this.

    1. Open the <IS_HOME>/repository/conf/carbon.xml file and make the following change to the configuration.

      <EnableEmailUserName>true</EnableEmailUserName>
    2. Open the <IS_HOME>/repository/conf/user-mgt.xml file and add the following properties under the user store manager configurations. Using the first property, you can change the pattern of your email address. By default it must be more than 3 characters and less than 30, but you can configure it as you wish.

      <Property name="UsernameWithEmailJavaScriptRegEx">[a-zA-Z0-9@._-|//]{3,30}$</Property>
      <Property name="UsernameJavaRegEx">a-zA-Z0-9@._-{3,30}$</Property>
  9. Restart the Identity Server.

Testing the configurations

Do the following steps to test out the configurations for a new user in Salesforce and the Identity Server.

  1. Once you log into the Identity Server, navigate to the Main menu in the Management Console, click Add under Users and Roles.
  2. Click Users. This link is only visible to users with the Admin role. 
  3. Click Add New UserWhen adding a new user, use an email address as the username.
  4. Navigate back to the Main menu in the Management Console and click Add under Users and Roles.
  5. Click Roles. This link is only visible to users with the Admin role. 
  6. Click Add New Role

    When adding a new role, do the following.
    1. In the Domain list, specify the user store where you want to create this role. In this case, use the default user store that comes with the Identity Server.
    2. Enter a unique name for this role. Use Force here for example.
    3. Click Next.
  7. Select the permissions you want users with this role to have. Note that when you assign this role to a user, you can override the role's permissions and customize them for the user. For our example, providing login permissions should suffice.
     
  8. Click Next.
  9. Select the existing users you want to have this role. You can also assign this role to users later, but if you are creating this role in an external user store that does not allow empty roles, you must assign it to at least one user. You can search for a user by name, or view all users by entering * in the search field. In this case, select the user with the username as the email address that you created earlier.
     
  10. Click Finish.
  11. Log back into your Salesforce developer account.
  12. On the left navigation pane, click Users under Manage Users.
  13. On the page that appears, click the New User button to create a new user.
  14. Create a user with the same username as the one you created in the Identity Server. Click Save to save your changes. An email will be sent to the email address you provided for the user.
  15. Access your Salesforce login URL. For this example, the Salesforce login URL is https://identityprovisioning-dev-ed.my.salesforce.com?so=00D90000000ySEn. You are directed to the Identity Server login screen.
  16. Log in using the new credentials of the user you just created. You are then redirected back to Salesforce.