Lewati ke konten

Connect the Two Orgs

Konten ini belum tersedia dalam bahasa Anda.

Lab for chapter 7, Salesforce as the Identity Provider, in Securing Salesforce: Identity and Access. The practice asks why each of these steps matters; this page is how to do them.

You’ll buildThe identity provider’s half of single sign-on: the service provider org registered as a SAML external client app, Priya allowed to use it, and two working logins, one from each side
TimeAbout 60 minutes (measured in the lab test, November 2026)
OrgBoth orgs: the identity provider org for the app and Priya’s access, the service provider org for the logins and the checks
Start fromThe end of chapter 6’s lab: the service provider’s SAML setting, Priya’s Federation ID E10442 there, the login page button, and your pairs page
FilesThree small metadata files you make yourself (step 4). Nothing to download from us
You needThe Salesforce CLI (sf), your authenticator app for the admins’ logins, and Chrome (or another browser with developer tools)
TestedWinter ‘27, November 2026
  • Log in to both orgs as the admin, in two tabs of your normal browser, and check the logos. Every step says which org it’s in.
  • Open your pairs page from chapter 6. You’ll fill in the blanks at the end.
  • Install the Salesforce CLI if you don’t have it: Install the Salesforce CLI (opens in a new tab).

Step 1: Give Priya her Federation ID in the identity provider org

Section titled “Step 1: Give Priya her Federation ID in the identity provider org”
  1. In the IdP org, from Setup, in Quick Find, enter Users, select Users, then Priya Sharma, and Edit.

  2. Under Single Sign On Information, set Federation ID to E10442, the same as in the service provider org, and select Save.

    Priya's user record in the identity provider org: username, time zone, locale, and Federation ID E10442.

    The same Federation ID as in the service provider org; a different username (Salesforce, Setup in a Developer Edition org, screenshot, November 2026). Full size

The identity provider sends this value for its Priya; the service provider looks for a user with the same value. Her usernames are different in each org and always will be.

In the IdP org, from Setup, in Quick Find, enter External Client App, then select External Client App Manager.

You should see “Nothing to show yet”, and a New External Client App button. There’s nothing to turn on first: in the lab test, external client apps were already available in a new Developer Edition. The Settings page beside it has four switches, none of them an opt-in; leave them as they are.

External Client App Manager in a new org: Nothing to show yet, and the New External Client App button.

Nothing to turn on first: the button is already there (Salesforce, Setup in a Developer Edition org, screenshot, November 2026). Full size

  1. In the IdP org, from Setup, in Quick Find, enter Permission Sets, select Permission Sets, then New.

  2. Label: SSO to the service provider org. Description: Who may use single sign-on from this org into the service provider org (lab). License: leave —None—. Select Save.

  3. Select Manage Assignments, Add Assignment, tick Priya Sharma, Next, keep No expiration date, and select Assign.

  4. Note the permission set’s ID from the address bar: it starts with 0PS. Or ask the CLI (step 5 logs it in):

    Terminal window
    sf data query -q "SELECT Id FROM PermissionSet WHERE Label = 'SSO to the service provider org'" -o idp-org

On your computer, make a folder, for example saml-eca-lab, with the five files from the practice, step 5: sfdx-project.json, package.xml, and the three files under force-app/main/default/. Copy them exactly.

In the SAML file, replace the three capitals:

In the fileYour valueWhere it comes from
SP_ENTITY_IDhttps://bluefin-lab-sp-dev-ed.develop.my.salesforce.comThe service provider’s setting, Entity ID (chapter 6, step 4)
SP_ACS_URLhttps://bluefin-lab-sp-dev-ed.develop.my.salesforce.comThe service provider’s Endpoints, Login URL (chapter 6, step 4)
PERMISSION_SET_ID0PS…Step 3

In the lab test, both addresses were the service provider org’s My Domain address, exactly as above with your own name in it.

  1. In a terminal, in the project folder, log the CLI in to the IdP org as its admin. A browser window opens: log in there, with MFA.

    Terminal window
    sf org login web --alias idp-org --instance-url https://bluefin-lab-idp-dev-ed.develop.my.salesforce.com
  2. Deploy:

    Terminal window
    sf project deploy start --manifest package.xml -o idp-org

    You should see Status: Succeeded and three components Created: the app, its policies, and its SAML policies.

  3. In External Client App Manager, refresh: ServiceProviderOrg is there, Local, Enabled.

Watch out. In the lab test (Winter ‘27, November 2026) the deploy succeeded with no warning, but the permission set in the SAML file was not applied: the app’s Selected Permission Sets stayed empty, so Priya couldn’t use it. Step 6 adds it by hand. Check it every time.

Step 6: Give Priya the app, and read its SAML values

