Exemplo n.º 1
0
        public void DeleteLSCCredential(OpenVASLSCCredential credentials)
        {
            if (credentials.RemoteCredentialsID == Guid.Empty)
            {
                throw new Exception("Can't delete credentials that haven't been created.");
            }

            XmlDocument response = this.DeleteLSCCredential(credentials.RemoteCredentialsID.ToString());

            foreach (XmlAttribute attr in response.Attributes)
            {
                if (attr.Name == "status" && attr.Value != "200")
                {
                    throw new Exception("Deleting credentials failed");
                }
            }
        }
Exemplo n.º 2
0
        public OpenVASLSCCredential CreateLSCCredential(OpenVASLSCCredential credentials)
        {
            if (credentials.RemoteCredentialsID != Guid.Empty)
            {
                throw new Exception("This set of credentials as already been created.");
            }

            XmlDocument response = this.CreateLSCCredential(credentials.Name, credentials.LoginUsername, credentials.Password, credentials.Comment);

            foreach (XmlAttribute attr in response.Attributes)
            {
                if (attr.Name == "id")
                {
                    credentials.RemoteCredentialsID = new Guid(attr.Name);
                }
            }

            return(credentials);
        }
        public void DeleteLSCCredential(OpenVASLSCCredential credentials)
        {
            if (credentials.RemoteCredentialsID == Guid.Empty)
                throw new Exception("Can't delete credentials that haven't been created.");

            XmlDocument response = this.DeleteLSCCredential(credentials.RemoteCredentialsID.ToString());

            foreach (XmlAttribute attr in response.Attributes)
            {
                if (attr.Name == "status" && attr.Value != "200")
                    throw new Exception("Deleting credentials failed");
            }
        }
        public OpenVASLSCCredential CreateLSCCredential(OpenVASLSCCredential credentials)
        {
            if (credentials.RemoteCredentialsID != Guid.Empty)
                throw new Exception("This set of credentials as already been created.");

            XmlDocument response = this.CreateLSCCredential(credentials.Name, credentials.LoginUsername, credentials.Password, credentials.Comment);

            foreach (XmlAttribute attr in response.Attributes)
            {
                if (attr.Name == "id")
                    credentials.RemoteCredentialsID = new Guid(attr.Name);
            }

            return credentials;
        }