public void Handle(CertificateAddedEvent <TAccount> evt) { if (evt == null) { throw new ArgumentNullException("event"); } if (evt.Account == null) { throw new ArgumentNullException("account"); } if (evt.Certificate == null) { throw new ArgumentNullException("certificate"); } if (userAccountService.Configuration.CertificateIsUnique) { var account = evt.Account; var otherAccount = userAccountService.GetByCertificate(account.Tenant, evt.Certificate.Thumbprint); if (otherAccount != null && otherAccount.ID != account.ID) { Tracing.Verbose("[UserAccountValidation.CertificateThumbprintMustBeUnique] validation failed: {0}, {1}", account.Tenant, account.Username); throw new ValidationException(userAccountService.GetValidationMessage("CertificateAlreadyInUse")); } } }
public void Handle(CertificateAddedEvent evt) { if (evt == null) { throw new ArgumentNullException("event"); } if (evt.Account == null) { throw new ArgumentNullException("account"); } if (evt.Certificate == null) { throw new ArgumentNullException("certificate"); } var account = evt.Account; var otherAccount = userAccountService.GetByCertificate(account.Tenant, evt.Certificate.Thumbprint); if (otherAccount != null && otherAccount.ID != account.ID) { Tracing.Verbose("[UserAccountValidation.CertificateThumbprintMustBeUnique] validation failed: {0}, {1}", account.Tenant, account.Username); throw new ValidationException("That certificate is already in use by a different account."); } }