Section titled “Step 6: Give Priya the app, and read its SAML values”
  1. In External Client App Manager, open ServiceProviderOrg, and select the Policies tab, then Edit.

  2. Under App Policies, Select Permission Sets, move SSO to the service provider org to Selected Permission Sets, and select Save.

    The app's Policies in edit: Select Permission Sets, with SSO to the service provider org moved to Selected Permission Sets.

    Who may use the app. In the lab test, this had to be added here after the deploy (Salesforce, Setup in a Developer Edition org, screenshot, November 2026). Full size

  3. On the same tab, open SAML Policies and check the values against your pairs page: Entity ID and ACS URL (the service provider’s address), Subject Type Federation ID, Signing Algorithm SHA256, IdP Certificate Default IdP Certificate. Issuer is empty: it defaults to this org’s My Domain address, which the service provider already trusts.

  4. Open SAML Login Info and copy the IdP-Initiated Login URL: https://bluefin-lab-idp-dev-ed.develop.my.salesforce.com/idp/login?app= and the app’s ID. You need it in step 9.

    The app's SAML Login Info: Download Metadata, the IdP-Initiated Login URL ending /idp/login?app= and the app's ID, the SP-initiated POST and Redirect endpoints, the Metadata Discovery Endpoint and the Single Logout Endpoint.

    The IdP-Initiated Login URL starts the login from this org (Salesforce, Setup in a Developer Edition org, screenshot, November 2026). Full size

You can read and change every SAML value here; the CLI retrieve isn’t needed to see them.

Step 7: The first login, from the service provider

Section titled “Step 7: The first login, from the service provider”
  1. Open a private window, then the developer tools (in Chrome: View, Developer, Developer Tools), and select Network. Tick Keep log, so the list survives the pages changing.

  2. Go to your SP org’s address and select Log in with IdP org.

    You should see the IdP org’s login page: “To access this page, you have to log in to Salesforce.”

  3. Log in as Priya, with her IdP username and password. A private window is a new browser, so Salesforce may email a code (device activation); enter it.

  4. Salesforce may ask again, this time for the SP org: a second emailed code. Enter it.

    You should see the SP org’s home page, with its logo: “Good morning, Priya.”

    The service provider org's Seller Home, with its SP logo: Good morning, Priya. Let's get selling!

    Which org? The logo says the service provider. Who? Priya (Salesforce, a Developer Edition org, screenshot, November 2026). Full size

Ask the two questions: which org are you in, and who are you logged in as? The logo says the service provider; the name says Priya: the service provider’s Priya, found by her Federation ID.

Tip. In a new browser, single sign-on asked for two emailed codes: one at the identity provider, then one at the service provider. The service provider’s SAML Assertion Validator (step 11) shows why: Priya proved herself with a password and an emailed code, which Salesforce counts as weak, and only a strong method in the answer lets the service provider skip its own check.

  1. In the Network list, type method:POST in the Filter box, then select Doc. Only a few rows are left.

  2. Select the row named after your SP org’s address, status 302. Its Headers show the Request Method POST, and Origin the IdP org’s address: the browser carried the answer from the identity provider’s page.

  3. Select Payload. You see RelayState and SAMLResponse, a long block of letters and numbers: the answer, encoded.

    Chrome developer tools, the POST to the service provider, Payload tab: Form data with RelayState and SAMLResponse, and View source. The SAMLResponse value is hidden.

    The answer travels as SAMLResponse in a form the browser posts. Its value is hidden here (Google Chrome developer tools, showing a Salesforce Developer Edition org, screenshot, November 2026). Full size

Watch out. Open only the row named after the service provider. The row named after the identity provider is Priya’s login form, and its payload holds her password. And hide the value of anything named sid before you share a screenshot: it’s a session ID.

  1. To read the answer, select view source, copy everything after SAMLResponse=, and decode it from Base64 with any tool you trust on your own computer (on a Mac, pbpaste | base64 -D). It’s XML. Find these and check them against your pairs page:

    In the answerIn the lab testThe pair
    Issuerthe IdP org’s addressWho’s speaking
    Audiencethe SP org’s addressWho it’s for
    Recipient and Destinationthe SP org’s address, the Login URLWhere answers go
    ds:Signature, twiceRSA-SHA256, with the IdP’s self-signed certificate insideHow to check it
    NameIDE10442Who it is

    It’s valid for a few minutes only: in the lab test, from 30 seconds before it was made to 5 minutes after.

Tip. The identity provider sends more than the NameID. With no attributes set up, Salesforce’s answer also carried Priya’s identity provider user ID, username and email address. Know what crosses to the service provider.

  1. In the private window, Priya is still logged in at the identity provider. Paste the IdP-Initiated Login URL from step 6 into the address bar.

    You should see the SP org’s home page as Priya (perhaps after an emailed code).

  2. In the IdP org, as Priya, open the App Launcher and search for ServiceProviderOrg.

    You should see, in the lab test: No results.

Tip. In the lab test, the app didn’t appear in Priya’s App Launcher, though she had it through her permission set. The IdP-Initiated Login URL from the app’s SAML Login Info worked.

Step 10: Log out of one org, and look at the other

