/**
  * @inheritdoc
  */
 public function readAndVerifyUserFromAuthorizationHeader($authorizationHeaderValue)
 {
     Assertion::string($authorizationHeaderValue);
     if (empty($authorizationHeaderValue)) {
         return null;
     }
     try {
         $credentials = $this->authorizationHeaderService->parseAuthorizationHeaderString($authorizationHeaderValue);
     } catch (AHSInvalidAuthorizationHeaderException $e) {
         throw new InvalidAuthorizationHeaderException($e->getMessage());
     }
     try {
         $user = $this->userService->getUserByIdentifier($credentials->getUserIdentifier());
     } catch (UserDoesNotExistException $e) {
         throw new InvalidUserException('User not found or password does not match');
     }
     $verified = $this->passwordService->verify($credentials->getPassword(), $user->getPasswordHash());
     if (!$verified) {
         throw new InvalidUserException('User not found or password does not match');
     }
     return $user;
 }
 /**
  * @param string $authorizationHeaderString
  *
  * @dataProvider parseAuthorizationHeaderStringThrowsExceptionDataProvider
  */
 public function testParseAuthorizationHeaderStringThrowsException($authorizationHeaderString)
 {
     $this->expectException(InvalidAuthorizationHeaderException::class);
     $this->authorizationHeaderService->parseAuthorizationHeaderString($authorizationHeaderString);
 }