Here is my code in Startup.Auth.cs
public void ConfigureAuth(IAppBuilder app) {
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLogoutRedirectUri,
TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer=false,
NameClaimType = "upn",
RoleClaimType ="roles"
}
});
}
And in My MVC View I am checking the @User.IsInRole("CBUser") which returns True since the user is having the role as CBUSer . All this code works fine in Visual Studio with Azure AD Authentication and Authorization . But When I move the application to Azure ,@User.IsInRole("CBUser") always returns false. How can Can I read the User Roles either in MVC View or in Controller .I tried below code to read the user roles which is working fine in while debugging in VS2015 .But does not work once application moved to Azure environment
var appRoles = new List<string>();
foreach (Claim claim in ClaimsPrincipal.Current.FindAll("roles"))
appRoles.Add(claim.Value);
clientIdvalue for the app deployed to Azure? - Philippe Signoret