In the scenario where "Application A" wants to communicate with "Application B" over an API (HTTPS), I want to ensure mutual authentication is implemented. Meaning that "A" should authenticate "B" before it authenticates itself. A CA signed certificate will be held on "B" to enable HTTPS.
When "A" initiates the TLS(1.2) connection with "B", does "A" authenticate "B" by default using TLS? Meaning does "A" verify that the endpoint certificate (CN) on "B" matches the domain name? If the domain name checking is not done I would assume this would not be sufficient for server authentication as the application will initiate the connection regardless of what certificate is presented on "B"?
I understand web browsers implement domain name checking, but was not sure if this was built into the TLS protocol and will therefore be implemented by default in application to application connections.
Update/Answer: This URL provides specific answers to my question: https://stackoverflow.com/questions/17279683/how-can-you-test-that-an-ssl-client-library-is-properly-verifying-the-certificat