/// <summary>Sets the Auth data to empty</summary> /// <param name="AuthType">The Auth type, although it doesn't matter what it's set to this overload will set it to "None"</param> public void Authdata(GlobalDS.AuthType AuthType) { _AuthUser = string.Empty; _AuthPassword = string.Empty; _AuthDomain = string.Empty; _AuthenticationMethod = GlobalDS.AuthType.None; if (AuthType != GlobalDS.AuthType.None) { throw new Exception("Missing Information, AuthType set to 'None'"); } return; }
private void ExtractAuthenticationDataFromXml(ref XmlNode TargetNode) { XmlNode AuthDataNode = TargetNode.SelectSingleNode("authentication"); if (AuthDataNode == null || AuthDataNode.Attributes["authtype"] == null || !System.Enum.IsDefined(typeof(GlobalDS.AuthType), AuthDataNode.Attributes["authtype"].InnerText)) // Older Data file { _AuthenticationMethod = GlobalDS.AuthType.None; _AuthUser = string.Empty; _AuthPassword = string.Empty; _AuthDomain = string.Empty; return; } _AuthenticationMethod = (GlobalDS.AuthType)System.Enum.Parse(typeof(GlobalDS.AuthType), AuthDataNode.Attributes["authtype"].InnerText); XmlNode tmpnode = AuthDataNode.SelectSingleNode("username"); if (tmpnode == null || tmpnode.Attributes["value"] == null) { _AuthUser = string.Empty; } else { _AuthUser = tmpnode.Attributes["value"].InnerText; } tmpnode = AuthDataNode.SelectSingleNode("password"); if (tmpnode == null || tmpnode.Attributes["value"] == null) { _AuthPassword = string.Empty; } else { _AuthPassword = tmpnode.Attributes["value"].InnerText; } tmpnode = AuthDataNode.SelectSingleNode("domain"); if (tmpnode == null || tmpnode.Attributes["value"] == null) { _AuthDomain = string.Empty; } else { _AuthDomain = tmpnode.Attributes["value"].InnerText; } return; }
/// <summary>Sets the authentication data</summary> /// <param name="AuthType">The authentication type</param> /// <param name="Credentials">The authentication credentials</param> public void Authdata(GlobalDS.AuthType AuthType, System.Net.NetworkCredential Credentials) { _AuthUser = Credentials.UserName; _AuthPassword = Credentials.Password; _AuthDomain = Credentials.Domain; if (AuthType == GlobalDS.AuthType.None) { Authdata(AuthType); return; } _AuthenticationMethod = AuthType; if (AuthType != GlobalDS.AuthType.NTLM) { _AuthDomain = string.Empty; } }
/// <summary>Sets the authentication data</summary> /// <param name="AuthType">The authentication type</param> /// <param name="Username">The authentication username</param> /// <param name="Password">The authentication password</param> public void Authdata(GlobalDS.AuthType AuthType, string Username, string Password) { _AuthUser = Username; _AuthPassword = Password; _AuthDomain = string.Empty; if (AuthType == GlobalDS.AuthType.None) { Authdata(AuthType); return; } _AuthenticationMethod = AuthType; if (AuthType == GlobalDS.AuthType.NTLM) { _AuthenticationMethod = GlobalDS.AuthType.Basic; throw new Exception("Missing Domain information, AuthType set to 'Basic'"); } }
/// <summary>Sets the authentication data</summary> /// <param name="AuthType">The authentication type</param> /// <param name="Credentials">The authentication credentials</param> public void Authdata(GlobalDS.AuthType AuthType, System.Net.NetworkCredential Credentials) { _AuthUser = Credentials.UserName; _AuthPassword = Credentials.Password; _AuthDomain = Credentials.Domain; if (AuthType == GlobalDS.AuthType.None) { Authdata(AuthType); return; } _AuthenticationMethod = AuthType; if (AuthType != GlobalDS.AuthType.NTLM) _AuthDomain = string.Empty; }
private void ExtractAuthenticationDataFromXml(ref XmlNode TargetNode) { XmlNode AuthDataNode = TargetNode.SelectSingleNode("authentication"); if (AuthDataNode == null || AuthDataNode.Attributes["authtype"] == null || !System.Enum.IsDefined(typeof(GlobalDS.AuthType), AuthDataNode.Attributes["authtype"].InnerText)) // Older Data file { _AuthenticationMethod = GlobalDS.AuthType.None; _AuthUser = string.Empty; _AuthPassword = string.Empty; _AuthDomain = string.Empty; return; } _AuthenticationMethod = (GlobalDS.AuthType)System.Enum.Parse(typeof(GlobalDS.AuthType), AuthDataNode.Attributes["authtype"].InnerText); XmlNode tmpnode = AuthDataNode.SelectSingleNode("username"); if (tmpnode == null || tmpnode.Attributes["value"] == null) _AuthUser = string.Empty; else _AuthUser = tmpnode.Attributes["value"].InnerText; tmpnode = AuthDataNode.SelectSingleNode("password"); if (tmpnode == null || tmpnode.Attributes["value"] == null) _AuthPassword = string.Empty; else _AuthPassword = tmpnode.Attributes["value"].InnerText; tmpnode = AuthDataNode.SelectSingleNode("domain"); if (tmpnode == null || tmpnode.Attributes["value"] == null) _AuthDomain = string.Empty; else _AuthDomain = tmpnode.Attributes["value"].InnerText; return; }