{"action":"created","comment":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/comments/63078470","id":63078470,"diff_hunk":"@@ -0,0 +1,42 @@\n+package com.microsoft.aad.adal;\n+\n+import com.google.gson.annotations.SerializedName;\n+\n+final class SerializedTokenCacheItem {\n+\n+    private static final String TAG = SerializedTokenCacheItem.class.getSimpleName();\n+\n+    @SerializedName(\"authority\")\n+    private final String mAuthority;\n+\n+    @SerializedName(\"refreshToken\")\n+    private final String mRefreshToken;\n+\n+    @SerializedName(\"idToken\")\n+    private final String mIdToken;\n+\n+    @SerializedName(\"familyClientId\")\n+    private final String mFamilyClientId;\n+\n+    SerializedTokenCacheItem(final TokenCacheItem tokenCacheItem) {\n+        this.mAuthority = tokenCacheItem.getAuthority();\n+        this.mRefreshToken = tokenCacheItem.getRefreshToken();\n+        this.mIdToken = tokenCacheItem.getRawIdToken();\n+        this.mFamilyClientId = tokenCacheItem.getFamilyClientId();\n+    }\n+\n+    TokenCacheItem parseSerializedTokenCacheItem() throws AuthenticationException {\n+        TokenCacheItem tokenCacheItem = new TokenCacheItem();\n+        IdToken idToken;","path":"src/src/com/microsoft/aad/adal/SerializedTokenCacheItem.java","position":30,"original_position":30,"commit_id":"b9a3e36e281e755a9d04cbd4d22460d04ce9f6a7","original_commit_id":"b9a3e36e281e755a9d04cbd4d22460d04ce9f6a7","user":{"login":"heidijinxujia","id":16140683,"avatar_url":"https://avatars.githubusercontent.com/u/16140683?v=3","gravatar_id":"","url":"https://api.github.com/users/heidijinxujia","html_url":"https://github.com/heidijinxujia","followers_url":"https://api.github.com/users/heidijinxujia/followers","following_url":"https://api.github.com/users/heidijinxujia/following{/other_user}","gists_url":"https://api.github.com/users/heidijinxujia/gists{/gist_id}","starred_url":"https://api.github.com/users/heidijinxujia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heidijinxujia/subscriptions","organizations_url":"https://api.github.com/users/heidijinxujia/orgs","repos_url":"https://api.github.com/users/heidijinxujia/repos","events_url":"https://api.github.com/users/heidijinxujia/events{/privacy}","received_events_url":"https://api.github.com/users/heidijinxujia/received_events","type":"User","site_admin":false},"body":"These should not be deleted. Because this.mIdToken is just a string and we need to construct it to a idToken object.","created_at":"2016-05-12T19:06:47Z","updated_at":"2016-05-12T19:06:47Z","html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/609#discussion_r63078470","pull_request_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/609","_links":{"self":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/comments/63078470"},"html":{"href":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/609#discussion_r63078470"},"pull_request":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/609"}}},"pull_request":{"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/609","id":68025532,"html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/609","diff_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/609.diff","patch_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/609.patch","issue_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/609","number":609,"state":"open","locked":false,"title":"Serialize/Deserialize For Token Cache in ADAL Android","user":{"login":"heidijinxujia","id":16140683,"avatar_url":"https://avatars.githubusercontent.com/u/16140683?v=3","gravatar_id":"","url":"https://api.github.com/users/heidijinxujia","html_url":"https://github.com/heidijinxujia","followers_url":"https://api.github.com/users/heidijinxujia/followers","following_url":"https://api.github.com/users/heidijinxujia/following{/other_user}","gists_url":"https://api.github.com/users/heidijinxujia/gists{/gist_id}","starred_url":"https://api.github.com/users/heidijinxujia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heidijinxujia/subscriptions","organizations_url":"https://api.github.com/users/heidijinxujia/orgs","repos_url":"https://api.github.com/users/heidijinxujia/repos","events_url":"https://api.github.com/users/heidijinxujia/events{/privacy}","received_events_url":"https://api.github.com/users/heidijinxujia/received_events","type":"User","site_admin":false},"body":"The purpose of this PR is to implement the serialize/deserialize APIs and provide SSO for first party apps when broker is not involved. \r\n\r\nThese APIs will be directly added to DefaultTokenCacheStore as an internal method to ADAL, we are not going to expose it. Since this feature is only useful if clients are sharing the same client Id or they can use Foci. To reduce the confusion to external developers, those two new APIs will be internal to ADAL.\r\n\r\n======= Update ======= \r\n- Implement the serialize/deserialize APIs to provide SSO for first party apps when broker is not involved\r\n- Add unit tests to serialize/deserialize APIs\r\n- Add Class BlobContainer to store the family refresh token item\r\n- Add unit tests to class BlobContainer\r\n\r\n======= Respond to Code Review ======= \r\n- add the exception type DeserializationAuthenticationException for the deserialize function\r\n- add the data formatter for gson\r\n- change the methods access levels\r\n- modify the implementation of getFamilyRefreshTokenItemForUser function\r\n- add the serialize/deserialize adapter for class BlobContainer\r\n- delete the setter for the tokenCacheItem in class BlobContainer\r\n- delete the property familyRefreshToken class BlobContainer\r\n- modify the functions according to the code reviews\r\n- add unit tests for this serialize/deserialize function\r\n- fix the javadoc in UsageAuthenticationException","created_at":"2016-04-27T09:52:04Z","updated_at":"2016-05-12T19:06:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1548bfc72e13a460d3928d1526d4c2f1390aedcf","assignee":{"login":"heidijinxujia","id":16140683,"avatar_url":"https://avatars.githubusercontent.com/u/16140683?v=3","gravatar_id":"","url":"https://api.github.com/users/heidijinxujia","html_url":"https://github.com/heidijinxujia","followers_url":"https://api.github.com/users/heidijinxujia/followers","following_url":"https://api.github.com/users/heidijinxujia/following{/other_user}","gists_url":"https://api.github.com/users/heidijinxujia/gists{/gist_id}","starred_url":"https://api.github.com/users/heidijinxujia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heidijinxujia/subscriptions","organizations_url":"https://api.github.com/users/heidijinxujia/orgs","repos_url":"https://api.github.com/users/heidijinxujia/repos","events_url":"https://api.github.com/users/heidijinxujia/events{/privacy}","received_events_url":"https://api.github.com/users/heidijinxujia/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/609/commits","review_comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/609/comments","review_comment_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/609/comments","statuses_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/statuses/b9a3e36e281e755a9d04cbd4d22460d04ce9f6a7","head":{"label":"AzureAD:jj/serialization","ref":"jj/serialization","sha":"b9a3e36e281e755a9d04cbd4d22460d04ce9f6a7","user":{"login":"AzureAD","id":2966316,"avatar_url":"https://avatars.githubusercontent.com/u/2966316?v=3","gravatar_id":"","url":"https://api.github.com/users/AzureAD","html_url":"https://github.com/AzureAD","followers_url":"https://api.github.com/users/AzureAD/followers","following_url":"https://api.github.com/users/AzureAD/following{/other_user}","gists_url":"https://api.github.com/users/AzureAD/gists{/gist_id}","starred_url":"https://api.github.com/users/AzureAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AzureAD/subscriptions","organizations_url":"https://api.github.com/users/AzureAD/orgs","repos_url":"https://api.github.com/users/AzureAD/repos","events_url":"https://api.github.com/users/AzureAD/events{/privacy}","received_events_url":"https://api.github.com/users/AzureAD/received_events","type":"Organization","site_admin":false},"repo":{"id":14703238,"name":"azure-activedirectory-library-for-android","full_name":"AzureAD/azure-activedirectory-library-for-android","owner":{"login":"AzureAD","id":2966316,"avatar_url":"https://avatars.githubusercontent.com/u/2966316?v=3","gravatar_id":"","url":"https://api.github.com/users/AzureAD","html_url":"https://github.com/AzureAD","followers_url":"https://api.github.com/users/AzureAD/followers","following_url":"https://api.github.com/users/AzureAD/following{/other_user}","gists_url":"https://api.github.com/users/AzureAD/gists{/gist_id}","starred_url":"https://api.github.com/users/AzureAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AzureAD/subscriptions","organizations_url":"https://api.github.com/users/AzureAD/orgs","repos_url":"https://api.github.com/users/AzureAD/repos","events_url":"https://api.github.com/users/AzureAD/events{/privacy}","received_events_url":"https://api.github.com/users/AzureAD/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android","description":"The ADAL SDK for Android gives you the ability to add support for Work Accounts to your application with just a few lines of additional code. This SDK gives your application the full functionality of Microsoft Azure AD, including industry standard protocol support for OAuth2, Web API integration with user level consent, and two factor authentication support.","fork":false,"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android","forks_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/forks","keys_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/teams","hooks_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/hooks","issue_events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/events{/number}","events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/events","assignees_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/assignees{/user}","branches_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/branches{/branch}","tags_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/tags","blobs_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/statuses/{sha}","languages_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/languages","stargazers_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/stargazers","contributors_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/contributors","subscribers_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/subscribers","subscription_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/subscription","commits_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/contents/{+path}","compare_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/merges","archive_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/downloads","issues_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues{/number}","pulls_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls{/number}","milestones_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/milestones{/number}","notifications_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/labels{/name}","releases_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/releases{/id}","deployments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/deployments","created_at":"2013-11-26T00:59:05Z","updated_at":"2016-05-04T04:52:40Z","pushed_at":"2016-05-12T17:51:20Z","git_url":"git://github.com/AzureAD/azure-activedirectory-library-for-android.git","ssh_url":"git@github.com:AzureAD/azure-activedirectory-library-for-android.git","clone_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android.git","svn_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android","homepage":"http://www.windowsazure.com/en-us/services/active-directory/","size":25078,"stargazers_count":64,"watchers_count":64,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":63,"forks":53,"open_issues":63,"watchers":64,"default_branch":"master"}},"base":{"label":"AzureAD:dev","ref":"dev","sha":"7265f5c257dcc575aa38088eee4d8b571eb88dcb","user":{"login":"AzureAD","id":2966316,"avatar_url":"https://avatars.githubusercontent.com/u/2966316?v=3","gravatar_id":"","url":"https://api.github.com/users/AzureAD","html_url":"https://github.com/AzureAD","followers_url":"https://api.github.com/users/AzureAD/followers","following_url":"https://api.github.com/users/AzureAD/following{/other_user}","gists_url":"https://api.github.com/users/AzureAD/gists{/gist_id}","starred_url":"https://api.github.com/users/AzureAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AzureAD/subscriptions","organizations_url":"https://api.github.com/users/AzureAD/orgs","repos_url":"https://api.github.com/users/AzureAD/repos","events_url":"https://api.github.com/users/AzureAD/events{/privacy}","received_events_url":"https://api.github.com/users/AzureAD/received_events","type":"Organization","site_admin":false},"repo":{"id":14703238,"name":"azure-activedirectory-library-for-android","full_name":"AzureAD/azure-activedirectory-library-for-android","owner":{"login":"AzureAD","id":2966316,"avatar_url":"https://avatars.githubusercontent.com/u/2966316?v=3","gravatar_id":"","url":"https://api.github.com/users/AzureAD","html_url":"https://github.com/AzureAD","followers_url":"https://api.github.com/users/AzureAD/followers","following_url":"https://api.github.com/users/AzureAD/following{/other_user}","gists_url":"https://api.github.com/users/AzureAD/gists{/gist_id}","starred_url":"https://api.github.com/users/AzureAD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AzureAD/subscriptions","organizations_url":"https://api.github.com/users/AzureAD/orgs","repos_url":"https://api.github.com/users/AzureAD/repos","events_url":"https://api.github.com/users/AzureAD/events{/privacy}","received_events_url":"https://api.github.com/users/AzureAD/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android","description":"The ADAL SDK for Android gives you the ability to add support for Work Accounts to your application with just a few lines of additional code. This SDK gives your application the full functionality of Microsoft Azure AD, including industry standard protocol support for OAuth2, Web API integration with user level consent, and two factor authentication support.","fork":false,"url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android","forks_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/forks","keys_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/teams","hooks_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/hooks","issue_events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/events{/number}","events_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/events","assignees_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/assignees{/user}","branches_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/branches{/branch}","tags_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/tags","blobs_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/refs{/sha}","trees_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/statuses/{sha}","languages_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/languages","stargazers_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/stargazers","contributors_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/contributors","subscribers_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/subscribers","subscription_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/subscription","commits_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/commits{/sha}","git_commits_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/git/commits{/sha}","comments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/comments{/number}","issue_comment_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/comments{/number}","contents_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/contents/{+path}","compare_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/merges","archive_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/downloads","issues_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues{/number}","pulls_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls{/number}","milestones_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/milestones{/number}","notifications_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/labels{/name}","releases_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/releases{/id}","deployments_url":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/deployments","created_at":"2013-11-26T00:59:05Z","updated_at":"2016-05-04T04:52:40Z","pushed_at":"2016-05-12T17:51:20Z","git_url":"git://github.com/AzureAD/azure-activedirectory-library-for-android.git","ssh_url":"git@github.com:AzureAD/azure-activedirectory-library-for-android.git","clone_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android.git","svn_url":"https://github.com/AzureAD/azure-activedirectory-library-for-android","homepage":"http://www.windowsazure.com/en-us/services/active-directory/","size":25078,"stargazers_count":64,"watchers_count":64,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":63,"forks":53,"open_issues":63,"watchers":64,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/609"},"html":{"href":"https://github.com/AzureAD/azure-activedirectory-library-for-android/pull/609"},"issue":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/609"},"comments":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/issues/609/comments"},"review_comments":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/609/comments"},"review_comment":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/pulls/609/commits"},"statuses":{"href":"https://api.github.com/repos/AzureAD/azure-activedirectory-library-for-android/statuses/b9a3e36e281e755a9d04cbd4d22460d04ce9f6a7"}}}}