public Login(ConnectionsApiService connectionsApiService) { InitializeComponent(); txtUrl.Text="https://dubxpcvm1192.mul.ie.ibm.com:9444"; txtUser.Text= "ajones1"; txtPassword.Text = "jones1"; if (connectionsApiService!=null) { //show already authenticated lblAuthenticated.Text = string.Format("You're already authenticated as {0}", connectionsApiService.config.User); } }
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl) { if (!ModelState.IsValid) { return View(model); } var url = System.Configuration.ConfigurationManager.AppSettings["ConnectionsUrl"]; var connectionsApiService = new ConnectionsApiService(url, model.Username, model.Password); var result = connectionsApiService.AuthenticationService.Authenticate(model.Username, model.Password); if (result.Authenticated) { var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, result.Name), }, DefaultAuthenticationTypes.ApplicationCookie, ClaimTypes.Name, ClaimTypes.Role); identity.AddClaim(new Claim("Token", result.Token)); identity.AddClaim(new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", result.UserID)); identity.AddClaim(new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", result.Name)); // if you want roles, just add as many as you want here (for loop maybe?) identity.AddClaim(new Claim(ClaimTypes.Role, "guest")); // tell OWIN the identity provider, optional identity.AddClaim(new Claim("IdentityProvider", "ConnectionsAuth")); Authentication.SignIn(new AuthenticationProperties { IsPersistent = model.RememberMe }, identity); return RedirectToLocal(returnUrl); } else { ModelState.AddModelError("", "Invalid login attempt."); return View(model); } }
public MyFiles(ConnectionsApiService connectionsAPIService, string[] filter) { InitializeComponent(); Filter = filter; ConnectionsAPIService = connectionsAPIService; StartAsync(); // Set the view to show details. listViewFiles.View = View.Details; // Allow the user to edit item text. listViewFiles.LabelEdit = true; // Allow the user to rearrange columns. listViewFiles.AllowColumnReorder = true; // Display check boxes. listViewFiles.CheckBoxes = false; // Select the item and subitems when selection is made. listViewFiles.FullRowSelect = true; // Display grid lines. listViewFiles.GridLines = true; // Sort the items in the list in ascending order. listViewFiles.Sorting = System.Windows.Forms.SortOrder.Ascending; }
public ProfilesService(ConnectionsApiService currentInstance) { _apiService = currentInstance; }
private void btnLogin_Click(object sender, EventArgs e) { connectionsApiService = new ConnectionsApiService(txtUrl.Text, txtUser.Text, txtPassword.Text); this.Close(); }
void showAuthentication() { DialogResult dr = new DialogResult(); Login login = new Login(connectionsAPIService); dr = login.ShowDialog(); if (dr == DialogResult.OK) { connectionsAPIService = login.connectionsApiService; connectionsAPIService.config = login.connectionsApiService.config;//todo: perform deep copy } }
public CommunitiesService(ConnectionsApiService currentInstance) { _apiService = currentInstance; }
public AuthenticationService(ConnectionsApiService currentInstance) { _apiService = currentInstance; }