static public function validateIdentity(
        ExecutionContextInterface $context,
        IdentityInterface $identity,
        array $config = [],
        $pathPrefix = null
    ) {
        $violationList = $context->getValidator()->validate($identity, [new Identity($config)]);

        if (!empty($pathPrefix)) {
            $pathPrefix = rtrim($pathPrefix, '.') . '.';
        }

        /** @var \Symfony\Component\Validator\ConstraintViolationInterface $violation */
        foreach ($violationList as $violation) {
            $context
                ->buildViolation($violation->getMessage())
                ->atPath($pathPrefix . $violation->getPropertyPath())
                ->addViolation();
        }
    }