public CertificateDto Get(string userId, string courseId) { CertificateDto certificate = null; using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand sqlCommand = new SqlCommand("GetCertificate", sqlConnection)) { sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add("@userId", SqlDbType.Int).Value = userId; sqlCommand.Parameters.Add("@courseId", SqlDbType.Int).Value = courseId; sqlConnection.Open(); using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(CommandBehavior.CloseConnection)) { while (sqlDataReader.Read()) { Guid id = sqlDataReader.GetGuid(sqlDataReader.GetOrdinal("id")); int result = sqlDataReader.GetInt32(sqlDataReader.GetOrdinal("result")); DateTime date = sqlDataReader.GetDateTime(sqlDataReader.GetOrdinal("date")); certificate = new CertificateDto() { Id = id, UserId = userId, CourseId = courseId, Result = result, Date = date }; } return(certificate); } } } }
void ImportCertificates(string connection) { try { var xcert = LdapSecureConnectionCertificateFetcher.FetchServerCertificate(connection); var cert = new X509Certificate2(xcert); var thumbprint = cert.GetFormattedThumbPrint(); var certfificateDto = new CertificateDto { Encoded = cert.ExportToPem(), Chain = thumbprint }; var exists = _certificates.Exists(x => x.Chain == thumbprint); if (exists) { UIErrorHelper.ShowAlert("Certificate with the same fingerprint already exists", "Error"); return; } _certificates.Add(certfificateDto); ReloadCertificates(); UIErrorHelper.ShowAlert(string.Format("Certificate with subject {0} imported successfully", cert.Subject), "Information"); } catch (Exception exception) { UIErrorHelper.ShowAlert(exception.Message, "Error"); } }
private void DtoToView(RelyingPartyDto relyingPartyDto) { txtName.ReadOnly = true; txtName.Text = relyingPartyDto.Name; txtUrl.Text = relyingPartyDto.Url; chkSigned.Checked = relyingPartyDto.AuthnRequestsSigned; _certDto = relyingPartyDto.Certificate; txtCertificateFilePath.Text = "Certificate"; if (relyingPartyDto.AssertionConsumerServices != null) { foreach (AssertionConsumerServiceDto service in relyingPartyDto.AssertionConsumerServices) { service.IsDefault = service.Name == relyingPartyDto.DefaultAssertionConsumerService; var lstItem = new ListViewItem(new[] { service.Name, service.Index.ToString(), service.IsDefault ? "YES" : "NO", service.Endpoint, service.Binding }) { Tag = service }; lstAssertionConsumerServices.Items.Add(lstItem); } } if (relyingPartyDto.AttributeConsumerServices != null) { foreach (AttributeConsumerServiceDto service in relyingPartyDto.AttributeConsumerServices) { service.IsDefault = service.Name == relyingPartyDto.DefaultAttributeConsumerService; var lstItem = new ListViewItem(new string[] { service.Name, service.Index.ToString(), service.IsDefault ? "YES" : "NO" }) { Tag = service }; lstAttributeConsumerServices.Items.Add(lstItem); } } if (relyingPartyDto.SignatureAlgorithms != null) { foreach (SignatureAlgorithmDto service in relyingPartyDto.SignatureAlgorithms) { var lstItem = new ListViewItem(new[] { service.MaxKeySize.ToString(), service.MinKeySize.ToString(), service.Priority.ToString() }) { Tag = service }; lstSignatureAlgorithms.Items.Add(lstItem); } } if (relyingPartyDto.SingleLogoutServices != null) { foreach (ServiceEndpointDto service in relyingPartyDto.SingleLogoutServices) { var lstItem = new ListViewItem(new[] { service.Name, service.Endpoint, service.Binding }) { Tag = service }; lstSloServices.Items.Add(lstItem); } } }
private CertificateShortInfo ToClientDto(CertificateDto certificate) { return(new CertificateShortInfo { Id = certificate.Id, Name = $"\"{certificate.IssuerName}\":\"{certificate.HolderName}\", {certificate.ExpirationDate}", SecondaryCertifictes = certificate.Children.Select(ToClientDto) }); }
void ShowCertificateDetails(CertificateDto certDto) { var cert = new X509Certificate2(Encoding.ASCII.GetBytes(certDto.Encoded)); if (cert != null) { X509Certificate2UI.DisplayCertificate(cert); } }
public async Task <CertificateTransactionResponse> Store(CertificateDto certificateDto) { var storeResult = await _remmeKeyStorage.Store(GetStoreDtoFromCertificate(certificateDto)); return(new CertificateTransactionResponse(storeResult.SocketAddress) { BatchId = storeResult.BatchId, CertificateDto = certificateDto }); }
public static void testCAProxy() { CertificateDto certDto = null; Console.WriteLine("Test of using CAProxy in RA started..."); RegistrationAuthorityService service = new RegistrationAuthorityService(); certDto = service.RegisterClient("testClient"); Console.WriteLine("Test of using CAProxy in RA finished. Name of new certificate - " + ((certDto.GetCert() != null) ? certDto.GetCert().SubjectName.ToString() : "registration not implemented")); }
private PublicKeyStoreDto GetStoreDtoFromCertificate(CertificateDto certificateDto) { return(new PublicKeyStoreDto { KeyPair = certificateDto.KeyPair, EntityData = certificateDto.CertificatePEM, EntityOwnerType = EntityOwnerTypeEnum.Personal, PublicKeyType = PublicKeyTypeEnum.RSA, ValidityFrom = GetUnixTime(certificateDto.Certificate.NotBefore.ToUniversalTime()), ValidityTo = GetUnixTime(certificateDto.Certificate.NotAfter.ToUniversalTime()) }); }
public IActionResult GetAllCertificates() { var certificate = _service.GetAllCertificate(); List <CertificateDto> Dto = new List <CertificateDto>(); foreach (var item in certificate) { CertificateDto Dtos = _mapper.Map <CertificateDto>(item); Dto.Add(Dtos); } return(Ok(Dto)); }
public ActionResult CertificateInfo(CertificateDto model) { if (!ModelState.IsValid) { ModelState.AddModelError(null, "داده های ورودی را بررسی کنید"); return(View(model)); } var temporaryEstablishmentCertificateGeorgianDate = model.TemporaryEstablishmentCertificateJalaliDate.ToGeorgianDateTime(); var bootCertificateGeorgianDate = model.BootCertificateJalaliDate.ToGeorgianDateTime(); var movementCertificateGeorgianDate = model.MovementCertificateJalaliDate.ToGeorgianDateTime(); var evenOddCertificateGeorgianDate = model.EvenOddCertificateJalaliDate.ToGeorgianDateTime(); var educationalCenter = _db.Set <EducationalCenter>().Find(_siteId); educationalCenter.TemporaryEstablishmentCertificateJalaliDate = model.TemporaryEstablishmentCertificateJalaliDate; educationalCenter.TemporaryEstablishmentCertificateGeorgianDate = temporaryEstablishmentCertificateGeorgianDate; educationalCenter.BootCertificateJalaliDate = model.BootCertificateJalaliDate; educationalCenter.BootCertificateGeorgianDate = bootCertificateGeorgianDate; educationalCenter.MovementCertificateJalaliDate = model.MovementCertificateJalaliDate; educationalCenter.MovementCertificateGeorgianDate = movementCertificateGeorgianDate; educationalCenter.EvenOddCertificateJalaliDate = model.EvenOddCertificateJalaliDate; educationalCenter.EvenOddCertificateGeorgianDate = evenOddCertificateGeorgianDate; educationalCenter.TemporaryEstablishmentCertificateNumber = model.TemporaryEstablishmentCertificateNumber; educationalCenter.BootCertificateNumber = model.BootCertificateNumber; educationalCenter.EvenOddCertificateNumber = model.EvenOddCertificateNumber; _db.Entry(educationalCenter).State = EntityState.Modified; _db.SaveChanges(); TempData["Message"] = "با موفقیت ثبت گردید"; return(RedirectToAction(nameof(CertificateInfo))); }
public bool UpdateCertificate(CertificateDto certificate) { var serverCertificate = _certificateRepository.GetInstanceById(certificate.Id); serverCertificate.AreaOfUsage = certificate.AreaOfUsage; serverCertificate.ExpirationDate = certificate.ExpirationDate; serverCertificate.HashingAlgorithm = certificate.HashingAlgorithm; serverCertificate.HolderName = certificate.HolderName; serverCertificate.IssuerName = certificate.IssuerName; serverCertificate.SharedKey = certificate.SharedKey; serverCertificate.Signature = certificate.Signature; return(_certificateRepository.UpdateInstance(serverCertificate)); }
public override async Task SetUp() { InitializeClient(); Account = (await Client.Accounts.GetAccountsAsync(0, 1)).Accounts[0]; page = await Client.Docflows.GetDocflowsAsync(Account.Id); docflow = page.DocflowsPageItem[0]; docflowDocuments = await Client.Docflows.GetDocumentsAsync(Account.Id, docflow.Id); document = docflowDocuments[0]; signature = (await Client.Docflows.GetDocumentSignaturesAsync(Account.Id, docflow.Id, document.Id))[0]; certificate = (await Client.Accounts.GetAccountCertificatesAsync(Account.Id, 0, 1)).Certificates[0]; }
public IActionResult UpdateCertificate(int id, [FromBody] CertificateDto certificateDto) { var certificate = _mapper.Map <Certificate>(certificateDto); try { var data = _service.Update(certificate, id); return(Ok(data)); } catch (AppException ex) { return(BadRequest(new { message = ex.Message })); } }
public void LoadMyCertificate() { using (new OperationContextScope(raProxy.GetChannel())) { MessageHeader aMessageHeader = MessageHeader.CreateHeader("UserName", "", ServiceName); OperationContext.Current.OutgoingMessageHeaders.Add(aMessageHeader); X509Certificate2 retCert = null; CertificateDto certDto = null; certDto = raProxy.RegisterClient(HostAddress); retCert = certDto.GetCert(); myCertificate = retCert; } }
/// <summary> /// Save specified certificate to backup /// </summary> /// <param name="certDto">Certificate</param> /// <returns></returns> public bool SaveCertificateToBackupDisc(CertificateDto certDto) { if (!IsUserAccessGranted(WindowsIdentity.GetCurrent().Name)) { Audit.WriteEvent("User '" + WindowsIdentity.GetCurrent().Name + "' had denied access for method SaveCertificateToBackupDisc", EventLogEntryType.FailureAudit); } X509Certificate2 certificate = certDto.GetCert(); activeCertificates.Add(certificate); CertificateHandler.ExportToFileSystem(X509ContentType.Pfx, certificate, certificate.SubjectName.Name); string logMessage = "Certificate with subject name '" + certificate.SubjectName.Name + "' is saved on backup server.'"; Audit.WriteEvent(logMessage, EventLogEntryType.Information); return true; }
public async Task <IResponse <CertificateDto> > GetCertificate(string username) { var request = new RestRequest("{Benutzername}/Certificate", Method.GET); request.AddUrlSegment("Benutzername", username); var response = await _client.ExecuteAsync <CertificateResponse>(request); if (!response.IsSuccessful) { return(new Response <CertificateDto>(false, null, response.StatusDescription)); } var returnDto = new CertificateDto(Convert.FromBase64String(response.Data.Signaturzertifikat), response.Data.ZertifikatsseriennummerHex); return(new Response <CertificateDto>(true, returnDto, null)); }
public CertificateDto SendCert(CertificateDto certDto) { if (!vaProxy.isCertificateValidate(certDto.GetCert(false))) { return(null); } IClientContract otherSide = OperationContext.Current.GetCallbackChannel <IClientContract>(); string callbackSession = otherSide.GetSessionId(); string proxySession = OperationContext.Current.SessionId; SessionData newSd = new SessionData(null, otherSide, callbackSession, proxySession); newSd.Address = string.Format("temp{0}", tempSessionNum++); clientSessions.Add(newSd.Address, newSd); return(new CertificateDto(myCertificate, false)); }
public void Create(CertificateDto certificate) { using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand sqlCommand = new SqlCommand("AddCertificate", sqlConnection)) { sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add("@id", SqlDbType.UniqueIdentifier).Value = certificate.Id; sqlCommand.Parameters.Add("@courseId", SqlDbType.Int).Value = certificate.CourseId; sqlCommand.Parameters.Add("@userId", SqlDbType.Int).Value = certificate.UserId; sqlCommand.Parameters.Add("@result", SqlDbType.Int).Value = certificate.Result; sqlCommand.Parameters.Add("@date", SqlDbType.Date).Value = certificate.Date; sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); } } }
public bool Create(ServerDto serverDto, string tenantName, CertificateDto certificate, Token token) { tenantName = Uri.EscapeDataString(tenantName); var url = string.Format(ServiceConfigManager.CertificatesEndPoint, serverDto.Protocol, serverDto.ServerName, serverDto.Port, tenantName); var json = JsonConvert.Serialize(certificate); json = SerializationJsonHelper.Cleanup(json); ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; var requestConfig = new RequestSettings { Method = HttpMethod.Post, }; var headers = ServiceHelper.AddHeaders(ServiceConfigManager.JsonContentType); json = "access_token=" + token.AccessToken + "&token_type=" + token.TokenType.ToString().ToLower() + "&" + json; var response = _webRequestManager.GetResponse(url, requestConfig, headers, null, json); return(string.IsNullOrEmpty(response)); }
private void btnChooseCertificate_Click(object sender, EventArgs e) { ActionHelper.Execute(delegate() { using (var ofd = new OpenFileDialog()) { ofd.Filter = "Cert Files (*.cer)|*.cer|All Files (*.*)|*.*"; if (ofd.ShowDialog() == DialogResult.OK) { txtCertificateFilePath.Text = ofd.FileName; var cert = new X509Certificate2(); cert.Import(txtCertificateFilePath.Text); _certDto = new CertificateDto { Encoded = cert.ExportToPem() }; } } }, null); }
public void DeleteCertficateChain(CertificateDto dto) { ActionHelper.Execute(delegate() { var serverDto = GetServerDto(); var tenant = GetTenant(); var auth = SnapInContext.Instance.AuthTokenManager.GetAuthToken(serverDto.ServerName); var fingerprint = new X509Certificate2(Encoding.ASCII.GetBytes(dto.Encoded)).GetFormattedThumbPrint(); var success = SnapInContext.Instance.ServiceGateway.Certificate.Delete(serverDto, tenant, fingerprint, auth.Token); if (success) { UIErrorHelper.ShowAlert("Certificate chain " + dto.Chain + " deleted successfully", "Information"); } else { UIErrorHelper.ShowAlert("Failed to delete certificate chain" + dto.Chain, "Information"); } Refresh(this, EventArgs.Empty); }); }
public bool AddCertificate(UserDto user, CertificateDto certificate) { var systemUser = userRepository.GetInstanceById(user.Id); var createdCertificate = _certificateRepository.CreateCertificate( systemUser, certificate.HolderName, certificate.IssuerName, certificate.ExpirationDate, certificate.SharedKey, certificate.Signature, certificate.AreaOfUsage, certificate.HashingAlgorithm); if (createdCertificate != null) { return(true); } return(false); }
///TODO- need to add this profile fields in db and api public IActionResult GetCertificateQuestionByID(int id) { var qa = _questionService.GetById(id); QuestionDto question = new QuestionDto() { ID = qa.ID, QuestionTitle = qa.QuestionTitle, CreatedBy = qa.CreatedBy, CreatedOn = qa.CreatedOn, ModifiedBy = qa.ModifiedBy, ModifiedOn = qa.ModifiedOn }; question.Certificates = new List <CertificateDto>(); foreach (CertificateQuestion c in qa.CertificateQuestions) { Certificate certificate = c.Certificate; CertificateDto certificateDto = new CertificateDto(); if (certificate == null) { certificate = _certificateService.GetById(c.CertificateID); certificateDto = new CertificateDto() { ID = certificate.ID, Name = certificate.Name, ParentID = certificate.ParentID, CreatedBy = certificate.CreatedBy, CreatedOn = certificate.CreatedOn, ModifiedBy = certificate.ModifiedBy, ModifiedOn = certificate.ModifiedOn, Status = certificate.Status, IsCertificateQA = certificate.IsCertificateQA }; } question.Certificates.Add(certificateDto); } return(Ok(question)); }
public IActionResult FindCertificate(string id) { if (string.IsNullOrWhiteSpace(id)) { id = "test"; } using (var store = new X509Store(StoreLocation.CurrentUser)) { store.Open(OpenFlags.ReadOnly); X509Certificate2 cert = store.Certificates.OfType <X509Certificate2>().AsEnumerable().FirstOrDefault(c => c.Subject.Contains(id, StringComparison.OrdinalIgnoreCase)); if (cert != null) { var dto = CertificateDto.Map(store, cert); return(Ok(dto)); } } return(Ok($"Not found: {id}")); }
/// <summary> /// Generate new certificate with specified subject name. /// If certificate with given subject name already exist this action is forbiden. /// </summary> /// <param name="subject">Subject name</param> /// <param name="address">Host address of client</param> /// <returns></returns> public CertificateDto GenerateCertificate(string subject, string address) { if(!IsUserAccessGranted(WindowsIdentity.GetCurrent().Name)) { Audit.WriteEvent("User '" + WindowsIdentity.GetCurrent().Name + "' had denied access for method GenerateCertificate", EventLogEntryType.FailureAudit); } CertificateDto retVal = null; X509Certificate2 newCertificate = null; string logMessage = String.Empty; newCertificate = IsCertificatePublished(subject); if (newCertificate == null) { newCertificate = CertificateHandler.GenerateAuthorizeSignedCertificate(subject, "CN=" + CA_SUBJECT_NAME, caPrivateKey); if (newCertificate != null) { activeCertificates.Add(newCertificate); clientDict.Add(subject, address); logMessage = "Certificate with subject name '" + subject + "' is issued by '" + CA_SUBJECT_NAME + "'"; Audit.WriteEvent(logMessage, EventLogEntryType.Information); } else { logMessage = "Generation of certificate with subject name '" + subject + "' failed."; Audit.WriteEvent(logMessage, EventLogEntryType.Warning); } } else { logMessage = "Certificate with subject name '" + subject + "' is already published"; Audit.WriteEvent(logMessage, EventLogEntryType.Warning); } retVal = new CertificateDto(newCertificate); return retVal; }
///TODO- need to add this profile fields in db and api public IActionResult GetCertificateByID(int id) { var certificate = _service.GetById(id); if (certificate == null) { return(new UnauthorizedResult()); } CertificateDto certificateDto = new CertificateDto() { ID = certificate.ID, Name = certificate.Name, ParentID = certificate.ParentID, CreatedBy = certificate.CreatedBy, CreatedOn = certificate.CreatedOn, ModifiedBy = certificate.ModifiedBy, ModifiedOn = certificate.ModifiedOn, Status = certificate.Status, IsCertificateQA = certificate.IsCertificateQA }; return(Ok(certificateDto)); }
/// <summary> /// add Certificate and get certificate Id /// </summary> /// <param name="qualification"></param> /// <returns></returns> public async Task <long> AddCertificate(CertificateDto certificate) { try { var apiUrl = UrlExtension.Combine(WebApiBasePath, "/qualification/certificate/"); using (var content = new MultipartFormDataContent("Upload----" + DateTime.Now.ToString(CultureInfo.InvariantCulture))) { var filecontent = new StreamContent(new MemoryStream(certificate.FileContent)); filecontent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(certificate.ContentType); filecontent.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment"); filecontent.Headers.ContentDisposition.FileName = certificate.FileName; content.Add(filecontent, certificate.FileName, certificate.FileName); // content.Add(fileContent); return(await _apiService.PostHttpAsync <long>(apiUrl, content)); } } catch (Exception ex) { Logger.Error("Certificate Add Error", ex); } return(0); }
public IActionResult Get() { var items = new List <dynamic>(); var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadOnly); var certificates = store.Certificates; foreach (var certificate in certificates) { items.Add(CertificateDto.Map(store, certificate)); } if (items.Any()) { return(Ok(items)); } return(Ok(new { StoreName = store.Name, StoreLocation = store.Location, })); }
public CertificateDto RegisterClient(string address) { CertificateDto certDto = null; if (!String.IsNullOrEmpty(address)) { MessageHeaders headers = OperationContext.Current.RequestContext.RequestMessage.Headers; string subject = null; if (headers.FindHeader("UserName", "") > -1) { subject = headers.GetHeader <string>(headers.FindHeader("UserName", "")); } if (subject == null) { throw new Exception("Invalid user name"); } //string subject = ServiceSecurityContext.Current.PrimaryIdentity.Name.Replace('\\','_').Trim(); //string port = address.Split(':')[2].Split('/')[0]; //subject = subject.Replace('-', '_') + port; certDto = CAProxy.GenerateCertificate(subject, address); } return(certDto); }
public override void AwakeFromNib() { base.AwakeFromNib(); DtoToView(); this.BtnAuthenticationAddCertificate.Activated += (object sender, EventArgs e) => { var openPanel = new NSOpenPanel(); openPanel.ReleasedWhenClosed = true; openPanel.Prompt = "Select file"; var result = openPanel.RunModal(); if (result == 1) { var filePath = openPanel.Url.AbsoluteString.Replace("file://", string.Empty); var cert = new X509Certificate2(); ActionHelper.Execute(delegate() { cert.Import(filePath); var certfificateDto = new CertificateDto { Encoded = cert.ExportToPem(), }; TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.TrustedCACertificates.Add(certfificateDto); ReloadCertificates(); }); } }; this.BtnAuthenticationRemoveCertificate.Activated += (object sender, EventArgs e) => { if (CertificateTableView.SelectedRows.Count > 0) { foreach (var row in CertificateTableView.SelectedRows) { TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.TrustedCACertificates.RemoveAt((int)row); } ReloadCertificates(); } }; BtnAuthenticationPolicyAddPolicyOid.Activated += (object sender, EventArgs e) => { if (string.IsNullOrEmpty(TxtAuthenticationPolicyOid.StringValue)) { UIErrorHelper.ShowAlert("Policy OID cannot be empty", "Alert"); return; } TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.CertPolicyOIDs.Add(TxtAuthenticationPolicyOid.StringValue); ReloadTableView(AuthenticationPolicyOidTableView, TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.CertPolicyOIDs); TxtAuthenticationPolicyOid.StringValue = (NSString)string.Empty; BtnAuthenticationRemovePolicyOid.Enabled = TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.CertPolicyOIDs != null && TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.CertPolicyOIDs.Count > 0; }; BtnAuthenticationRemovePolicyOid.Activated += (object sender, EventArgs e) => { if (AuthenticationPolicyOidTableView.SelectedRows.Count > 0) { foreach (var row in AuthenticationPolicyOidTableView.SelectedRows) { TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.CertPolicyOIDs.RemoveAt((int)row); } ReloadTableView(AuthenticationPolicyOidTableView, TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.CertPolicyOIDs); BtnAuthenticationRemovePolicyOid.Enabled = TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.CertPolicyOIDs != null && TenantConfigurationDto.AuthenticationPolicy.ClientCertificatePolicy.CertPolicyOIDs.Count > 0; } }; BtnClose.Activated += (object sender, EventArgs e) => { TenantConfigurationDto = null; this.Close(); NSApplication.SharedApplication.StopModalWithCode(0); }; this.BtnSave.Activated += (object sender, EventArgs e) => { ActionHelper.Execute(delegate() { ViewToDto(); var auth = SnapInContext.Instance.AuthTokenManager.GetAuthToken(ServerDto.ServerName); SnapInContext.Instance.ServiceGateway.Tenant.UpdateConfig(ServerDto, TenantName, TenantConfigurationDto, auth.Token); SnapInContext.Instance.ServiceGateway.Tenant.UpdatePasswordAndLockoutConfig(ServerDto, TenantName, TenantConfigurationDto, auth.Token); this.Close(); NSApplication.SharedApplication.StopModalWithCode(1); }); }; this.ChkDisableLogonBanner.Activated += (object sender, EventArgs e) => { CheckLogonBanner(); }; this.BtnUploadContent.Activated += (object sender, EventArgs e) => { var openPanel = new NSOpenPanel(); openPanel.ReleasedWhenClosed = true; openPanel.Prompt = "Select file"; var result = openPanel.RunModal(); if (result == 1) { var filePath = openPanel.Url.AbsoluteString.Replace("file://", string.Empty); ActionHelper.Execute(delegate() { var text = System.IO.File.ReadAllText(filePath); if (!string.IsNullOrEmpty(text)) { TxtBrandLogonBanner.StringValue = text; } }); } }; CheckLogonBanner(); }