Issue #3425342 by alexpott: Optimize \Drupal\basic_auth\Authentication\Provider\BasicAuth::authenticate() (cherry picked from commit b6bee80d)