{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Security/issues/257","labels_url":"https://api.github.com/repos/aspnet/Security/issues/257/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Security/issues/257/comments","events_url":"https://api.github.com/repos/aspnet/Security/issues/257/events","html_url":"https://github.com/aspnet/Security/pull/257","id":76375891,"number":257,"title":"Add a new SaveTokens option to save access and tokens directly in OAuthAuthenticationHandler","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/aspnet/Security/labels/cla-signed","name":"cla-signed","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-05-14T14:28:10Z","updated_at":"2015-05-15T19:07:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/aspnet/Security/pulls/257","html_url":"https://github.com/aspnet/Security/pull/257","diff_url":"https://github.com/aspnet/Security/pull/257.diff","patch_url":"https://github.com/aspnet/Security/pull/257.patch"},"body":"In the current bits, the OAuth2 client middleware automagically saves access and refresh tokens in the `ClaimsPrincipal` it issues, but this logic disappears when you override the default `OnGetUserInformation` notification: https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNet.Authentication.OAuth/OAuthAuthenticationDefaults.cs#L13\r\n\r\nThis pull request removes `DefaultOnGetUserInformationAsync`, moves its logic directly to `OAuthAuthenticationHandler` and adds a new `SaveTokens` property to `OAuthAuthenticationOptions` to decide whether tokens should be stored in `ClaimsPrincipal` (and in the final authentication cookie) or not, independently of the `OnGetUserInformation` notification.\r\n\r\nThis will also make `OAuthAuthenticationHandler` inheritors more DRY, as they won't have to repeat the same snippet again and again: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/blob/dev/src/AspNet.Security.OAuth.GitHub/GitHubAuthenticationHandler.cs#L52-L70\r\n\r\n/cc @HaoK @Tratcher "},"comment":{"url":"https://api.github.com/repos/aspnet/Security/issues/comments/102495776","html_url":"https://github.com/aspnet/Security/pull/257#issuecomment-102495776","issue_url":"https://api.github.com/repos/aspnet/Security/issues/257","id":102495776,"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},"created_at":"2015-05-15T19:07:22Z","updated_at":"2015-05-15T19:07:22Z","body":"@HaoK @Tratcher any remark concerning this PR? :cold_sweat: "}}