public IHttpActionResult Authorize([FromBody] LoginInformation loginInformation) { AuthorizationTokenInfo token; try { token = _authorizer.Authorize(loginInformation.Mail, new Password(loginInformation.Password)); } catch (AccountNotFoundException ex) { return(Content(HttpStatusCode.Unauthorized, ex.Message)); } catch (IncorrectPasswordException ex) { return(Content(HttpStatusCode.Unauthorized, ex.Message)); } if (!_authorizer.CheckProfileCompleteness(loginInformation.Mail)) { var userId = _authorizer.GetUserByMail(loginInformation.Mail).UserId; var tokenReg = _authorizer.SaveProfileCompletenessConfirmationRequest(userId); return(Ok(new ProfileIsNotCompletedResponse(tokenReg))); } var account = _authorizer.GetUserByMail(loginInformation.Mail); var projects = _userManager.GetAllUserProjects(account); var portfolio = new List <ProjectPresentation>(); foreach (var prj in projects) { portfolio.Add(new ProjectPresentation(prj, _userManager.GetMembers(prj))); } return(Ok(new CurrentUserPresentation(account, token, portfolio))); }
private Task<Users> VerifyLoginInformation(LoginInformation loginInformation) { using (CoinManagementContext coinManagementContext = new CoinManagementContext()) { Users foundUser; try { foundUser = coinManagementContext.Users.SingleOrDefault(user => user.Username.Equals(loginInformation.Username) || user.Email.Equals(loginInformation.Username)); } catch(InvalidOperationException ex) { return Task.FromResult<Users>(null); } if (foundUser != null) { if (foundUser.Password.Equals(loginInformation.Password)) { //next iteration encryption return Task.FromResult<Users>(foundUser); } else { return Task.FromResult<Users>(null); } } } return Task.FromResult<Users>(null); }
/// <summary> /// This method sends document to be /// downloaded as attachment for saving in browser /// </summary> /// <param name="docID">docID</param> public void DownloadDocument(int docID) { try { if (SessionManagement.UserInfo != null) { LoginInformation loginInfo = SessionManagement.UserInfo; //Get file name from database var fileName = userDocumentBO.GetUploadedDocumentName(loginInfo.UserID, docID); if (fileName != String.Empty) { //Get file extension var fileExt = fileName.Substring(fileName.LastIndexOf('.')); var file = new FileInfo(Server.MapPath("~/UserDocuments/" + loginInfo.UserID + "-" + docID + fileExt)); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AppendHeader("Content-Disposition", "attachment; filename = " + fileName); Response.AppendHeader("Content-Length", file.Length.ToString()); Response.ContentType = GetContentType(file.Name); Response.WriteFile(file.FullName); Response.Flush(); Response.Close(); } } } catch (Exception ex) { CurrentDeskLog.Error(ex.Message, ex); } }
public void LoginTest() { // configure the ApiClient for the DocuSign site and authentictaion needed. Utils.ConfigureApiClient(); AuthenticationApi authApi = new AuthenticationApi(); AuthenticationApi.LoginOptions options = new AuthenticationApi.LoginOptions(); options.apiPassword = "******"; options.includeAccountIdGuid = "true"; LoginInformation loginInfo = authApi.Login(options); Assert.IsNotNull(loginInfo.LoginAccounts); // find the default account for this user foreach (LoginAccount loginAcct in loginInfo.LoginAccounts) { if (loginAcct.IsDefault == "true") { TestConfig.AccountId = loginAcct.AccountId; break; } } Assert.IsNotNull(TestConfig.AccountId); }
public async Task <IActionResult> Login([FromBody] LoginInformation loginInformation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var existAccount = _context.Account.SingleOrDefault(a => a.Email == loginInformation.Email); if (existAccount != null) { if (existAccount.Role == Role.student) { if (existAccount.Password == PasswordHandle.PasswordHandle.GetInstance().EncryptPassword(loginInformation.Password, existAccount.Salt)) { var credential = new Credential(existAccount.Id); _context.Add(credential); _context.SaveChanges(); return(new JsonResult(credential)); } } Response.StatusCode = (int)HttpStatusCode.BadRequest; return(new JsonResult("Bad Request")); } Response.StatusCode = (int)HttpStatusCode.NotFound; return(new JsonResult("NotFound")); }
public loginForm(LoginInformation loginInformation) { InitializeComponent(); this.AcceptButton = this.loginButton; this.errorProvider = new ErrorProvider(); this.loginInformation = loginInformation; }
public LoginViewModel(INavigationService navigator, string navigationPath) { #region Navigation _navigator = navigator; NavigationPath = navigationPath; NavigateToRegisterPageCommand = new Command(() => { _navigator.NavigateTo(new RegisterViewModel(_navigator, $"{NavigationPath}/Register")); }); NavigateToResourceListPageCommand = new Command(async() => { await _navigator.NavigateToModal(new BusyViewModel(_navigator, $"{NavigationPath}/Busy")); if (await Login()) { await _navigator.PopModal(); var resourceListViewModel = new ResourceListViewModel(_navigator, $"{NavigationPath}/ResourceList"); await resourceListViewModel.BeforeFirstShown(); _navigator.PresentAsNavigatableMainPage(new HomeViewModel(_navigator, new ResourceListView(resourceListViewModel))); } else { await _navigator.PopModal(); await _navigator.DisplayAlert("Alert", ErrorMessage, "OK"); } }); #endregion LoginInformation = new LoginInformation(); }
private void BackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { try { LoginInformation loginInfo = ( LoginInformation )e.Argument; if (_worker.CancellationPending) { e.Cancel = true; return; } if (_vm != null) { ErrType err = _vm.Login(loginInfo.AccountName, loginInfo.Password, loginInfo.AccountType); if (_worker.CancellationPending) { e.Cancel = true; return; } e.Result = err; } CheckUpdateProgram(); } catch (Exception ex) { e.Result = new ErrType(ERR.EXEPTION, ErrorText.ServiceError); } }
public static string GetAccountId() { var appSettings = System.Configuration.ConfigurationManager.AppSettings; string username = appSettings["docusignDeveloperEmail"] ?? "*****@*****.**"; string password = appSettings["docusignPassword"] ?? "epercic"; string integratorKey = appSettings["docusignIntegratorKey"] ?? "a2dced5d-bebe-4b70-803e-bbbb70ecf7cb"; string authHeader = "{\"Username\":\"" + username + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}"; Configuration.AddDefaultHeader("X-DocuSign-Authentication", authHeader); // the authentication api uses the apiClient (and X-DocuSign-Authentication header) that are set in Configuration object AuthenticationApi authApi = new AuthenticationApi(Configuration); LoginInformation loginInfo = authApi.Login(); // find the default account for this user foreach (LoginAccount loginAccount in loginInfo.LoginAccounts) { if (loginAccount.IsDefault == "true") { return(loginAccount.AccountId); } } return(null); }
public static LoginInformation AuthWindows(string username, string password) { var info = new LoginInformation(); try { var domainName = Environment.UserDomainName; if (username.Contains("\\")) { var splitName = username.Split('\\'); domainName = splitName[0]; username = splitName[1]; } using (var wim = new WindowsIdentityImpersonator(domainName, username, password)) { wim.BeginImpersonate(); { info.IsAdmin = WinApi.IsAdministratorByToken(WindowsIdentity.GetCurrent()); info.LoggedIn = true; info.Message = $"Logged in successfully as {username}"; } wim.EndImpersonate(); } } catch (Exception ex) { info.IsAdmin = false; info.LoggedIn = false; info.Message = ex.Message; } return(info); }
public async Task <IActionResult> Login(LoginInformation loginInformation) { try { var result = await signInManager.PasswordSignInAsync(loginInformation.E_mail, loginInformation.Password, loginInformation.RememberMe, false); if (result.Succeeded) { return(Ok()); } else if (result.IsNotAllowed) { return(BadRequest("Email need to be confirmed !!")); } else { return(BadRequest()); } } catch (Exception) { return(BadRequest("please check your Email or Password !!")); } }
public GetAccessTokenResult GetAccessToken(string username, string password) { var output = new GetAccessTokenResult(); LoginInformation loginInformation = new LoginInformation(username, password); var result = _endpoint .AllowAnyHttpStatus() .WithHeader("Accept-Version", "1.0") .AppendPathSegment("api") .AppendPathSegment("Rpc") .AppendPathSegment("GetToken") .PostJsonAsync(loginInformation).Result; if (result.IsSuccessStatusCode) { output.Success = true; output.Token = Newtonsoft.Json.JsonConvert.DeserializeObject <AccessToken>(result.Content.ReadAsStringAsync().Result); output.Error = null; } else { output.Success = false; string content = result.Content.ReadAsStringAsync().Result; output.Error = Newtonsoft.Json.JsonConvert.DeserializeObject <ErrorFromServer>(content); output.Token = null; } return(output); }
public void CadastrarCliente(LoginInformation login, ref string erro) { try { cn.Open(); SqlCommand validarSenhaPrincipal = new SqlCommand(@"SELECT count(*) FROM LOGIN WHERE USUARIO = '" + login.NovoUsuario + "'", cn); int resultado = Convert.ToInt32(validarSenhaPrincipal.ExecuteScalar()); if (resultado != 0) { erro = "Usuário já Existente!"; throw new Exception("Já existe um usuário com este nome cadastrado!"); } SqlCommand cadastrarUsuario = new SqlCommand(@"INSERT INTO LOGIN VALUES (@USUARIO, @SENHA, @PIN, @NomeCompleto)", cn); cadastrarUsuario.Parameters.AddWithValue("@USUARIO", login.NovoUsuario); cadastrarUsuario.Parameters.AddWithValue("@SENHA", login.NovaSenha); cadastrarUsuario.Parameters.AddWithValue("@PIN", login.NovoPin); cadastrarUsuario.Parameters.AddWithValue("@NomeCompleto", login.NomeCompleto); cadastrarUsuario.ExecuteNonQuery(); } catch (SqlException ex) { throw new Exception(ex.Message); } finally { cn.Close(); } }
public static string GetAccountId() { var appSettings = System.Configuration.ConfigurationManager.AppSettings; string username = appSettings["docusignDeveloperEmail"] ?? "*****@*****.**"; string password = appSettings["docusignPassword"] ?? "N#ewport4331"; string integratorKey = appSettings["docusignIntegratorKey"] ?? "4ed5be53-a1e4-49d4-80bd-563d4635eb9d"; string authHeader = "{\"Username\":\"" + username + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}"; Configuration.AddDefaultHeader("X-DocuSign-Authentication", authHeader); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // the authentication api uses the apiClient (and X-DocuSign-Authentication header) that are set in Configuration object AuthenticationApi authApi = new AuthenticationApi(Configuration); LoginInformation loginInfo = authApi.Login(); // find the default account for this user foreach (LoginAccount loginAccount in loginInfo.LoginAccounts) { if (loginAccount.IsDefault == "true") { return(loginAccount.AccountId); } } return(null); }
public IActionResult Login(LoginInformation account) { var loginSuccess = false; var existAccount = _context.Account.SingleOrDefault(a => a.Email == account.Email); if (existAccount != null) { if (existAccount.Password == SecurityHelper.PasswordHandle.GetInstance().EncryptPassword(account.Password, existAccount.Salt)) { loginSuccess = true; } } if (loginSuccess) { var credential = new Credential(existAccount.Id, "1"); _context.Credential.Add(credential); _context.SaveChanges(); Response.StatusCode = 200; return(new JsonResult(credential)); } ; Response.StatusCode = 403; return(new JsonResult("Invalid information")); }
public void GetLoginInformationNotesTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 4, 5, 68, 78, 83, 9, 110, 211, 128, 213, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfb, 0xf3, 0xaa, 0xc5, 0xd6, 0xbb, 0xf8, 0x19, 0x11, 0xfb, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); LoginInformation loginInformationModified = loginInformation.ShallowCopy(); loginInformationModified.UpdateNotes("Nice story about how I found the missing tapes of ..."); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformationModified, "does not matter", skaAES_CTR, derivedKey); // Act string loginInformationNotes = loginInformationSecret.GetNotes(derivedKey); // Assert Assert.IsFalse(string.IsNullOrEmpty(loginInformationNotes)); Assert.AreEqual(loginInformationModified.notes, loginInformationNotes); }
private string Login(string username, string password, string key) { SetAuthHeader(username, password, key); LoginInformation loginInfo = _authApi.Login(); return(loginInfo.LoginAccounts[0].AccountId); // return first account ID (user may have several) }
public void GetLoginInformatioMFATest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 231, 42, 5, 68, 78, 83, 9, 110, 211, 128, 213, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfc, 0xf3, 0xaa, 0xc5, 0xd6, 0xbb, 0xf8, 0x19, 0x11, 0xfb, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); LoginInformation loginInformationModified = loginInformation.ShallowCopy(); loginInformationModified.UpdateMFA("otpauth://totp/DRAGONFIER?secret=YOUR_DRAGON"); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformationModified, "does not matter", skaAES_CTR, derivedKey); // Act string loginInformationMFA = loginInformationSecret.GetMFA(derivedKey); // Assert Assert.IsFalse(string.IsNullOrEmpty(loginInformationMFA)); Assert.AreEqual(loginInformationModified.mfa, loginInformationMFA); }
public void TC_02_Capture_Customer_With_FA_And_AG() { Report_Log_Instance("Login to DMSPro"); var Info = new LoginInformation { Server = "DMSDB\\DMSCORE", Company = "HO (HO)", Username = "******", Password = "******" }; LoginPO.InstancePO.Login_to_RDS_site(Info); Report_Log_Instance("Try to interact with element of dialog"); HomePage.InstancePO.Base_wait_for_loading_page_completely(); HomePage.InstancePO.Base_Select_Item_Menu_From_Left_Panel(Inventory.ItemMasterData); var ItemMasterData = new ItemMasterDataPage(); var propertiesTable = ItemMasterData.PropertiesTable; var count = propertiesTable.CountRow; propertiesTable.Check_checkbox_table(1, 3); propertiesTable.Check_checkbox_table(40, 3); propertiesTable.Select_row_in_table(18); }
public void GetModificationTimeTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 4, 5, 68, 78, 83, 9, 110, 211, 128, 213, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfb, 0xf3, 0xaa, 0xc5, 0xd6, 0xbb, 0xf8, 0x19, 0x11, 0xfb, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); LoginInformation loginInformationModified = loginInformation.ShallowCopy(); Thread.Sleep(1100); loginInformationModified.UpdateNotes("Some text to here so modification time triggers"); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformationModified, "does not matter", skaAES_CTR, derivedKey); // Act DateTimeOffset loginInformationModificationTime = loginInformationSecret.GetModificationTime(derivedKey); // Assert Assert.IsTrue(loginInformationModified.modificationTime > loginInformationModified.creationTime); Assert.AreEqual(loginInformationModified.GetModificationTime(), loginInformationModificationTime); }
/// <summary> /// This action returns Dashboard view with view-model /// </summary> /// <returns></returns> public ActionResult Index() { try { if (SessionManagement.UserInfo != null) { var model = new DashboardModel(); LoginInformation loginInfo = SessionManagement.UserInfo; var userAccInfo = clientAccBO.GetDashboardAccounts(loginInfo.LogAccountType, loginInfo.UserID); //Group all accounts by currency var pairedAccInfo = userAccInfo.GroupBy(o => o.FK_CurrencyID); var tradeList = new List <UserAccountGrouped>(); //Iterate through each currency grouped accounts and add them to model foreach (var item in pairedAccInfo) { var groupedTradingAccount = new UserAccountGrouped(); groupedTradingAccount.AccountCurrency = lCurrValueBO.GetCurrencySymbolFromID((int)item.Key); var list = new List <Client_Account>(); foreach (var groupedItem in item) { list.Add(groupedItem); } groupedTradingAccount.UserAccountList = list; tradeList.Add(groupedTradingAccount); } model.UserAccInformation = tradeList; //Get market news model.MarketNews = GetMarketNews(); //Get IB userID under which client is present int ibUserID = clientBO.GetIntroducingBrokerIDOfClient(loginInfo.UserID); model.BrokerPromoImgName = String.Empty; //If client is under any IB if (ibUserID != 0) { var imgDetail = userImgBO.GetActiveImageOfIB(ibUserID); if (imgDetail != null) { var imgExt = imgDetail.ImageName.Substring(imgDetail.ImageName.LastIndexOf('.')); model.BrokerPromoImgName = imgDetail.PK_UserImageID + imgExt; } } return(View(model)); } else { return(RedirectToAction("Login", "Account")); } } catch (Exception ex) { CurrentDeskLog.Error(ex.Message, ex); return(View("ErrorMessage")); } }
public void GetLoginInformationIconTest() { // Arrange byte[] derivedKey = new byte[16] { 181, 229, 31, 44, 55, 61, 7, 8, 9, 110, 211, 128, 213, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0x10, 0x21, 0x3b, 0xf3, 0xaa, 0xc5, 0xd6, 0xbb, 0xf8, 0x19, 0x11, 0xfb, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); Random rng = new Random(Seed: 1337); byte[] iconBytes = new byte[2048]; rng.NextBytes(iconBytes); LoginInformation loginInformationModified = loginInformation.ShallowCopy(); loginInformationModified.UpdateIcon(iconBytes); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformationModified, "does not matter", skaAES_CTR, derivedKey); // Act byte[] loginInformationIcon = loginInformationSecret.GetIcon(derivedKey); // Assert Assert.IsNotNull(loginInformationIcon); CollectionAssert.AreEqual(iconBytes, loginInformationIcon); }
public string loginApi(string usr, string pwd) { usr = "******"; pwd = "Cns@12345"; // we set the api client in global config when we configured the client ApiClient apiClient = Configuration.Default.ApiClient; string authHeader = "{\"Username\":\"" + usr + "\", \"Password\":\"" + pwd + "\", \"IntegratorKey\":\"" + INTEGRATOR_KEY + "\"}"; Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader); // we will retrieve this from the login() results string accountId = null; // the authentication api uses the apiClient (and X-DocuSign-Authentication header) that are set in Configuration object AuthenticationApi authApi = new AuthenticationApi(); LoginInformation loginInfo = authApi.Login(); // find the default account for this user foreach (DocuSign.eSign.Model.LoginAccount loginAcct in loginInfo.LoginAccounts) { if (loginAcct.IsDefault == "true") { accountId = loginAcct.AccountId; break; } } if (accountId == null) { // if no default found set to first account accountId = loginInfo.LoginAccounts[0].AccountId; } return(accountId); }
public void GetLoginInformationCategoryTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 4, 5, 68, 78, 83, 91, 10, 21, 18, 213, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xf0, 0xf1, 0xfb, 0xf3, 0xaa, 0xc5, 0xd5, 0xb5, 0x58, 0x59, 0x15, 0xfb, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 128, settingsAES_CTR); LoginInformation loginInformationModified = loginInformation.ShallowCopy(); loginInformationModified.UpdateCategory("Shopping"); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformationModified, "does not matter", skaAES_CTR, derivedKey); // Act string loginInformationCategory = loginInformationSecret.GetCategory(derivedKey); // Assert Assert.IsFalse(string.IsNullOrEmpty(loginInformationCategory)); Assert.AreEqual(loginInformationModified.category, loginInformationCategory); }
public ActionResult Login(LoginInformation loginInformation) { if (!ModelState.IsValid) { return View(); } Task<Users> verificationTask = null; verificationTask = VerifyLoginInformation(loginInformation); verificationTask.Wait(); Users resultUser = verificationTask.Result; if (resultUser != null) { var claims = new List<Claim> { new Claim(ClaimTypes.Name, resultUser.Username), new Claim(ClaimTypes.Role, resultUser.UserRole) }; var id = new ClaimsIdentity(claims, DefaultAuthenticationTypes.ApplicationCookie); var owinContext = Request.GetOwinContext(); var authenticationManager = owinContext.Authentication; authenticationManager.SignIn(id); if (resultUser.UserRole.Equals("ADMIN")) { return RedirectToAction("Index", "Admin"); } else { return RedirectToAction("Index", "User"); } } return View(); }
public void GetLoginInformationTagsTest() { // Arrange byte[] derivedKey = new byte[16] { 111, 222, 31, 47, 75, 168, 78, 83, 91, 110, 221, 18, 213, 104, 15, 16 }; byte[] initialCounter = new byte[] { 0xa0, 0xb1, 0xcb, 0xfd, 0xaa, 0xc5, 0xd5, 0xb5, 0x58, 0x59, 0x15, 0xfb, 0x33, 0xfd, 0xfe, 0xff }; SettingsAES_CTR settingsAES_CTR = new SettingsAES_CTR(initialCounter); SymmetricKeyAlgorithm skaAES_CTR = new SymmetricKeyAlgorithm(SymmetricEncryptionAlgorithm.AES_CTR, 256, settingsAES_CTR); LoginInformation loginInformationModified = loginInformation.ShallowCopy(); loginInformationModified.UpdateTags("personal"); LoginInformationSecret loginInformationSecret = new LoginInformationSecret(loginInformationModified, "does not matter", skaAES_CTR, derivedKey); // Act string loginInformationTags = loginInformationSecret.GetTags(derivedKey); // Assert Assert.IsFalse(string.IsNullOrEmpty(loginInformationTags)); Assert.AreEqual(loginInformationModified.tags, loginInformationTags); }
public static string loginApi(string user, string password) { ApiClient apiClient = Configuration.Default.ApiClient; string integratorKey = System.Configuration.ConfigurationManager.AppSettings["INTEGRATOR_KEY"]; string authHeader = $"{{\"Username\":\"{user}\",\"Password\":\"{password}\",\"IntegratorKey\":\"{integratorKey}\"}}"; Configuration.Default.AddDefaultHeader(DocuSignConstants.DocuSignHeader, authHeader); string accountId = null; AuthenticationApi authApi = new AuthenticationApi(); LoginInformation loginInfo = authApi.Login(); foreach (LoginAccount loginAcct in loginInfo.LoginAccounts) { if (loginAcct.IsDefault == "true") { accountId = loginAcct.AccountId; break; } } if (accountId == null && loginInfo.LoginAccounts.Count > 0) { accountId = loginInfo.LoginAccounts[0].AccountId; } return(accountId); }
public ICollection <object> ParseDataMin(MySqlDataReader dataReader) { var entities = new List <object>(); while (dataReader.Read()) { var entity = new LoginInformation { ID = (int)dataReader["ID"], OwnerName = dataReader["OwnerName"] as string, Country = dataReader["Country"] as string, Office = dataReader["Office"] as string, Url = dataReader["Url"] as string, LoginInformationID = dataReader["LoginInformationID"] as string, PW = dataReader["PW"] as string, AccountName = dataReader["AccountName"] as string, CurrentAccount = dataReader["CurrentAccount"] as string, SecretPhase = dataReader["SecretPhase"] as string, MonitoringStaff = dataReader["MonitoringStaff"] as string, OfficeID = dataReader["OfficeID"] as string, CompanyRegistrationNo = dataReader["CompanyRegistrationNo"] as string, Balance = dataReader["Balance"] as string, EmailAddress = dataReader["EmailAddress"] as string, }; entities.Add(entity); } return(entities); }
/// <summary> /// This action method deletes IB document from /// file system and makes IsDeleted = true entry in db /// </summary> /// <param name="docID">docID</param> /// <returns></returns> public ActionResult ClearDocument(int docID) { try { if (SessionManagement.UserInfo != null) { LoginInformation loginInfo = SessionManagement.UserInfo; var fileName = userDocumentBO.ClearUserDocument(loginInfo.UserID, docID); var fileExt = fileName.Substring(fileName.LastIndexOf('.')); if (fileName != String.Empty) { //Delete document file from file system System.IO.File.Delete(Directory.EnumerateFileSystemEntries(System.Web.HttpContext.Current.Server.MapPath("~/UserDocuments"), loginInfo.UserID + "-" + docID + fileExt).First()); return(Json(true)); } } return(Json(false)); } catch (Exception ex) { CurrentDeskLog.Error(ex.Message, ex); return(Json(false)); } }
public string GetAccountID() { #region auth_details string integratorKey = ConfigurationManager.AppSettings["IntegratorKey"]; string email = ConfigurationManager.AppSettings["DocuSignUserEmail"]; string password = ConfigurationManager.AppSettings["DocuSignPassword"]; string authHeader = "{\"Username\":\"" + email + "\", \"Password\":\"" + password + "\", \"IntegratorKey\":\"" + integratorKey + "\"}"; #endregion DocuSign.eSign.Client.Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader); #region attemptlogin ApiClient client = new ApiClient(basePath: "https://demo.docusign.net/restapi"); DocuSign.eSign.Client.Configuration configHeader = new DocuSign.eSign.Client.Configuration(client); configHeader.AddDefaultHeader("X-DocuSign-Authentication", authHeader); AuthenticationApi authApi = new AuthenticationApi(configHeader); LoginInformation loginInfo = authApi.Login(); #endregion return(loginInfo.LoginAccounts[0].AccountId); }