Refactor CsrfTokenGenerator::validate()