1. Salesforce Apex Developer Guide
"Named Credentials as Callout Endpoints": This guide explains the primary function of Named Credentials and also details the specific scenario for custom authentication. It states
"To handle the authentication in Apex
use a custom header. Create the named credential with no authentication protocol selected. Then in your Apex code
create the custom header for authentication and add it to the callout request." This directly supports option B as the correct method when technical constraints require it.
2. Salesforce Help
"Create a Custom Authentication Provider": This document outlines when custom authentication is needed. It mentions
"For an authentication protocol that is not OAuth 2.0
you can specify the named credential as the callout endpoint and handle the authentication in your code." This reinforces that handling authentication in code is the correct procedure for non-standard protocols.
3. Salesforce Help
"Login Flows": The official documentation describes Login Flows as a tool to "customize the login experience and integrate business processes with Salesforce authentication." Its purpose is for authenticating users into Salesforce
which is distinct from authenticating Salesforce to an external service
making option A incorrect.