title: Role Management in ASP MVC 5 (Microsoft.AspNet.Identity)
body: <p>in ASP MVC5 RC I didn't get the role system to work.
  My database has all needs tables an role exist but proofing if user is in role always return false (no SQL exception or something)!?</p>
  
  <p>Did I need to activate role system for <code>IPrincipal</code> somewhere?</p>
  
  <p>Test code:</p>
  
  <pre><code>AccountController accCont = new AccountController();
  
  // check role exist : result = true
  var roleExist = await accCont.IdentityManager.Roles.RoleExistsAsync("61c84919-72e2-4114-9520-83a3e5f09de1");
  
  // try find role by name : result = role object
  var role = await accCont.IdentityManager.Roles.FindRoleByNameAsync("ProjectAdministrator");
  
  // check with AccountController instance :  result = true
  var exist = await accCont.IdentityManager.Roles.IsUserInRoleAsync(User.Identity.GetUserId(), role.Id);
  
  // check if current user is in role : result (both) = false????
  var inRole = User.IsInRole(role.Id);
  var inRole2 = User.IsInRole(role.Name);
  </code></pre>
  
  <p>I also try to build an custom extenuation like the <code>IIdentity.GetUserId()</code> extension method from <code>Microsoft.AspNet.Identity.Owin</code> Namespace.</p>
  
  <pre><code>namespace Microsoft.AspNet.Identity
  {
     public static class IdentityExtensions
     {
         public static string IsUserInRole(this IIdentity identity)
         {
             if (identity == null)
             {
                 throw new ArgumentNullException("identity");
             }
             ClaimsIdentity identity2 = identity as ClaimsIdentity;
             if (identity2 != null)
             {
                 var result = identity2.FindFirstValue(IdentityConfig.Settings.GetAuthenticationOptions().RoleClaimType);
  
                 return null; // later result
             }
             return null;
         }
     }
  }
  </code></pre>
  
  <p>But the result for claim Type <code>RoleClaimType</code> is always <code>null</code> :(
  I'm really stuck with this.</p>
  
  <p>Thank you for your help! Steffen</p>