{"action":"created","comment":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/comments/121927962","pull_request_review_id":43995852,"id":121927962,"diff_hunk":"@@ -379,6 +394,9 @@ class SAMLProviderConfig(ProviderConfig):\n     attr_email = models.CharField(\n         max_length=128, blank=True, verbose_name=\"Email Attribute\",\n         help_text=\"URN of SAML attribute containing the user's email address[es]. Leave blank for default.\")\n+    attr_country = models.CharField(\n+        max_length=128, blank=True, verbose_name=\"Email Attribute\", default=OID_COUNTRY_NAME,","path":"common/djangoapps/third_party_auth/models.py","position":72,"original_position":72,"commit_id":"cc032cea1c0bc09eb8bc4925c80879ac45592310","original_commit_id":"cc032cea1c0bc09eb8bc4925c80879ac45592310","user":{"login":"UmanShahzad","id":10018065,"avatar_url":"https://avatars3.githubusercontent.com/u/10018065?v=3","gravatar_id":"","url":"https://api.github.com/users/UmanShahzad","html_url":"https://github.com/UmanShahzad","followers_url":"https://api.github.com/users/UmanShahzad/followers","following_url":"https://api.github.com/users/UmanShahzad/following{/other_user}","gists_url":"https://api.github.com/users/UmanShahzad/gists{/gist_id}","starred_url":"https://api.github.com/users/UmanShahzad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UmanShahzad/subscriptions","organizations_url":"https://api.github.com/users/UmanShahzad/orgs","repos_url":"https://api.github.com/users/UmanShahzad/repos","events_url":"https://api.github.com/users/UmanShahzad/events{/privacy}","received_events_url":"https://api.github.com/users/UmanShahzad/received_events","type":"User","site_admin":false},"body":"Ah, jeez. Thanks.","created_at":"2017-06-14T12:09:57Z","updated_at":"2017-06-14T12:09:57Z","html_url":"https://github.com/edx/edx-platform/pull/15305#discussion_r121927962","pull_request_url":"https://api.github.com/repos/edx/edx-platform/pulls/15305","_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments/121927962"},"html":{"href":"https://github.com/edx/edx-platform/pull/15305#discussion_r121927962"},"pull_request":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/15305"}}},"pull_request":{"url":"https://api.github.com/repos/edx/edx-platform/pulls/15305","id":125369614,"html_url":"https://github.com/edx/edx-platform/pull/15305","diff_url":"https://github.com/edx/edx-platform/pull/15305.diff","patch_url":"https://github.com/edx/edx-platform/pull/15305.patch","issue_url":"https://api.github.com/repos/edx/edx-platform/issues/15305","number":15305,"state":"open","locked":false,"title":"[ENT-423] Automatically populate Country field for SSO scenarios","user":{"login":"UmanShahzad","id":10018065,"avatar_url":"https://avatars3.githubusercontent.com/u/10018065?v=3","gravatar_id":"","url":"https://api.github.com/users/UmanShahzad","html_url":"https://github.com/UmanShahzad","followers_url":"https://api.github.com/users/UmanShahzad/followers","following_url":"https://api.github.com/users/UmanShahzad/following{/other_user}","gists_url":"https://api.github.com/users/UmanShahzad/gists{/gist_id}","starred_url":"https://api.github.com/users/UmanShahzad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UmanShahzad/subscriptions","organizations_url":"https://api.github.com/users/UmanShahzad/orgs","repos_url":"https://api.github.com/users/UmanShahzad/repos","events_url":"https://api.github.com/users/UmanShahzad/events{/privacy}","received_events_url":"https://api.github.com/users/UmanShahzad/received_events","type":"User","site_admin":false},"body":"There are some use cases in which a required field coming from a SAML IdP is not recognized by Open edX, such as the country code. This PR has a simple aim -- recognize the country code attribute from SAML IdPs and pass it on to the registration flow, where the user API already utilizes the ISO-3166-1 Alpha-2 country code under the key `country`, but will now also recognize it when coming from SAML IdPs.\r\n\r\n**JIRA tickets**: Implements [ENT-423](https://openedx.atlassian.net/browse/ENT-423).\r\n\r\n**Discussions**: See summary above.\r\n\r\n**Dependency**: This is apparently blocked by [ENT-365](https://openedx.atlassian.net/browse/ENT-365), whose PR is up at https://github.com/edx/edx-platform/pull/15135 -- it is stable, has been approved by an OpenCraft developer and just needs confirmation from 1 more third-party-auth domain expert.\r\n\r\n**Deployment targets**: edx.org and edge.edx.org\r\n\r\n**Merge deadline**: Not that urgent.\r\n\r\n**Sandbox**: TBD\r\n\r\n**Testing instructions**:\r\n\r\n- Configure SAML such that a country attribute is returned with some URN.\r\n- Input this URN into the SAMLProvider under the Country attribute.\r\n- Attempt login with SAML provider.\r\n- Notice country form field filled with what SAML IdP passed in.\r\n\r\n(more specific instructions to come, but if you understand the above then give it a shot).\r\n\r\n**Author notes and concerns**: \r\n\r\n1. I've worked on a more *general* version of the same problem -- instead of explicitly having to add attributes the way we do in this PR, in the future it'll all be JSON based and put into a single \"attributes\" text field. This provides for much more flexibility and easily lends to dealing with the rest of the possibly required fields (i.e. gender, level_of_education, etc.) in case someone uses an SAML IdP that passes these in.\r\n2. This is not currently based on https://github.com/edx/edx-platform/pull/15135 but will be as soon as that gets merged.\r\n\r\n**Reviewers**\r\n- [ ] @haikuginger \r\n- [ ] edX reviewer[s] TBD\r\n\r\n- - -\r\n**Settings**\r\n```yaml\r\nconfiguration_version: ent-423\r\nEDXAPP_FEATURES:\r\n  ENABLE_COMBINED_LOGIN_REGISTRATION: true\r\n  ENABLE_THIRD_PARTY_AUTH: true\r\nSWAPFILE_SIZE: 4GB\r\n```","created_at":"2017-06-13T13:54:07Z","updated_at":"2017-06-14T12:09:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cf98f6f5ee16795fac40a1318de5f4f9c68720b0","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/edx/edx-platform/pulls/15305/commits","review_comments_url":"https://api.github.com/repos/edx/edx-platform/pulls/15305/comments","review_comment_url":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/edx-platform/issues/15305/comments","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/cc032cea1c0bc09eb8bc4925c80879ac45592310","head":{"label":"open-craft:uman/OC-2682","ref":"uman/OC-2682","sha":"cc032cea1c0bc09eb8bc4925c80879ac45592310","user":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars3.githubusercontent.com/u/7414786?v=3","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"repo":{"id":19940883,"name":"edx-platform","full_name":"open-craft/edx-platform","owner":{"login":"open-craft","id":7414786,"avatar_url":"https://avatars3.githubusercontent.com/u/7414786?v=3","gravatar_id":"","url":"https://api.github.com/users/open-craft","html_url":"https://github.com/open-craft","followers_url":"https://api.github.com/users/open-craft/followers","following_url":"https://api.github.com/users/open-craft/following{/other_user}","gists_url":"https://api.github.com/users/open-craft/gists{/gist_id}","starred_url":"https://api.github.com/users/open-craft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-craft/subscriptions","organizations_url":"https://api.github.com/users/open-craft/orgs","repos_url":"https://api.github.com/users/open-craft/repos","events_url":"https://api.github.com/users/open-craft/events{/privacy}","received_events_url":"https://api.github.com/users/open-craft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-craft/edx-platform","description":"the edX learning management system (LMS) and course authoring tool, Studio","fork":true,"url":"https://api.github.com/repos/open-craft/edx-platform","forks_url":"https://api.github.com/repos/open-craft/edx-platform/forks","keys_url":"https://api.github.com/repos/open-craft/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-craft/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-craft/edx-platform/teams","hooks_url":"https://api.github.com/repos/open-craft/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/open-craft/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/open-craft/edx-platform/events","assignees_url":"https://api.github.com/repos/open-craft/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/open-craft/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/open-craft/edx-platform/tags","blobs_url":"https://api.github.com/repos/open-craft/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-craft/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-craft/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-craft/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-craft/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/open-craft/edx-platform/languages","stargazers_url":"https://api.github.com/repos/open-craft/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/open-craft/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/open-craft/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/open-craft/edx-platform/subscription","commits_url":"https://api.github.com/repos/open-craft/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-craft/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-craft/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-craft/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-craft/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/open-craft/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-craft/edx-platform/merges","archive_url":"https://api.github.com/repos/open-craft/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-craft/edx-platform/downloads","issues_url":"https://api.github.com/repos/open-craft/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/open-craft/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/open-craft/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/open-craft/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-craft/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/open-craft/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/open-craft/edx-platform/deployments","created_at":"2014-05-19T12:28:25Z","updated_at":"2017-02-08T21:05:25Z","pushed_at":"2017-06-14T09:36:06Z","git_url":"git://github.com/open-craft/edx-platform.git","ssh_url":"git@github.com:open-craft/edx-platform.git","clone_url":"https://github.com/open-craft/edx-platform.git","svn_url":"https://github.com/open-craft/edx-platform","homepage":"http://code.edx.org/","size":789036,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"edx:master","ref":"master","sha":"54eb9e84b4153c3a29b6f7064fee9808b4fe22d7","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars0.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":10391073,"name":"edx-platform","full_name":"edx/edx-platform","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars0.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-platform","description":"The Open edX platform, the software that powers edX!","fork":false,"url":"https://api.github.com/repos/edx/edx-platform","forks_url":"https://api.github.com/repos/edx/edx-platform/forks","keys_url":"https://api.github.com/repos/edx/edx-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/edx-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/edx-platform/teams","hooks_url":"https://api.github.com/repos/edx/edx-platform/hooks","issue_events_url":"https://api.github.com/repos/edx/edx-platform/issues/events{/number}","events_url":"https://api.github.com/repos/edx/edx-platform/events","assignees_url":"https://api.github.com/repos/edx/edx-platform/assignees{/user}","branches_url":"https://api.github.com/repos/edx/edx-platform/branches{/branch}","tags_url":"https://api.github.com/repos/edx/edx-platform/tags","blobs_url":"https://api.github.com/repos/edx/edx-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/edx-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/edx-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/edx-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/edx-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/edx-platform/languages","stargazers_url":"https://api.github.com/repos/edx/edx-platform/stargazers","contributors_url":"https://api.github.com/repos/edx/edx-platform/contributors","subscribers_url":"https://api.github.com/repos/edx/edx-platform/subscribers","subscription_url":"https://api.github.com/repos/edx/edx-platform/subscription","commits_url":"https://api.github.com/repos/edx/edx-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/edx-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/edx-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/edx-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/edx-platform/contents/{+path}","compare_url":"https://api.github.com/repos/edx/edx-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/edx-platform/merges","archive_url":"https://api.github.com/repos/edx/edx-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/edx-platform/downloads","issues_url":"https://api.github.com/repos/edx/edx-platform/issues{/number}","pulls_url":"https://api.github.com/repos/edx/edx-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/edx-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/edx-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/edx-platform/labels{/name}","releases_url":"https://api.github.com/repos/edx/edx-platform/releases{/id}","deployments_url":"https://api.github.com/repos/edx/edx-platform/deployments","created_at":"2013-05-30T20:20:38Z","updated_at":"2017-06-14T10:16:27Z","pushed_at":"2017-06-14T11:54:31Z","git_url":"git://github.com/edx/edx-platform.git","ssh_url":"git@github.com:edx/edx-platform.git","clone_url":"https://github.com/edx/edx-platform.git","svn_url":"https://github.com/edx/edx-platform","homepage":"http://open.edx.org/","size":818280,"stargazers_count":3173,"watchers_count":3173,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1841,"mirror_url":null,"open_issues_count":178,"forks":1841,"open_issues":178,"watchers":3173,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/15305"},"html":{"href":"https://github.com/edx/edx-platform/pull/15305"},"issue":{"href":"https://api.github.com/repos/edx/edx-platform/issues/15305"},"comments":{"href":"https://api.github.com/repos/edx/edx-platform/issues/15305/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/15305/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/edx-platform/pulls/15305/commits"},"statuses":{"href":"https://api.github.com/repos/edx/edx-platform/statuses/cc032cea1c0bc09eb8bc4925c80879ac45592310"}}}}
{"actor":{"display_login":"UmanShahzad"}}