Bỏ qua để đến nội dung

Checkpoint challenge

Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.

Original, hands-on practice. Never modeled on actual exam questions. This closes the chapter Customers and Partners, chapter 14 of Securing Salesforce: Identity and Access.

Your two lab orgs already do single sign-on for staff: Priya logs in at the identity provider org and lands in the service provider org (chapters 6, 7 and 12). Now the service provider org opens its doors to outsiders.

In part 1, you build a site, and a customer, Amara Nwosu, registers herself. In part 2, the identity provider org plays a partner company’s identity provider, and its person, Tomás Reyes, signs in to the site with his company’s login. Just-in-time makes his contact. Then you see what matching on email alone can do.

  • A site in the service provider org, with a narrow profile for outsiders.
  • Self-registration: Amara registers, verifies her email, and lands on the right account.
  • A partner’s identity provider: Tomás logs in through the identity provider org, and just-in-time makes his user and contact on the partner’s account.
  • The email risk seen: a second person matched to the wrong contact.
  • Tomás leaves: his user disabled.
  • Lab orgs only. No company data, nothing personal. For the email steps, use an address you control, with a + alias if your mail service supports it.
  • Never for an admin. Both admins keep a password and MFA, and never use single sign-on.
  • No standard profiles for outsiders: Salesforce won’t let you (S5), and you shouldn’t want to.

1. Turn on Digital Experiences in the service provider org. From Setup, Digital Experiences, Settings: enable it and accept the domain it offers. These are the steps as Salesforce documents them; this course hasn’t yet run them in a new Developer Edition org.

2. Make a site. From Setup, All Sites, New. Choose a template, name it “Lab Customers”, and let Salesforce create it. Note its address: it ends in my.site.com/labcustomers or similar. That’s the site URL you’ll need in part 2. This course hasn’t yet checked which templates a new Developer Edition org offers.

3. Get the records ready. Three things, in the service provider org:

  • An account for strangers: create a business account, “Self-registered customers”. Its owner must be a user with a role (S5): give your admin a role if it has none.
  • A partner’s account: create “Partner Lab Co”, with Account Number PLC-001.
  • A profile for outsiders: clone the External Identity User profile, or a Customer Community User profile, and name it “Lab Outsider” (S13). Five External Identity licenses come with a Developer Edition org (module 1); this course hasn’t yet checked which other Experience Cloud licenses do.

In the site’s Workspaces, Administration, Members, add “Lab Outsider”. Only members can log in (S5).

4. Turn on self-registration. In Workspaces, Administration, Login & Registration (S13):

  • Select Allow customers and partners to self-register.
  • Registration Page Type: Configurable Self-Reg Page.
  • User Fields: Email, First Name, Last Name.
  • Configurable Self-Reg Handler: click Create a configurable self-reg handler.
  • Execute Registration As: your admin. (In production, a system user, never a person: module 4.)
  • Verification Method: Email.
  • Include Password: selected.
  • Profile: Lab Outsider.
  • Account: Self-registered customers.

Save, then publish the site and activate it.

5. Look at the handler. Setup, Apex Classes: find the class whose name starts with AutocreatedConfigSelfReg (S13). Read it. Where does it set the profile and the account? That’s where a real one would check for an existing contact (module 4).

6. Be the stranger. In a private window, open the site’s login page and click to register. Sign up as Amara Nwosu, with your email address. A code arrives by email; enter it, and set a password. You’re in. This course hasn’t yet tried the verification email in a Developer Edition org.

7. See where she landed. As the admin: find Amara’s contact. It’s on “Self-registered customers”. Open her user: profile Lab Outsider, an Experience Cloud license, and the site as her way in.

8. A SAML setting for the site, in the service provider org. From Setup, Single Sign-On Settings, New. Use the identity provider org’s certificate and Issuer from chapter 6. Then, the parts that are the site’s own (S10):

  • Entity ID: the site URL from step 2.
  • SAML Identity Type: Assertion contains the Federation ID from the User object.
  • User Provisioning Enabled: selected; User Provisioning Type: Standard.

Save. On its detail page, under Endpoints, find the Site Login URL for Lab Customers: https://…/login?so=… (S10). Note it. This course hasn’t yet tested which login URL a second app needs, or exactly where the Site Login URL appears on the page.

9. A second app in the identity provider org. Copy chapter 7’s project folder, and rename ServiceProviderOrg to PartnerSite in all three app files and their file names. In the SAML policy file:

  • entityUrl: the site URL (step 2).
  • acsUrl: the Site Login URL (step 8).
  • commaSeparatedPermissionSet: a new permission set, “Partner site login”.

