Problems with setting up AD Authentication for Commerce Manager



I've set up my Commerce Manager Startup.cs and updated the web.config for the Commerce Manager site as described here

In my AD Application definition, I've set the Redirect URI to the same value as the app setting "CommerceManagerLink"

(In the Commerce Manager web.config file, membership and roleManager sections are empty, and authentication has mode="None")

However, when I log in to EPiServer then click the Commerce Manager link or browse directly to the Commerce Manager URI, the Login.aspx page is shown.

Any ideas why I'm not being redirected to Ad to authenticate?

Note that I've set up 2 applications in AD: one for the EPiServer CMS back-end and one for Commerce Manager - is this the correct approach?

Edited, Dec 12, 2019 11:33

I believe we need to tell OWIN to map the login path (/Apps/Shell/Pages/Login.aspx) to redirect or challenge your provider when someone tries to access the site or login page. Here is an example

app.Map(LoginPath, map =>
            map.Run(ctx =>
Microsoft.Owin.Security.IAuthenticationManager owinAuthenticationManager = ctx.Authentication;
			// Set the Owin Authentication Challenge
			AuthenticationProperties props = new AuthenticationProperties();
			props.RedirectUri = "URL to redirect after successful authentication";

			owinAuthenticationManager.Challenge(props, "ProviderName");
                return Task.FromResult(0);

~ Sujit

Dec 19, 2019 23:35
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.