{"action":"created","issue":{"url":"https://api.github.com/repos/openiddict/openiddict-core/issues/205","repository_url":"https://api.github.com/repos/openiddict/openiddict-core","labels_url":"https://api.github.com/repos/openiddict/openiddict-core/issues/205/labels{/name}","comments_url":"https://api.github.com/repos/openiddict/openiddict-core/issues/205/comments","events_url":"https://api.github.com/repos/openiddict/openiddict-core/issues/205/events","html_url":"https://github.com/openiddict/openiddict-core/pull/205","id":173661158,"number":205,"title":"Update OpenIddictProvider to allow using custom grant types","user":{"login":"PinpointTownes","id":6998306,"avatar_url":"https://avatars.githubusercontent.com/u/6998306?v=3","gravatar_id":"","url":"https://api.github.com/users/PinpointTownes","html_url":"https://github.com/PinpointTownes","followers_url":"https://api.github.com/users/PinpointTownes/followers","following_url":"https://api.github.com/users/PinpointTownes/following{/other_user}","gists_url":"https://api.github.com/users/PinpointTownes/gists{/gist_id}","starred_url":"https://api.github.com/users/PinpointTownes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PinpointTownes/subscriptions","organizations_url":"https://api.github.com/users/PinpointTownes/orgs","repos_url":"https://api.github.com/users/PinpointTownes/repos","events_url":"https://api.github.com/users/PinpointTownes/events{/privacy}","received_events_url":"https://api.github.com/users/PinpointTownes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/openiddict/openiddict-core/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"ilmax","id":3263338,"avatar_url":"https://avatars.githubusercontent.com/u/3263338?v=3","gravatar_id":"","url":"https://api.github.com/users/ilmax","html_url":"https://github.com/ilmax","followers_url":"https://api.github.com/users/ilmax/followers","following_url":"https://api.github.com/users/ilmax/following{/other_user}","gists_url":"https://api.github.com/users/ilmax/gists{/gist_id}","starred_url":"https://api.github.com/users/ilmax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilmax/subscriptions","organizations_url":"https://api.github.com/users/ilmax/orgs","repos_url":"https://api.github.com/users/ilmax/repos","events_url":"https://api.github.com/users/ilmax/events{/privacy}","received_events_url":"https://api.github.com/users/ilmax/received_events","type":"User","site_admin":false},"assignees":[{"login":"ilmax","id":3263338,"avatar_url":"https://avatars.githubusercontent.com/u/3263338?v=3","gravatar_id":"","url":"https://api.github.com/users/ilmax","html_url":"https://github.com/ilmax","followers_url":"https://api.github.com/users/ilmax/followers","following_url":"https://api.github.com/users/ilmax/following{/other_user}","gists_url":"https://api.github.com/users/ilmax/gists{/gist_id}","starred_url":"https://api.github.com/users/ilmax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilmax/subscriptions","organizations_url":"https://api.github.com/users/ilmax/orgs","repos_url":"https://api.github.com/users/ilmax/repos","events_url":"https://api.github.com/users/ilmax/events{/privacy}","received_events_url":"https://api.github.com/users/ilmax/received_events","type":"User","site_admin":false},{"login":"PinpointTownes","id":6998306,"avatar_url":"https://avatars.githubusercontent.com/u/6998306?v=3","gravatar_id":"","url":"https://api.github.com/users/PinpointTownes","html_url":"https://github.com/PinpointTownes","followers_url":"https://api.github.com/users/PinpointTownes/followers","following_url":"https://api.github.com/users/PinpointTownes/following{/other_user}","gists_url":"https://api.github.com/users/PinpointTownes/gists{/gist_id}","starred_url":"https://api.github.com/users/PinpointTownes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PinpointTownes/subscriptions","organizations_url":"https://api.github.com/users/PinpointTownes/orgs","repos_url":"https://api.github.com/users/PinpointTownes/repos","events_url":"https://api.github.com/users/PinpointTownes/events{/privacy}","received_events_url":"https://api.github.com/users/PinpointTownes/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/openiddict/openiddict-core/milestones/2","html_url":"https://github.com/openiddict/openiddict-core/milestones/1.0.0-alpha2","labels_url":"https://api.github.com/repos/openiddict/openiddict-core/milestones/2/labels","id":1398749,"number":2,"title":"1.0.0-alpha2","description":null,"creator":{"login":"PinpointTownes","id":6998306,"avatar_url":"https://avatars.githubusercontent.com/u/6998306?v=3","gravatar_id":"","url":"https://api.github.com/users/PinpointTownes","html_url":"https://github.com/PinpointTownes","followers_url":"https://api.github.com/users/PinpointTownes/followers","following_url":"https://api.github.com/users/PinpointTownes/following{/other_user}","gists_url":"https://api.github.com/users/PinpointTownes/gists{/gist_id}","starred_url":"https://api.github.com/users/PinpointTownes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PinpointTownes/subscriptions","organizations_url":"https://api.github.com/users/PinpointTownes/orgs","repos_url":"https://api.github.com/users/PinpointTownes/repos","events_url":"https://api.github.com/users/PinpointTownes/events{/privacy}","received_events_url":"https://api.github.com/users/PinpointTownes/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":81,"state":"open","created_at":"2015-11-07T00:28:08Z","updated_at":"2016-08-28T18:49:17Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2016-08-28T18:49:16Z","updated_at":"2016-08-28T19:26:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openiddict/openiddict-core/pulls/205","html_url":"https://github.com/openiddict/openiddict-core/pull/205","diff_url":"https://github.com/openiddict/openiddict-core/pull/205.diff","patch_url":"https://github.com/openiddict/openiddict-core/pull/205.patch"},"body":"This PR removes the internal checks that reject token requests using an unknown grant type, which will allow implementing your own grant type.\r\n\r\nRelated ticket: https://github.com/openiddict/openiddict-core/issues/182.\r\n\r\nHere's an example of how one could implement a \"Facebook token exchange\" grant (based on http://stackoverflow.com/questions/39008642/use-openidconnectserver-and-try-to-connect-to-facebook-through-api-service):\r\n\r\n```csharp\r\n[HttpPost(\"~/connect/token\")]\r\npublic IActionResult Exchange() {\r\n    var request = HttpContext.GetOpenIdConnectRequest();\r\n\r\n    if (request.GrantType == \"urn:ietf:params:oauth:grant-type:facebook_access_token\") {\r\n        // Reject the request if the \"assertion\" parameter is missing.\r\n        if (string.IsNullOrEmpty(request.Assertion)) {\r\n            return Json(new OpenIdConnectResponse {\r\n                Error = OpenIdConnectConstants.Errors.InvalidRequest,\r\n                ErrorDescription = \"The mandatory 'assertion' parameter was missing.\"\r\n            });\r\n        }\r\n\r\n        // Create a new ClaimsIdentity containing the claims that\r\n        // will be used to create an id_token and/or an access token.\r\n        var identity = new ClaimsIdentity(OpenIdConnectServerDefaults.AuthenticationScheme);\r\n\r\n        // Validate the access token using Facebook's token validation\r\n        // endpoint and add the user claims you retrieved here.\r\n\r\n        identity.AddClaim(ClaimTypes.NameIdentifier, \"c508135b-b72a-4498-f57e-08d396b1cf4b\");\r\n\r\n        // Create a new authentication ticket holding the user identity.\r\n        var ticket = new AuthenticationTicket(\r\n            new ClaimsPrincipal(identity),\r\n            new AuthenticationProperties(),\r\n            OpenIdConnectServerDefaults.AuthenticationScheme);\r\n\r\n        ticket.SetResources(request.GetResources());\r\n        ticket.SetScopes(request.GetScopes());\r\n\r\n        return SignIn(ticket.Principal, ticket.Properties, ticket.AuthenticationScheme);\r\n    }\r\n\r\n    return Json(new OpenIdConnectResponse {\r\n        Error = OpenIdConnectConstants.Errors.UnsupportedGrantType\r\n    });\r\n}\r\n```\r\n\r\n/cc @ilmax @jayrulez"},"comment":{"url":"https://api.github.com/repos/openiddict/openiddict-core/issues/comments/242994020","html_url":"https://github.com/openiddict/openiddict-core/pull/205#issuecomment-242994020","issue_url":"https://api.github.com/repos/openiddict/openiddict-core/issues/205","id":242994020,"user":{"login":"jayrulez","id":78807,"avatar_url":"https://avatars.githubusercontent.com/u/78807?v=3","gravatar_id":"","url":"https://api.github.com/users/jayrulez","html_url":"https://github.com/jayrulez","followers_url":"https://api.github.com/users/jayrulez/followers","following_url":"https://api.github.com/users/jayrulez/following{/other_user}","gists_url":"https://api.github.com/users/jayrulez/gists{/gist_id}","starred_url":"https://api.github.com/users/jayrulez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayrulez/subscriptions","organizations_url":"https://api.github.com/users/jayrulez/orgs","repos_url":"https://api.github.com/users/jayrulez/repos","events_url":"https://api.github.com/users/jayrulez/events{/privacy}","received_events_url":"https://api.github.com/users/jayrulez/received_events","type":"User","site_admin":false},"created_at":"2016-08-28T19:26:08Z","updated_at":"2016-08-28T19:26:08Z","body":"Awesome. We are very pleased with this change :)"}}
{"actor":{"display_login":"jayrulez"}}