Esempio n. 1
0
        public async Task <IHttpActionResult> GetUserByLogin()
        {
            try
            {
                string data = await Request.Content.ReadAsStringAsync();

                var query = JsonConvert.DeserializeObject <LdapUserQuery>(data);
                var ldap  = new LdapHelper(query.Server);
                var user  = ldap.GetUserByLogin(query.LoginName);
                if (user == null)
                {
                    throw new System.Exception($"Unable to find user: {query.LoginName}");
                }
                return(Ok(user));
            }
            catch
            {
                return(NotFound());
            }
        }