}
private UserWithSecret authenticate(DomainData domain, ClientCertificate clientCertificate, ByteString challenge,
ByteString response) throws CloudException {
String keyId = toCredentialKey(clientCertificate.getPublicKeySha1());
CredentialData credential = authRepository.getPublicKeyCredentials(domain.getId()).find(keyId);
if (credential == null) {
return null;
}
UserData user = authRepository.getUsers().find(credential.getUserId());
if (user == null) {
return null;
}
UserWithSecret userWithSecret = secretService.checkPublicKey(user, credential, clientCertificate, challenge,