{"action":"closed","issue":{"url":"https://api.github.com/repos/aspnet/Identity/issues/689","labels_url":"https://api.github.com/repos/aspnet/Identity/issues/689/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Identity/issues/689/comments","events_url":"https://api.github.com/repos/aspnet/Identity/issues/689/events","html_url":"https://github.com/aspnet/Identity/issues/689","id":123368843,"number":689,"title":"Claims are not loading even when I override FindByNameAsync","user":{"login":"jvelezc","id":3653845,"avatar_url":"https://avatars.githubusercontent.com/u/3653845?v=3","gravatar_id":"","url":"https://api.github.com/users/jvelezc","html_url":"https://github.com/jvelezc","followers_url":"https://api.github.com/users/jvelezc/followers","following_url":"https://api.github.com/users/jvelezc/following{/other_user}","gists_url":"https://api.github.com/users/jvelezc/gists{/gist_id}","starred_url":"https://api.github.com/users/jvelezc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvelezc/subscriptions","organizations_url":"https://api.github.com/users/jvelezc/orgs","repos_url":"https://api.github.com/users/jvelezc/repos","events_url":"https://api.github.com/users/jvelezc/events{/privacy}","received_events_url":"https://api.github.com/users/jvelezc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-21T22:07:10Z","updated_at":"2016-01-13T01:21:37Z","closed_at":"2016-01-13T01:21:37Z","body":"Problem: I want to know a user his roles and his claims. \r\nI try to use \r\n   var currentUserName = HttpContext.User.GetUserName();\r\n            var user = _userManager.FindByNameAsync(currentUserName).Result;\r\nbut because of lazy loading it does not load the related entities. \r\n\r\nThen I went ahead and tried to load them explicitly but only the roles are populated. \r\n\r\nIt does not load claims associated with the roles.\r\n``` \r\n public override Task<ApplicationUser> FindByNameAsync(string userName)\r\n        {\r\n  \r\n            return this.Users.Include(roles=>roles.Roles).Include(y=>y.Claims).FirstOrDefaultAsync(y => y.UserName == userName);\r\n           // return base.FindByNameAsync(userName);\r\n        }\r\n```\r\n\r\n```\r\nMy Work Around\r\n\r\n\r\n\r\n   var currentUserName = HttpContext.User.GetUserName();\r\n            var user = _userManager.FindByNameAsync(currentUserName).Result;\r\n\r\n            if (user != null)\r\n            {\r\n                var userRoles = _userManager.GetRolesAsync(user).Result;\r\n                var role = _applicationRoleManager.FindByNameAsync(userRoles.FirstOrDefault()).Result;\r\n                var myClaims = _applicationRoleManager.GetClaimsAsync(role).Result;\r\n                var claims = _userManager.GetClaimsAsync(user).Result;\r\n                var x = _userManager.GetLoginsAsync(user).Result;\r\n\r\n            }\r\n    var myClaims = _applicationRoleManager.GetClaimsAsync(role).Result;\r\n```\r\n\r\nthen compose the claim and return the actual entity with the correct claims. "}}