Video není dostupné.
Omlouváme se.

Using AWS Amazon Cognito as CIAM for Salesforce Experience Cloud through OIDC

Sdílet
Vložit
  • čas přidán 13. 02. 2023
  • Use AWS Amazon Cognito as your CIAM for Salesforce Experience Cloud customer identity and access management through the use of Auth. Provider configuration using Open Identity Connect (OIDC)

Komentáře • 4

  • @nishigandhadhananjay7740

    very useful information. Thanks

  • @BeFitWithMaha
    @BeFitWithMaha Před rokem

    Created OpenID in Salesforce, and configured client app in Cognito, I Am getting an error when signing up the user, can you share full apex class file?

    • @JFoxUK
      @JFoxUK  Před 11 měsíci

      Sorry for the dely!
      //TODO:This autogenerated class includes the basics for a Registration
      //Handler class. You will need to customize it to ensure it meets your needs and
      //the data provided by the third party.
      global class AutocreatedRegHandler1693466627425 implements Auth.RegistrationHandler{
      global User createUser(Id portalId, Auth.UserData data){
      User u = new User();
      if(data.attributeMap.containsKey('sfdc_networkid')){
      Account a = [SELECT Id FROM Account LIMIT 1];
      Contact c = new Contact();
      c.accountId = a.id;
      c.email = data.email;
      c.firstname = data.firstName;
      c.lastname = data.lastName;
      insert c;
      Profile p = [SELECT Id FROM profile WHERE name='Customer Community Login User'];
      //TODO: Customize the username. Also check that the username doesn't already exist and
      //possibly ensure there are enough org licenses to create a user. Must be 80 characters
      //or less.
      u.username = data.attributeMap.get('username') + '@myorg.com';
      u.email = data.email;
      u.lastName = data.lastName;
      u.firstName = data.firstName;
      String alias = data.attributeMap.get('username');
      //Alias must be 8 characters or less
      if(alias.length() > 8) {
      alias = alias.substring(0, 8);
      }
      u.alias = alias;
      u.languagelocalekey = 'en_US';
      u.localesidkey = 'en_US';
      u.emailEncodingKey = 'UTF-8';
      u.timeZoneSidKey = 'America/Los_Angeles';
      u.profileId = p.Id;
      u.contactId = c.Id;
      } else {
      //other logic
      }
      return u;
      }
      global void updateUser(Id userId, Id portalId, Auth.UserData data){
      User u = new User(id=userId);
      //TODO: Customize the username. Must be 80 characters or less.
      //u.username = data.username + '@myorg.com';
      u.email = data.email;
      u.lastName = data.lastName;
      u.firstName = data.firstName;
      //String alias = data.username;
      //Alias must be 8 characters or less
      //if(alias.length() > 8) {
      //alias = alias.substring(0, 8);
      //}
      //u.alias = alias;
      update(u);
      }
      }