{"action":"created","issue":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/3137","repository_url":"https://api.github.com/repos/IdentityServer/IdentityServer3","labels_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/3137/labels{/name}","comments_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/3137/comments","events_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/3137/events","html_url":"https://github.com/IdentityServer/IdentityServer3/issues/3137","id":171013090,"number":3137,"title":"Custom response parameters for custom grants","user":{"login":"garfieldos","id":21009174,"avatar_url":"https://avatars.githubusercontent.com/u/21009174?v=3","gravatar_id":"","url":"https://api.github.com/users/garfieldos","html_url":"https://github.com/garfieldos","followers_url":"https://api.github.com/users/garfieldos/followers","following_url":"https://api.github.com/users/garfieldos/following{/other_user}","gists_url":"https://api.github.com/users/garfieldos/gists{/gist_id}","starred_url":"https://api.github.com/users/garfieldos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garfieldos/subscriptions","organizations_url":"https://api.github.com/users/garfieldos/orgs","repos_url":"https://api.github.com/users/garfieldos/repos","events_url":"https://api.github.com/users/garfieldos/events{/privacy}","received_events_url":"https://api.github.com/users/garfieldos/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/labels/0%20-%20Backlog","name":"0 - Backlog","color":"CCCCCC"},{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/labels/feature%20request","name":"feature request","color":"bfd4f2"},{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"leastprivilege","id":1454075,"avatar_url":"https://avatars.githubusercontent.com/u/1454075?v=3","gravatar_id":"","url":"https://api.github.com/users/leastprivilege","html_url":"https://github.com/leastprivilege","followers_url":"https://api.github.com/users/leastprivilege/followers","following_url":"https://api.github.com/users/leastprivilege/following{/other_user}","gists_url":"https://api.github.com/users/leastprivilege/gists{/gist_id}","starred_url":"https://api.github.com/users/leastprivilege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leastprivilege/subscriptions","organizations_url":"https://api.github.com/users/leastprivilege/orgs","repos_url":"https://api.github.com/users/leastprivilege/repos","events_url":"https://api.github.com/users/leastprivilege/events{/privacy}","received_events_url":"https://api.github.com/users/leastprivilege/received_events","type":"User","site_admin":false},"assignees":[{"login":"leastprivilege","id":1454075,"avatar_url":"https://avatars.githubusercontent.com/u/1454075?v=3","gravatar_id":"","url":"https://api.github.com/users/leastprivilege","html_url":"https://github.com/leastprivilege","followers_url":"https://api.github.com/users/leastprivilege/followers","following_url":"https://api.github.com/users/leastprivilege/following{/other_user}","gists_url":"https://api.github.com/users/leastprivilege/gists{/gist_id}","starred_url":"https://api.github.com/users/leastprivilege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leastprivilege/subscriptions","organizations_url":"https://api.github.com/users/leastprivilege/orgs","repos_url":"https://api.github.com/users/leastprivilege/repos","events_url":"https://api.github.com/users/leastprivilege/events{/privacy}","received_events_url":"https://api.github.com/users/leastprivilege/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/milestones/27","html_url":"https://github.com/IdentityServer/IdentityServer3/milestones/2.6","labels_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/milestones/27/labels","id":1671797,"number":27,"title":"2.6","description":"\r\n\r\n<!---\r\n@huboard:{\"order\":16.78125}\n-->\r\n","creator":{"login":"leastprivilege","id":1454075,"avatar_url":"https://avatars.githubusercontent.com/u/1454075?v=3","gravatar_id":"","url":"https://api.github.com/users/leastprivilege","html_url":"https://github.com/leastprivilege","followers_url":"https://api.github.com/users/leastprivilege/followers","following_url":"https://api.github.com/users/leastprivilege/following{/other_user}","gists_url":"https://api.github.com/users/leastprivilege/gists{/gist_id}","starred_url":"https://api.github.com/users/leastprivilege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leastprivilege/subscriptions","organizations_url":"https://api.github.com/users/leastprivilege/orgs","repos_url":"https://api.github.com/users/leastprivilege/repos","events_url":"https://api.github.com/users/leastprivilege/events{/privacy}","received_events_url":"https://api.github.com/users/leastprivilege/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":1,"state":"open","created_at":"2016-03-29T13:17:56Z","updated_at":"2016-08-14T09:46:19Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2016-08-13T15:15:13Z","updated_at":"2016-08-14T20:14:08Z","closed_at":null,"body":"### Question \r\n\r\nMy goal is to pass some additional parameter in result of CustomGrantValidator and use this parameter on my CustomTokenResponseGenerator to pass it to the TokenResponse class as response. Is there any way to do this ?\r\n\r\nNow i am doing this by using some injected context service (with PerRequestLifeStyle), but i think that there is some more appropriate method to achieve this.\r\n\r\n### CustomGrantValidation validate method\r\n```C#\r\n public async Task<CustomGrantValidationResult> ValidateAsync(ValidatedTokenRequest request)\r\n        {\r\n            /*\r\n            some other code\r\n            */\r\n            _grantValidationContext.AddCustomParameter(\"LoginAttemptsRemaining\", 1);\r\n            return new CustomGrantValidationResult(\"Some error\");\r\n        }\r\n```\r\n\r\n### CustomTokenResponseGenerator\r\n```C#\r\n public class TokenResponseGenerator : ICustomTokenResponseGenerator\r\n    {\r\n        private readonly IGrantValidationContext _grantValidationContext;\r\n        public TokenResponseGenerator(IGrantValidationContext grantValidationContext)\r\n        {\r\n            _grantValidationContext = grantValidationContext;\r\n        }\r\n\r\n        public Task<TokenResponse> GenerateAsync(ValidatedTokenRequest request, TokenResponse response)\r\n        {\r\n            foreach (var customParameter in _grantValidationContext.CustomParameters)\r\n            {\r\n                _grantValidationContext.CustomParameters.Add(customParameter);\r\n            }\r\n\r\n            return Task.FromResult(response);\r\n        }\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/comments/239694197","html_url":"https://github.com/IdentityServer/IdentityServer3/issues/3137#issuecomment-239694197","issue_url":"https://api.github.com/repos/IdentityServer/IdentityServer3/issues/3137","id":239694197,"user":{"login":"leastprivilege","id":1454075,"avatar_url":"https://avatars.githubusercontent.com/u/1454075?v=3","gravatar_id":"","url":"https://api.github.com/users/leastprivilege","html_url":"https://github.com/leastprivilege","followers_url":"https://api.github.com/users/leastprivilege/followers","following_url":"https://api.github.com/users/leastprivilege/following{/other_user}","gists_url":"https://api.github.com/users/leastprivilege/gists{/gist_id}","starred_url":"https://api.github.com/users/leastprivilege/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leastprivilege/subscriptions","organizations_url":"https://api.github.com/users/leastprivilege/orgs","repos_url":"https://api.github.com/users/leastprivilege/repos","events_url":"https://api.github.com/users/leastprivilege/events{/privacy}","received_events_url":"https://api.github.com/users/leastprivilege/received_events","type":"User","site_admin":false},"created_at":"2016-08-14T20:14:08Z","updated_at":"2016-08-14T20:14:08Z","body":"Could you send a PR? And also add some tests?"}}
{"actor":{"display_login":"leastprivilege"}}