{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Security/issues/894","repository_url":"https://api.github.com/repos/aspnet/Security","labels_url":"https://api.github.com/repos/aspnet/Security/issues/894/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Security/issues/894/comments","events_url":"https://api.github.com/repos/aspnet/Security/issues/894/events","html_url":"https://github.com/aspnet/Security/issues/894","id":164815527,"number":894,"title":"ASP.NET Core authentication to Azure AD to get||set Role","user":{"login":"wangkanai","id":10666633,"avatar_url":"https://avatars.githubusercontent.com/u/10666633?v=3","gravatar_id":"","url":"https://api.github.com/users/wangkanai","html_url":"https://github.com/wangkanai","followers_url":"https://api.github.com/users/wangkanai/followers","following_url":"https://api.github.com/users/wangkanai/following{/other_user}","gists_url":"https://api.github.com/users/wangkanai/gists{/gist_id}","starred_url":"https://api.github.com/users/wangkanai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangkanai/subscriptions","organizations_url":"https://api.github.com/users/wangkanai/orgs","repos_url":"https://api.github.com/users/wangkanai/repos","events_url":"https://api.github.com/users/wangkanai/events{/privacy}","received_events_url":"https://api.github.com/users/wangkanai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-11T11:26:26Z","updated_at":"2016-07-14T05:17:06Z","closed_at":null,"body":"I have a few questions i can't find regarding ASP.NET core connecting Azure AD using OpenIdConnect.\r\n- How do i get the role that User is assigned to? `User.IsInRole(\"xxx\")` also return `false`\r\n- How do I set the role to the User? Don't know where to start :-(\r\n- How do i add new claim to the User? Don't know where to start also\r\n\r\n**Startup.cs**\r\n```\r\napp.UseOpenIdConnectAuthentication(new OpenIdConnectOptions\r\n{\r\n    ClientId = Configuration[\"Authentication:AzureAd:ClientId\"],\r\n    ClientSecret = Configuration[\"Authentication:AzureAd:ClientSecret\"],\r\n    Authority = Configuration[\"Authentication:AzureAd:AADInstance\"] \r\n       + Configuration[\"Authentication:AzureAd:TenantId\"],\r\n    CallbackPath = Configuration[\"Authentication:AzureAd:CallbackPath\"],\r\n    ResponseType = OpenIdConnectResponseType.CodeIdToken               \r\n});\r\n```\r\n**Indes.cshtml**\r\n```\r\n<div>\r\n    <h3>Claims</h3>\r\n    <table class=\"table\">\r\n        <tr>\r\n            <th>Type</th>\r\n            <th>Value</th>\r\n        </tr>\r\n        @foreach (var claim in User.Claims)\r\n        {\r\n            <tr>\r\n                <td>@claim.Type</td>\r\n                <td>@claim.Value</td>\r\n            </tr>\r\n        }\r\n    </table>\r\n</div>\r\n```\r\nType | Value\r\n-------|----\r\naud | xxx\r\niss | xxx\r\niat | xxx\r\nnbf | xxx\r\nexp | xxx\r\nhttp://schemas.microsoft.com/claims/authnmethodsreferences | xxx\r\nc_hash | xxx\r\nhttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname | xxx\r\nhttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname | xxx\r\nipaddr | xxx\r\nname | xxx\r\nnonce | xxx\r\nhttp://schemas.microsoft.com/identity/claims/objectidentifier | xxx\r\nhttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier | xxx\r\nhttp://schemas.microsoft.com/identity/claims/tenantid | xxx\r\nhttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/name | xxx\r\nhttp://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn | xxx\r\nver | xxx\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Security/issues/comments/232558985","html_url":"https://github.com/aspnet/Security/issues/894#issuecomment-232558985","issue_url":"https://api.github.com/repos/aspnet/Security/issues/894","id":232558985,"user":{"login":"wangkanai","id":10666633,"avatar_url":"https://avatars.githubusercontent.com/u/10666633?v=3","gravatar_id":"","url":"https://api.github.com/users/wangkanai","html_url":"https://github.com/wangkanai","followers_url":"https://api.github.com/users/wangkanai/followers","following_url":"https://api.github.com/users/wangkanai/following{/other_user}","gists_url":"https://api.github.com/users/wangkanai/gists{/gist_id}","starred_url":"https://api.github.com/users/wangkanai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangkanai/subscriptions","organizations_url":"https://api.github.com/users/wangkanai/orgs","repos_url":"https://api.github.com/users/wangkanai/repos","events_url":"https://api.github.com/users/wangkanai/events{/privacy}","received_events_url":"https://api.github.com/users/wangkanai/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T05:17:06Z","updated_at":"2016-07-14T05:17:06Z","body":"Seem that GraphApi is what you use the query the active directory for user profile. But the mean time their dont have .net core library yet. \r\nDont know if im correct or not?"}}
{"actor":{"display_login":"wangkanai"}}