Section titled “Step 10: Log out of one org, and look at the other”
  1. In the private window, in the SP org, select Priya’s picture and Log Out.

    You should see the SP org’s own page, Log In Using, with Log in with IdP org and Log In with a Different Account.

  2. In the same window, go to your IdP org’s address.

    You should see the IdP org’s home page, as Priya, with no login.

    The identity provider org's Seller Home, with its IdP logo: Good morning, Priya.

    After logging out of the service provider, Priya is still logged in here (Salesforce, a Developer Edition org, screenshot, November 2026). Full size

Logging out of the service provider didn’t log Priya out of the identity provider. That’s module 4’s point: without single logout, each org keeps its own session. If you’d left Single Logout Enabled ticked in chapter 6, this step would end on the identity provider’s “Logout Error” page instead.

You’ll make the Federation IDs differ only in a capital letter, and watch what the setting from chapter 6 does. Use the admin tab for the changes, and the private window, where Priya is still logged in at the identity provider, for the logins.

  1. In the SP org, change Priya’s Federation ID to e10442, lower case (Users, Priya Sharma, Edit).

  2. In the private window: Log Out in the SP org, then paste the IdP-Initiated Login URL again. Priya is still logged in at the identity provider, so you go straight in.

    You should see the SP org’s home page: Make Federation ID case-insensitive is on, so the case doesn’t matter.

  3. In the SP org, Single Sign-On Settings, Edit, untick Make Federation ID case-insensitive, and Save.

  4. Repeat step 2.

    You should see “Single Sign-On Error. We can’t log you in because of an issue with single sign-on. Contact your Salesforce admin for help.”

  5. In the SP org, Single Sign-On Settings, select SAML Assertion Validator.

    You should see Last recorded SAML login failure, with the time, and every check Ok, and at the end, Subject: E10442.

    The SAML Assertion Validator's results for the last failed login: every check Ok or Not Provided, with step 2 showing ACR (Weak) Password and AMR (Weak) Email, pwd.

    Every check passed: the problem wasn’t the answer (Salesforce, Setup in a Developer Edition org, screenshot, November 2026). Full size

  6. Put it back: Priya’s Federation ID E10442, and Make Federation ID case-insensitive ticked again.

Watch out. A Federation ID that differs only in capital letters logs in with Make Federation ID case-insensitive on and fails with it off. The error page says only that there’s “an issue with single sign-on”, and Login History shows nothing for Priya: no user matched, so there’s nobody to log it against.

Tip. When single sign-on fails, open the SAML Assertion Validator in the service provider: it keeps the last failed answer and checks it. If every check is Ok, the answer isn’t the problem: compare its Subject with your users’ Federation IDs.

Fill in the identity provider’s side of every pair, and where each value lives:

PairService provider (chapter 6)Identity provider (this lab)
Who’s speakingIssuer in the settingThis org’s My Domain address (the app’s Issuer, left empty)
Who it’s forEntity IDThe app’s Entity ID
Where answers goLogin URL in EndpointsThe app’s ACS URL
How to check itThe IdP’s certificate, from the metadataDefault IdP Certificate, on the Identity Provider page
Where to send peopleIdentity Provider Login URLThe app’s SP-initiated endpoints, in SAML Login Info
Who it isPriya’s Federation ID E10442Priya’s Federation ID E10442, Subject Type Federation ID
  • ServiceProviderOrg is in External Client App Manager, deployed from your three files.
  • Its Selected Permission Sets has SSO to the service provider org, and Priya has the permission set.
  • Priya has E10442 in both orgs, and Make Federation ID case-insensitive is ticked in the SP org.
  • Priya logged in from the SP org’s button and landed in the SP org as Priya.
  • You checked the answer’s Issuer, Audience, Recipient and NameID against the pairs.
  • Both admins still log in with a password and MFA.
  • The pairs page has no blanks.

From the lab test, November 2026:

  • The deploy succeeded but Priya gets an error at the identity provider. The permission set wasn’t applied: add it on the app’s Policies tab (step 6).
  • “Single Sign-On Error” at the service provider. Open SAML Assertion Validator (step 11). If every check is Ok, compare the Subject with Priya’s Federation ID in the SP org, letter by letter.
  • “Logout Error” at the identity provider. Single Logout Enabled is still ticked in the service provider’s setting: untick it (chapter 6, step 4).
  • The app isn’t in the App Launcher. Use the IdP-Initiated Login URL (step 9).
  • No row in the Network list. Keep log wasn’t ticked, or the developer tools were opened after the login: start again in a new private window.
  • You changed something in the wrong org. Check the logo, change it back.

Keep everything. Later chapters use both orgs again. Log Priya out when you’re done, and close the private window.

One org vouched for Priya, and the other believed it. The identity provider signed an answer that said who’s speaking, who it’s for, where it goes and who it is; the service provider checked every one of those against what it already knew from chapter 6, and found its own Priya by a Federation ID that both sides keep the same. You watched the answer cross in the browser, you read it, and you broke it with one capital letter. And through all of it, both admins still had their own way in.

Next lab: chapter 8, See Scopes Work.