private async Task <TokenResponse> PerformLoginActions(string email, string password) { var response = await _loginClient.Login(email, password); if (!response.StatusIsSuccessful) { return(response); } var options = new AuthenticationProperties { AllowRefresh = true, IsPersistent = true, ExpiresUtc = DateTime.UtcNow.AddSeconds(response.Expires_In) }; var claims = new[] { new Claim(ClaimTypes.Name, email), new Claim("AcessToken", $"Bearer {response.Data}"), new Claim("FirstName", response.FirstName), new Claim("LastName", response.LastName), new Claim("Roles", response.Roles) }; var identity = new ClaimsIdentity(claims, "ApplicationCookie"); Request.GetOwinContext().Authentication.SignIn(options, identity); return(response); }
private void executeFullLogin() { LoginResult loginResult = r_LoginClient.Login(r_Permissions); this.User = loginResult.LoggedInUser; this.AccessToken = loginResult.AccessToken; LoginResult connectResult = r_LoginClient.Connect(AccessToken); this.DialogResult = DialogResult.OK; this.Close(); }
private async Task <bool> PerformLoginActions(string email, string password) { var response = await loginClient.Login(email, password); if (response.StatusIsSuccessful) { tokenContainer.ApiToken = response.Data; } return(response.StatusIsSuccessful); }
public bool LoginAccount(string login, string password) { if (string.IsNullOrEmpty(password)) { return(false); } try { var servers = GetServers(); //workaround for login.php problem. see comment in LoginClient. var data = loginclient.Login(login, "" + password, servers[0].Hash); if (!data.PasswordCorrect) { return(false); } IsLoggedIn = true; this.LoginName = login; this.LoginPassword = password; return(true); } catch { return(false); } }