/// <summary>
        /// Authenticate me, via the CRM REST server, against LDAP with my credentials.
        /// </summary>
        /// <returns>The session id string on success, else a null or empty string.</returns>
        public string Authenticate()
        {
            string result = String.Empty;

            object loginData = new
            {
                user_auth = new
                {
                    user_name = username,
                    password  = EncryptPassword(this.password,
                                                ConstructEncryptionAlgorithm(this.key, this.initialisationVector)),
                    application_name = this.applicationName
                }
            };

            return(server.GetCrmResponse <RESTObjects.Login>("login", loginData).SessionID);
        }
Exemple #2
0
        /// <summary>
        /// Authenticate me, via the CRM REST server, against LDAP with my credentials.
        /// </summary>
        /// <returns>The session id string on success, else a null or empty string.</returns>
        public string Authenticate()
        {
            string result = String.Empty;

            object loginData = new
            {
                user_auth = new
                {
                    user_name = username,
                    password  = string.IsNullOrWhiteSpace(this.key) ?
                                this.password:
                                EncryptPassword(this.password,
                                                ConstructEncryptionAlgorithm(this.key, this.initialisationVector)),
                    encryption = string.IsNullOrWhiteSpace(this.key) ?
                                 "PLAIN" :
                                 Boolean.TrueString,
                    application_name = this.applicationName
                }
            };

            return(server.GetCrmResponse <RESTObjects.Login>("login", loginData).SessionID);
        }