active-directory-aspnetcore-webapp-openidconnect-v2
active-directory-aspnetcore-webapp-openidconnect-v2 copied to clipboard
Missing Controller
active-directory-aspnetcore-webapp-openidconnect-v2/1-WebApp-OIDC/1-5-B2C/Controllers/
Project missing Account controller.
<li class="navbar-btn"> <form method="get" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="EditProfile"> <button type="submit" class="btn btn-primary" style="margin-right:5px">Edit Profile</button> </form> </li> <li class="navbar-btn"> <form method="get" asp-area="MicrosoftIdentity" asp-controller="Account" asp-action="SignOut"> <button type="submit" class="btn btn-primary">Sign Out</button> </form> </li>
@karayakar what problem are you seeing? what are your repro steps? the account controller is in Microsoft.Identity.Web.UI: https://github.com/AzureAD/microsoft-identity-web/blob/master/src/Microsoft.Identity.Web.UI/Areas/MicrosoftIdentity/Controllers/AccountController.cs
I cannot repro this, @karayakar Please provide repro steps
Thank you @jmprieur and @dzielin. The issue is in my AD which I didn't setup AD B2C. I have ended up using MSAL to solve issue using AzureAD. Thank you.
` var tokenProvider = new MsalTokenProvider(new MsalTokenProviderOptions { ScopePlaceholderMappings = new Dictionary<string, string> { { OpsArcResearch.Common.Constants.Placeholders.WebApiAppIdUri, Configuration["App:WebApi:AppIdUri"] } }, CallbackPath = Configuration["AzureAd:CallbackPath"] ?? string.Empty, ClientId = Configuration["AzureAd:ClientId"], ClientSecret = Configuration["AzureAd:ClientSecret"], TenantId = Configuration["AzureAd:TenantId"] }); services.AddSingleton<MsalTokenProvider>(tokenProvider);
// Don't map any standard OpenID Connect claims to Microsoft-specific claims.
// See https://leastprivilege.com/2017/11/15/missing-claims-in-the-asp-net-core-2-openid-connect-handler/.
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
// Add Azure AD authentication using OpenID Connect.
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
.AddAzureAD(options => Configuration.Bind("AzureAd", options));
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
{
options.ClaimActions.Clear();
options.Authority += "/v2.0";
options.TokenValidationParameters.ValidAudiences = new[]
{
Configuration["AzureAd:ClientId"], $"api://{Configuration["AzureAd:ClientId"]}",
};
options.TokenValidationParameters.ValidIssuers = new[]
{
$"https://sts.windows.net/{Configuration["AzureAd:TenantId"]}/",
$"https://login.microsoftonline.com/{Configuration["AzureAd:TenantId"]}/v2.0",`
...................