{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/Security/issues/1016","repository_url":"https://api.github.com/repos/aspnet/Security","labels_url":"https://api.github.com/repos/aspnet/Security/issues/1016/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Security/issues/1016/comments","events_url":"https://api.github.com/repos/aspnet/Security/issues/1016/events","html_url":"https://github.com/aspnet/Security/issues/1016","id":185651028,"number":1016,"title":"how can i Add Claims Identity into context ","user":{"login":"JagadishaBS","id":9428654,"avatar_url":"https://avatars.githubusercontent.com/u/9428654?v=3","gravatar_id":"","url":"https://api.github.com/users/JagadishaBS","html_url":"https://github.com/JagadishaBS","followers_url":"https://api.github.com/users/JagadishaBS/followers","following_url":"https://api.github.com/users/JagadishaBS/following{/other_user}","gists_url":"https://api.github.com/users/JagadishaBS/gists{/gist_id}","starred_url":"https://api.github.com/users/JagadishaBS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JagadishaBS/subscriptions","organizations_url":"https://api.github.com/users/JagadishaBS/orgs","repos_url":"https://api.github.com/users/JagadishaBS/repos","events_url":"https://api.github.com/users/JagadishaBS/events{/privacy}","received_events_url":"https://api.github.com/users/JagadishaBS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-27T12:12:30Z","updated_at":"2016-10-27T12:12:30Z","closed_at":null,"body":"I am following [this tutorial](https://github.com/aspnet/Security/tree/dev/samples/OpenIdConnect.AzureAdSample). I am able login with azure ad user. but once the user gets authenticated. we want to store it into Identity claims for authentication. \r\nWe are migrating Asp.net MVC application into asp.net core MVC 1.0. In Asp.net MVC application we are adding the claims like this\r\n\r\n` \r\n       context.AuthenticationTicket.Identity.AddClaim(new System.Security.Claims.Claim(\"urn:Projectname:access_token\", result.AccessToken,\r\n                                XmlSchemaString, \"Innubex\"));\r\n                            `\r\nI want to know how to add the claims identity in the above tutorial.\r\nthe code:\r\n\r\n> \r\n\r\n    app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions\r\n            {\r\n                ClientId = clientId,\r\n                ClientSecret = clientSecret,  Authority = authority,\r\n                CallbackPath = Configuration[\"AzureAd:AuthCallback\"],\r\n                ResponseType = OpenIdConnectResponseType.CodeIdToken,\r\n                PostLogoutRedirectUri = \"/signed-out\",\r\n                Events = new OpenIdConnectEvents()\r\n                {\r\n                    OnAuthorizationCodeReceived = async context =>\r\n                    {\r\n                        var request = context.HttpContext.Request;\r\n                        var currentUri = UriHelper.BuildAbsolute(request.Scheme, request.Host,request.PathBase, request.Path);\r\n                        var credential = new ClientCredential(clientId, clientSecret);\r\n                        var authContext = new AuthenticationContext(authority, AuthPropertiesTokenCache.ForCodeRedemption(context.Properties));\r\n                        var result = await authContext.AcquireTokenByAuthorizationCodeAsync(\r\n                            context.ProtocolMessage.Code, new Uri(currentUri), credential, resource);\r\n                      In result we are getting the AccessToken and we want to add this into claims identity here \r\n                        context.HandleCodeRedemption();\r\n                    }\r\n                }\r\n            });"}}
{"actor":{"display_login":"JagadishaBS"}}