{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-app-ios/pulls/comments/23339283","id":23339283,"diff_hunk":"@@ -0,0 +1,147 @@\n+//\n+//  OEXSession.m\n+//  edXVideoLocker\n+//\n+//  Created by Abhishek Bhagat on 19/01/15.\n+//  Copyright (c) 2015 edX. All rights reserved.\n+//\n+\n+#import \"OEXSession.h\"\n+#import \"KeychainItemWrapper.h\"\n+#import \"OEXKeychainAccess.h\"\n+static OEXSession *activeSession=nil;\n+\n+@interface OEXSession ()\n+{\n+    KeychainItemWrapper *accessTokenWrapper;\n+    KeychainItemWrapper *userDetailsWrapper;\n+}\n+@end\n+\n+\n+static NSString *const kEmail=@\"email\";\n+static NSString *const kUserName=@\"username\";\n+static NSString *const kCourseEnrollments=@\"course_enrollments\";\n+static NSString *const kName=@\"name\";\n+static NSString *const kUserId=@\"id\";\n+\n+\n+@implementation OEXSession\n+\n+\n++(OEXSession *)getActiveSessoin{\n+    if(!activeSession){\n+        activeSession=[[OEXSession alloc] init];\n+        return activeSession;\n+    }\n+    return activeSession;\n+}\n+\n++(OEXSession *)createSessionWithAccessToken:(OEXAcessToken *)token andUserDetails:(NSDictionary *)userDetails{\n+    if(activeSession){\n+        [OEXSession closeAndClearSession];\n+    }\n+    activeSession=[[OEXSession alloc] initWithAccessToken:token\n+                                            andDictionary:userDetails];\n+    return activeSession;\n+}\n+\n++(void)closeAndClearSession{\n+    \n+    [[OEXKeychainAccess sharedKeychainAccess] endSession];\n+     activeSession=nil;\n+    NSLog(@\"DEL Token: %@\",[[OEXKeychainAccess sharedKeychainAccess] storedAccessToken]);\n+    NSLog(@\"DEL User Details: %@\",[[OEXKeychainAccess sharedKeychainAccess] storedUserDetails]);\n+    \n+}\n+\n+-(void)closeAndClearSession{\n+   // [accessTokenWrapper resetKeychainItem];\n+    [userDetailsWrapper resetKeychainItem];","path":"edXVideoLocker/OEXSession.m","position":60,"original_position":60,"commit_id":"e27e591f725235d8ec0900221eb5573457991e40","original_commit_id":"e27e591f725235d8ec0900221eb5573457991e40","user":{"login":"aleffert","id":114396,"avatar_url":"https://avatars.githubusercontent.com/u/114396?v=3","gravatar_id":"","url":"https://api.github.com/users/aleffert","html_url":"https://github.com/aleffert","followers_url":"https://api.github.com/users/aleffert/followers","following_url":"https://api.github.com/users/aleffert/following{/other_user}","gists_url":"https://api.github.com/users/aleffert/gists{/gist_id}","starred_url":"https://api.github.com/users/aleffert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aleffert/subscriptions","organizations_url":"https://api.github.com/users/aleffert/orgs","repos_url":"https://api.github.com/users/aleffert/repos","events_url":"https://api.github.com/users/aleffert/events{/privacy}","received_events_url":"https://api.github.com/users/aleffert/received_events","type":"User","site_admin":false},"body":"Since userDetailsWrapper is never initialized, this method is redundant.","created_at":"2015-01-21T22:13:24Z","updated_at":"2015-01-21T22:13:24Z","html_url":"https://github.com/edx/edx-app-ios/pull/9#discussion_r23339283","pull_request_url":"https://api.github.com/repos/edx/edx-app-ios/pulls/9","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-ios/pulls/comments/23339283"},"html":{"href":"https://github.com/edx/edx-app-ios/pull/9#discussion_r23339283"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-app-ios/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-app-ios/pulls/9","id":27772988,"html_url":"https://github.com/edx/edx-app-ios/pull/9","diff_url":"https://github.com/edx/edx-app-ios/pull/9.diff","patch_url":"https://github.com/edx/edx-app-ios/pull/9.patch","issue_url":"https://api.github.com/repos/edx/edx-app-ios/issues/9","number":9,"state":"open","locked":false,"title":"Move sensitive data to Keychain","user":{"login":"jotiram","id":7975235,"avatar_url":"https://avatars.githubusercontent.com/u/7975235?v=3","gravatar_id":"","url":"https://api.github.com/users/jotiram","html_url":"https://github.com/jotiram","followers_url":"https://api.github.com/users/jotiram/followers","following_url":"https://api.github.com/users/jotiram/following{/other_user}","gists_url":"https://api.github.com/users/jotiram/gists{/gist_id}","starred_url":"https://api.github.com/users/jotiram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jotiram/subscriptions","organizations_url":"https://api.github.com/users/jotiram/orgs","repos_url":"https://api.github.com/users/jotiram/repos","events_url":"https://api.github.com/users/jotiram/events{/privacy}","received_events_url":"https://api.github.com/users/jotiram/received_events","type":"User","site_admin":false},"body":"To secure sensitive data I have moved authentication token and other user details to  keychain . \r\n\r\n@aleffert  @nasthagiri  Please review .","created_at":"2015-01-21T16:26:42Z","updated_at":"2015-01-21T22:13:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-app-ios/pulls/9/commits","review_comments_url":"https://api.github.com/repos/edx/edx-app-ios/pulls/9/comments","review_comment_url":"https://api.github.com/repos/edx/edx-app-ios/pulls/comments/{number}","comments_url":"https://api.github.com/repos/edx/edx-app-ios/issues/9/comments","statuses_url":"https://api.github.com/repos/edx/edx-app-ios/statuses/e27e591f725235d8ec0900221eb5573457991e40","head":{"label":"edx:jotirambhagat/MOB-1311-secure_sensitive_data","ref":"jotirambhagat/MOB-1311-secure_sensitive_data","sha":"e27e591f725235d8ec0900221eb5573457991e40","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":29251733,"name":"edx-app-ios","full_name":"edx/edx-app-ios","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-app-ios","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-app-ios","forks_url":"https://api.github.com/repos/edx/edx-app-ios/forks","keys_url":"https://api.github.com/repos/edx/edx-app-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-app-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-app-ios/teams","hooks_url":"https://api.github.com/repos/edx/edx-app-ios/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-app-ios/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-app-ios/events","assignees_url":"https://api.github.com/repos/edx/edx-app-ios/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-app-ios/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-app-ios/tags","blobs_url":"https://api.github.com/repos/edx/edx-app-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-app-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-app-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-app-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-app-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-app-ios/languages","stargazers_url":"https://api.github.com/repos/edx/edx-app-ios/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-app-ios/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-app-ios/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-app-ios/subscription","commits_url":"https://api.github.com/repos/edx/edx-app-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-app-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-app-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-app-ios/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-app-ios/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-app-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-app-ios/merges","archive_url":"https://api.github.com/repos/edx/edx-app-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-app-ios/downloads","issues_url":"https://api.github.com/repos/edx/edx-app-ios/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-app-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-app-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-app-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-app-ios/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-app-ios/releases{/id}","created_at":"2015-01-14T15:49:29Z","updated_at":"2015-01-21T19:26:23Z","pushed_at":"2015-01-21T20:50:12Z","git_url":"git://github.com/edx/edx-app-ios.git","ssh_url":"git@github.com:edx/edx-app-ios.git","clone_url":"https://github.com/edx/edx-app-ios.git","svn_url":"https://github.com/edx/edx-app-ios","homepage":null,"size":74374,"stargazers_count":5,"watchers_count":5,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":5,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"019c7368dbb61a588bdbb8ef06122306fd66a3a2","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":29251733,"name":"edx-app-ios","full_name":"edx/edx-app-ios","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/edx-app-ios","description":"","fork":false,"url":"https://api.github.com/repos/edx/edx-app-ios","forks_url":"https://api.github.com/repos/edx/edx-app-ios/forks","keys_url":"https://api.github.com/repos/edx/edx-app-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-app-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-app-ios/teams","hooks_url":"https://api.github.com/repos/edx/edx-app-ios/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-app-ios/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-app-ios/events","assignees_url":"https://api.github.com/repos/edx/edx-app-ios/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-app-ios/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-app-ios/tags","blobs_url":"https://api.github.com/repos/edx/edx-app-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-app-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-app-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-app-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-app-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-app-ios/languages","stargazers_url":"https://api.github.com/repos/edx/edx-app-ios/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-app-ios/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-app-ios/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-app-ios/subscription","commits_url":"https://api.github.com/repos/edx/edx-app-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-app-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-app-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-app-ios/issues/comments/{number}","contents_url":"https://api.github.com/repos/edx/edx-app-ios/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-app-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-app-ios/merges","archive_url":"https://api.github.com/repos/edx/edx-app-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-app-ios/downloads","issues_url":"https://api.github.com/repos/edx/edx-app-ios/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-app-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-app-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-app-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-app-ios/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-app-ios/releases{/id}","created_at":"2015-01-14T15:49:29Z","updated_at":"2015-01-21T19:26:23Z","pushed_at":"2015-01-21T20:50:12Z","git_url":"git://github.com/edx/edx-app-ios.git","ssh_url":"git@github.com:edx/edx-app-ios.git","clone_url":"https://github.com/edx/edx-app-ios.git","svn_url":"https://github.com/edx/edx-app-ios","homepage":null,"size":74374,"stargazers_count":5,"watchers_count":5,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":5,"forks":1,"open_issues":5,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-app-ios/pulls/9"},"html":{"href":"https://github.com/edx/edx-app-ios/pull/9"},"issue":{"href":"https://api.github.com/repos/edx/edx-app-ios/issues/9"},"comments":{"href":"https://api.github.com/repos/edx/edx-app-ios/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-app-ios/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-app-ios/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-app-ios/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-app-ios/statuses/e27e591f725235d8ec0900221eb5573457991e40"}}}}