4

I was doing single sign on with Facebook using SSO Guide here it says a registration handler is optional. When I did every other setting salesforce was generating an error saying NO_REGISTRATION_HANDLER_FOUND. So I feel registration handler class is mandatory. Again seeing the code of built-in registration handler class, only create /update methods are avaliable. So if the class is mandatory how will the create/update methods serve the registration functionality. Again is this method a Federated authentication/delgated authentication method?

1 Answer 1

7

Although you can configure an Auth. Provider without a RegistrationHandler, according to Salesforce H&T, it is not optional if you need to sign in:

A registration handler class is required to use Authentication Providers for the single sign-on flow.

When you configure an Auth. Provider without a registration handler, Salesforce then makes the Single Sign-On Initialization URL hidden and unusable, so the Auth. Provider is only usable for testing and user linking, neither of which allow you to login with a single credential. This at least allows you to examine the data supplied to the test URL, and validate that the Auth. Provider is properly configured.

If you are happy to have you users link their accounts manually using the linking URL, you could code a registration handler as simple as this

public class RegHandler implements Auth.RegistrationHandler{

    public User createUser(Id portalId, Auth.UserData data){
        return null;
    }

    public void updateUser(Id userId, Id portalId, Auth.UserData data){
    }
}

Which will never create or automatically link an existing user, nor update them.

The createUser method is called on a user logging in without an existing user linked to the identity provider account, in this case it will always just prevent a login by throwing an error.

The updateUser method is called when a link between the identity provider account and a Salesforce user already exists. These can be seen in the Third-Party Account Links section on a User record.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .