/// <summary> /// Gets Ldap details into the fields /// </summary> /// <returns>The name of the host node.</returns> private void GetLdapDetails() { iFolderServer server = web.GetServer(ServerID); remoteweb.PreAuthenticate = true; remoteweb.Credentials = web.Credentials; remoteweb.Url = server.PublicUrl + "/iFolderAdmin.asmx"; remoteweb.GetAuthenticatedUser(); server = remoteweb.GetServer(ServerID); //Pick information from IdentityProvider LdapInfo ldapInfo = remoteweb.GetLdapDetails(); LdapServer.Text = ldapInfo.Host; LdapSearchContext.Text = ldapInfo.SearchContexts; LdapProxyUser.Text = ldapInfo.ProxyDN; LdapProxyUserPwd.Text = ldapInfo.ProxyPassword; ConfirmLdapProxyUserPwd.Text = ldapInfo.ProxyPassword; string [] options = new string[2]; options[0] = GetString("YES"); options[1] = GetString("NO"); LdapSslList.DataSource = options; LdapSslList.DataBind(); LdapSslList.SelectedValue = ldapInfo.SSL ? GetString("YES") : GetString("NO"); }
private bool UpdateProxyUserInfo(string ldapAdmin, string ldapAdminPwd, string proxyDN, string ProxyDNPwd) { bool status = true; try { iFolderServer[] list = web.GetServers(); foreach (iFolderServer server in list) { //check all servers other than current server. if (server.ID != ServerID) { log.Info("Connecting to {0}", server.ID); remoteweb = new iFolderAdmin(); remoteweb.PreAuthenticate = true; remoteweb.Credentials = web.Credentials; remoteweb.Url = server.PublicUrl + "/iFolderAdmin.asmx"; remoteweb.GetAuthenticatedUser(); //Pick information from IdentityProvider LdapInfo ldapInfo = remoteweb.GetLdapDetails(); log.Info("Proxy User = {0} on {1}", ldapInfo.ProxyDN, server.ID); if (proxyDN == ldapInfo.ProxyDN) { //ldapInfo.ProxyDN = ProxyDN; ldapInfo.ProxyPassword = ProxyDNPwd; log.Info("Changing proxy user password on : {0}", server.ID); remoteweb.SetLdapDetails(ldapInfo, ldapAdmin, ldapAdminPwd, server.ID); } } } } catch (Exception ex) { status = false; log.Info("Exception in UpdateProxyUserInfo : (0)", ex.Message); TopNav.ShowInfo(String.Format(GetString("ALLSERVERPROXYPASSWORDCHANGEERROR"))); return(status); } return(status); }
/// <summary> /// Event handler that gets called when OK button is clicked. /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void OnOkButton_Click(object source, EventArgs e) { string currentServerProxyDN = null; string currentServerProxyDNPwd = null; bool proxychagnestatus = true; if (!validOK()) { TopNav.ShowError(GetString("ENTERLDAPDETAILS")); return; } if (!DataValidated()) { TopNav.ShowError(GetString("ERRORINVALIDDATA")); return; } if (String.Compare(LdapProxyUserPwd.Text.Trim(), ConfirmLdapProxyUserPwd.Text.Trim()) != 0) { TopNav.ShowError(GetString("ERRORPROXYPASSWORDSDOESNOTMATCH")); return; } /// if ldap admin username and password is right, go ahead iFolderServer server = web.GetServer(ServerID); remoteweb = new iFolderAdmin(); remoteweb.PreAuthenticate = true; remoteweb.Credentials = web.Credentials; remoteweb.Url = server.PublicUrl + "/iFolderAdmin.asmx"; remoteweb.GetAuthenticatedUser(); server = remoteweb.GetServer(ServerID); LdapInfo ldapInfo = new LdapInfo(); ldapInfo.Host = LdapServer.Text.Trim(); ldapInfo.SearchContexts = LdapSearchContext.Text; ldapInfo.ProxyDN = LdapProxyUser.Text; currentServerProxyDN = LdapProxyUser.Text; ldapInfo.ProxyPassword = LdapProxyUserPwd.Text; currentServerProxyDNPwd = LdapProxyUserPwd.Text; ldapInfo.SSL = (LdapSslList.SelectedValue == GetString("YES")) ? true : false; try { remoteweb.SetLdapDetails(ldapInfo, LdapAdminName.Text.Trim(), LdapAdminPwd.Text, ServerID); //now the proxy user info changed, check if the same proxy is //used in any other servers. if (ldapInfo.ProxyDN != null && ldapInfo.ProxyPassword != null) { proxychagnestatus = UpdateProxyUserInfo(LdapAdminName.Text.Trim(), LdapAdminPwd.Text, currentServerProxyDN, currentServerProxyDNPwd); } } catch (Exception ex) { TopNav.ShowInfo(String.Format("{0} {1}", GetString("UNABLETOEDITLDAPDETAILS"), ex.Message)); GetLdapDetails(); return; } if (proxychagnestatus != false) { Response.Redirect(String.Format("ServerDetails.aspx?ID={0}", ServerID)); } }