And before the closing tag, the attributes just-in-time needs for a site: the user’s, the contact’s and the account’s, each with its prefix (S10):

<customAttributes>
<key>User.Email</key>
<formula>$User.Email</formula>
</customAttributes>
<customAttributes>
<key>User.LastName</key>
<formula>$User.LastName</formula>
</customAttributes>
<customAttributes>
<key>User.ProfileId</key>
<formula>"Lab Outsider"</formula>
</customAttributes>
<customAttributes>
<key>User.Username</key>
<formula>$User.FederationIdentifier &amp; ".YOUR-SUFFIX@partnerlab.example"</formula>
</customAttributes>
<customAttributes>
<key>Contact.Email</key>
<formula>$User.Email</formula>
</customAttributes>
<customAttributes>
<key>Contact.LastName</key>
<formula>$User.LastName</formula>
</customAttributes>
<customAttributes>
<key>Account.AccountNumber</key>
<formula>"PLC-001"</formula>
</customAttributes>
<customAttributes>
<key>Account.Name</key>
<formula>"Partner Lab Co"</formula>
</customAttributes>

Deploy it, as in chapter 7. Salesforce documents Contact and Account attributes beside User ones in one assertion (S11); this course hasn’t yet tested that they deploy as custom attributes.

10. Put the button on the login page. Back in the site’s Login & Registration, under Login Page Setup, select the SAML setting from step 8 as a login option (S7). Save, and publish.

11. Make Tomás, in the identity provider org only. A user, Tomás Reyes, with an email address you control (a different + alias), and Federation ID T20117. Assign him “Partner site login”.

12. His first login. In a private window with your SAML tracer on, open the site’s login page and click the button for the identity provider org. Sign in as Tomás. You land on the site.

In the tracer, find the assertion: its Recipient is the Site Login URL, and its Attributes have User., Contact. and Account. prefixes. As the service provider org’s admin, find Tomás: a new contact on Partner Lab Co, found by its account number (step 3 of module 3’s four places), and his user on it.

13. The email risk. In the identity provider org, make one more user, Mia, with Federation ID T20118 and the same email address you gave Amara, and assign her “Partner site login”. Log in to the site as Mia, through the identity provider org.

Now look in the service provider org. There’s no user with Mia’s Federation ID, so just-in-time looked for a contact with her email, and found Amara’s (S10). Mia’s user is on Amara’s contact, on “Self-registered customers”, not on the partner’s account. Nobody at the partner meant any harm. The identity provider sent an email, and Salesforce believed it. That’s the match order Salesforce documents (S10); this course hasn’t yet watched it happen in an org.

Deactivate Mia. This is module 3’s reason for a custom handler per partner.

14. Tomás leaves. In the identity provider org, deactivate Tomás. He can’t log in to the site any more. But in the service provider org, his user is still active. On his contact, choose Disable User (S4). Open the user: deactivated, and the username changed (S4).

Why did Amara land on “Self-registered customers”? Because you chose it as the account in step 4. Every stranger lands there, so it must never be a real customer’s account.

Why did Tomás’s contact land on Partner Lab Co? No user had his Federation ID, no contact had his email, and the account number PLC-001 matched an account (S10). Without that account, Salesforce would have made a new one.

What went wrong with Mia, and what would stop it? The contact was matched on email alone (S10). A custom JIT handler for this partner’s setting would only ever match contacts on Partner Lab Co, and would put every new user there (module 3).

Why was Tomás still active after the partner switched him off? The partner’s identity provider stops his logins, not his user. Leaving has to reach you separately (module 5).

Which way in would you give Amara if she didn’t want another password? Social sign-on, on the same login page (module 2; chapter 10).

  • The site: Lab Customers, with Lab Outsider as a member profile.
  • Amara: self-registered, verified, a contact on Self-registered customers.
  • Tomás: a contact and a user on Partner Lab Co, made at his first login, with Federation ID T20117.
  • Mia: matched to Amara’s contact, then deactivated, and you can say why it happened.
  • Tomás leaves: his user disabled from the contact.
  • COM-2 (external identity providers in sites, and the user and contact model): parts 1 and 2.
  • TPI-2 (provisioning in B2C and B2B): self-registration and just-in-time for a site.
  • SID-3 (identity license types): the profile and license an outsider lands on.