{"id":250,"date":"2021-01-31T13:16:00","date_gmt":"2021-01-31T13:16:00","guid":{"rendered":"https:\/\/www.naveedulhaq.com\/?p=250"},"modified":"2021-01-31T14:03:21","modified_gmt":"2021-01-31T14:03:21","slug":"authenticate-authorize-a-user-using-local-ad","status":"publish","type":"post","link":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/","title":{"rendered":"Authenticate \/ Authorize a user using local AD"},"content":{"rendered":"\n<p>Authentication and authorization might sound similar but there is a very subtle difference between these two terms.<\/p>\n\n\n\n<p>Authentication is just confirmation of user identity. Such as we know about this user (based on user name and password)<\/p>\n\n\n\n<p>Authorization is when we determine if the user has permissions (access rights) to do what he needs to do. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/01\/authentication-and-authorization-1024x640.jpg\" loading=\"lazy\" alt=\"authenticate and authorize\" class=\"wp-image-268\" srcset=\"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/01\/authentication-and-authorization-1024x640.jpg 1024w, https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/01\/authentication-and-authorization-300x188.jpg 300w, https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/01\/authentication-and-authorization-768x480.jpg 768w, https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/01\/authentication-and-authorization-1536x960.jpg 1536w, https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/01\/authentication-and-authorization.jpg 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p> A lot of times we have to host back-office applications or WebApis in our local on-premises data center.  we also need to authenticate Web Api user using local AD (Active directory) and not Azure AD.<\/p>\n\n\n\n<p>In Web API it is very simple, you can create a Custom authentication attribute for user authentication. This custom authentication attribute is responsible to connect with AD and validates username and password.  <\/p>\n\n\n\n<p>First of all you need to install following NuGet packages in your project<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>DirectoryServices<\/li><li>DirectoryServices.AccountManagement<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Authentication using custom authorize attribute<\/h2>\n\n\n\n<p>There is a minimum of two methods of authorizing attribute that we need to override.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>IsAuthorized &#8211; Returns boolean, depends if the request is authenticated.<\/li><li>HandleUnauthorizedRequest &#8211; Sends appropriate message when the request is not authenticated. <\/li><\/ul>\n\n\n\n<pre><code>using System.Diagnostics;\nusing System.Web.Http;\nusing System.Web.Http.Controllers;\n\nnamespace WebApi.Business\n{\n    public class AdAuth : AuthorizeAttribute\n    {\n        protected override bool IsAuthorized(HttpActionContext actionContext)\n        {\n            var user = UserManager.GetUserFromContext();\n            var isValidUser = UserManager.IsUserValid(user.UserName, user.Password);\n            return isValidUser;\n        }\n\n        protected override void HandleUnauthorizedRequest(HttpActionContext actionContext)\n        {\n            Debug.WriteLine(\"user is not authorized.\");\n            base.HandleUnauthorizedRequest(actionContext);\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">User Manager<\/h2>\n\n\n\n<p>if you notice code I have used custom UserManager class to get context and check if the user is valid based on username and password. <\/p>\n\n\n\n<p>This class is just a helper class and I have used it to get UserContext and Tokens (groups) so evaluate user access rights.<\/p>\n\n\n\n<pre><code>using System;\nusing System.DirectoryServices.AccountManagement;\nusing System.Text;\nusing System.Web;\n\nnamespace WebApi.Helpers\n{\n    public static class UserManager\n    {\n        public static bool IsUserValid(string userName, string password)\n        {\n            try\n            {\n                using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, \"-your-ad-domain\"))\n                {\n                    var valid = pc.ValidateCredentials(userName, password);\n                    return valid;\n                }\n            }\n            catch (Exception)\n            {\n                return false;\n            }\n        }\n\n        public static User GetUserFromContext()\n        {\n            var user = new User();\n            HttpContext httpContext = HttpContext.Current;\n            string authHeader = httpContext.Request.Headers&#91;\"Authorization\"];\n\n            if (authHeader != null &amp;&amp; authHeader.StartsWith(\"Basic\"))\n            {\n                string encodedUsernamePassword = authHeader.Substring(\"Basic \".Length).Trim();\n                Encoding encoding = Encoding.GetEncoding(\"iso-8859-1\");\n                string usernamePassword = encoding.GetString(Convert.FromBase64String(UserToken()));\n\n                int seperatorIndex = usernamePassword.IndexOf(':');\n\n                var username = usernamePassword.Substring(0, seperatorIndex);\n                var password = usernamePassword.Substring(seperatorIndex + 1);\n\n                user.UserName = username;\n                user.Password = password;\n            }\n\n            return user;\n        }\n\n        public static string UserToken()\n        {\n            HttpContext httpContext = HttpContext.Current;\n            string authHeader = httpContext.Request.Headers&#91;\"Authorization\"];\n            if (authHeader != null &amp;&amp; authHeader.StartsWith(\"Basic\"))\n            {\n                string encodedUsernamePassword = authHeader.Substring(\"Basic \".Length).Trim();\n                return encodedUsernamePassword;\n            }\n\n            return string.Empty;\n        }\n\n       \n    }\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Authorization based on User groups<\/h2>\n\n\n\n<p>In authorization, we will determine if a user is in the right groups to access the required data. Every project has a different way to implement it. For example, you might not want to let the user access certain API based on which user group they belong to.<\/p>\n\n\n\n<p>I have created a separate user group controller. That will give you a list of user groups and you can add your logic based on these user groups.<\/p>\n\n\n\n<pre><code>using System.Collections.Generic;\nusing System.DirectoryServices.AccountManagement;\nusing System.Linq;\nusing System.Web.Http;\n\nnamespace WebApi.Controllers\n{\n    &#91;AdAuth]\n    public class UserGroupsController : ApiController\n    {\n        public IEnumerable&lt;string> Get()\n        {\n\n            var userGrps = new List&lt;string>();\n            var user = UserManager.GetUserFromContext();\n            var isValidUser = UserManager.IsUserValid(user.UserName, user.Password);\n\n            if (!isValidUser) return userGrps;\n\n            var userToken = UserManager.UserToken();\n            userGrps.Add($\"Token:{userToken}\");\n            UserPrincipal userPrinciple = UserPrincipal.FindByIdentity(\n                new PrincipalContext(ContextType.Domain, \"--your-ad-domain--\"), IdentityType.SamAccountName, user.UserName);\n            if (userPrinciple != null)\n            {\n                userGrps.AddRange(from GroupPrincipal @group in userPrinciple.GetGroups() select @group.Name);\n            }\n\n            return userGrps;\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Authentication and authorization might sound similar but there is a very subtle difference between these two terms. Authentication is just confirmation of user identity. Such&#8230;<\/p>\n","protected":false},"author":1,"featured_media":72,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[11,8,54,52,53,41],"class_list":["post-250","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dot-net-core","tag-dot-net-core","tag-dot-net-framework","tag-ad","tag-authenticate","tag-authorize","tag-cybersecurity"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Authenticate \/ Authorize a user using local AD - Naveed Ul-Haq&#039;s blog<\/title>\n<meta name=\"description\" content=\"If we host Web API in our on-premises data center, we can authenticate &amp; authorize user using local AD - .NET - Naveed Ul-Haq&#039;s blog\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Authenticate \/ Authorize a user using local AD - Naveed Ul-Haq&#039;s blog\" \/>\n<meta property=\"og:description\" content=\"If we host Web API in our on-premises data center, we can authenticate &amp; authorize user using local AD - .NET - Naveed Ul-Haq&#039;s blog\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/\" \/>\n<meta property=\"og:site_name\" content=\"Naveed Ul-Haq&#039;s blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-31T13:16:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-01-31T14:03:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2019\/04\/240px-.NET_Core_Logo.svg_.png\" \/>\n\t<meta property=\"og:image:width\" content=\"240\" \/>\n\t<meta property=\"og:image:height\" content=\"240\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Naveed Ul-Haq\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Naveed Ul-Haq\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/\"},\"author\":{\"name\":\"Naveed Ul-Haq\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\"},\"headline\":\"Authenticate \\\/ Authorize a user using local AD\",\"datePublished\":\"2021-01-31T13:16:00+00:00\",\"dateModified\":\"2021-01-31T14:03:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/\"},\"wordCount\":318,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/240px-.NET_Core_Logo.svg_.png\",\"keywords\":[\".net core\",\".net framework\",\"AD\",\"Authenticate\",\"Authorize\",\"cybersecurity\"],\"articleSection\":[\".NET\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/\",\"name\":\"Authenticate \\\/ Authorize a user using local AD - Naveed Ul-Haq&#039;s blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/240px-.NET_Core_Logo.svg_.png\",\"datePublished\":\"2021-01-31T13:16:00+00:00\",\"dateModified\":\"2021-01-31T14:03:21+00:00\",\"description\":\"If we host Web API in our on-premises data center, we can authenticate & authorize user using local AD - .NET - Naveed Ul-Haq&#039;s blog\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/240px-.NET_Core_Logo.svg_.png\",\"contentUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/240px-.NET_Core_Logo.svg_.png\",\"width\":240,\"height\":240,\"caption\":\".net core\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/authenticate-authorize-a-user-using-local-ad\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.naveedulhaq.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Authenticate \\\/ Authorize a user using local AD\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#website\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/\",\"name\":\"Naveed Ul-Haq's blog\",\"description\":\"AI, Optimizely, Azure &amp; more\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.naveedulhaq.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\",\"name\":\"Naveed Ul-Haq\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"caption\":\"Naveed Ul-Haq\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\"},\"description\":\"I lead engineering delivery teams for digital commerce and digital experience platforms, combining hands-on architecture experience with strong delivery governance. Over 20+ years, I\u2019ve built and led cross\u2011functional teams (engineering, BA, QA) delivering modern cloud solutions on Azure, microservices, APIs and eCommerce\\\/CMS platforms. My recent focus includes AI-enabled commerce automation: product ingestion and enrichment workflows, content optimisation for SEO and shopping feeds, and agentic tooling to improve marketing and accessibility workflows. I\u2019m passionate about building high-performing teams, establishing quality\\\/release standards, and delivering measurable outcomes across performance, reliability, and speed of change.\",\"sameAs\":[\"https:\\\/\\\/www.naveedulhaq.com\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/naveedulhaq\\\/\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Authenticate \/ Authorize a user using local AD - Naveed Ul-Haq&#039;s blog","description":"If we host Web API in our on-premises data center, we can authenticate & authorize user using local AD - .NET - Naveed Ul-Haq&#039;s blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/","og_locale":"en_GB","og_type":"article","og_title":"Authenticate \/ Authorize a user using local AD - Naveed Ul-Haq&#039;s blog","og_description":"If we host Web API in our on-premises data center, we can authenticate & authorize user using local AD - .NET - Naveed Ul-Haq&#039;s blog","og_url":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/","og_site_name":"Naveed Ul-Haq&#039;s blog","article_published_time":"2021-01-31T13:16:00+00:00","article_modified_time":"2021-01-31T14:03:21+00:00","og_image":[{"width":240,"height":240,"url":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2019\/04\/240px-.NET_Core_Logo.svg_.png","type":"image\/png"}],"author":"Naveed Ul-Haq","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Naveed Ul-Haq","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/#article","isPartOf":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/"},"author":{"name":"Naveed Ul-Haq","@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9"},"headline":"Authenticate \/ Authorize a user using local AD","datePublished":"2021-01-31T13:16:00+00:00","dateModified":"2021-01-31T14:03:21+00:00","mainEntityOfPage":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/"},"wordCount":318,"commentCount":0,"publisher":{"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9"},"image":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/#primaryimage"},"thumbnailUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2019\/04\/240px-.NET_Core_Logo.svg_.png","keywords":[".net core",".net framework","AD","Authenticate","Authorize","cybersecurity"],"articleSection":[".NET"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/","url":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/","name":"Authenticate \/ Authorize a user using local AD - Naveed Ul-Haq&#039;s blog","isPartOf":{"@id":"https:\/\/www.naveedulhaq.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/#primaryimage"},"image":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/#primaryimage"},"thumbnailUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2019\/04\/240px-.NET_Core_Logo.svg_.png","datePublished":"2021-01-31T13:16:00+00:00","dateModified":"2021-01-31T14:03:21+00:00","description":"If we host Web API in our on-premises data center, we can authenticate & authorize user using local AD - .NET - Naveed Ul-Haq&#039;s blog","breadcrumb":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/#primaryimage","url":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2019\/04\/240px-.NET_Core_Logo.svg_.png","contentUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2019\/04\/240px-.NET_Core_Logo.svg_.png","width":240,"height":240,"caption":".net core"},{"@type":"BreadcrumbList","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/authenticate-authorize-a-user-using-local-ad\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.naveedulhaq.com\/"},{"@type":"ListItem","position":2,"name":"Authenticate \/ Authorize a user using local AD"}]},{"@type":"WebSite","@id":"https:\/\/www.naveedulhaq.com\/#website","url":"https:\/\/www.naveedulhaq.com\/","name":"Naveed Ul-Haq's blog","description":"AI, Optimizely, Azure &amp; more","publisher":{"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.naveedulhaq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9","name":"Naveed Ul-Haq","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","caption":"Naveed Ul-Haq"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g"},"description":"I lead engineering delivery teams for digital commerce and digital experience platforms, combining hands-on architecture experience with strong delivery governance. Over 20+ years, I\u2019ve built and led cross\u2011functional teams (engineering, BA, QA) delivering modern cloud solutions on Azure, microservices, APIs and eCommerce\/CMS platforms. My recent focus includes AI-enabled commerce automation: product ingestion and enrichment workflows, content optimisation for SEO and shopping feeds, and agentic tooling to improve marketing and accessibility workflows. I\u2019m passionate about building high-performing teams, establishing quality\/release standards, and delivering measurable outcomes across performance, reliability, and speed of change.","sameAs":["https:\/\/www.naveedulhaq.com","https:\/\/www.linkedin.com\/in\/naveedulhaq\/"]}]}},"_links":{"self":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts\/250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/comments?post=250"}],"version-history":[{"count":0,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts\/250\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/media\/72"}],"wp:attachment":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/media?parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/categories?post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/tags?post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}