{"action":"closed","number":21,"pull_request":{"url":"https://api.github.com/repos/scrogson/romeo/pulls/21","id":85642232,"html_url":"https://github.com/scrogson/romeo/pull/21","diff_url":"https://github.com/scrogson/romeo/pull/21.diff","patch_url":"https://github.com/scrogson/romeo/pull/21.patch","issue_url":"https://api.github.com/repos/scrogson/romeo/issues/21","number":21,"state":"closed","locked":false,"title":"Alternative auth mechanism extension api","user":{"login":"jbr","id":13301,"avatar_url":"https://avatars.githubusercontent.com/u/13301?v=3","gravatar_id":"","url":"https://api.github.com/users/jbr","html_url":"https://github.com/jbr","followers_url":"https://api.github.com/users/jbr/followers","following_url":"https://api.github.com/users/jbr/following{/other_user}","gists_url":"https://api.github.com/users/jbr/gists{/gist_id}","starred_url":"https://api.github.com/users/jbr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbr/subscriptions","organizations_url":"https://api.github.com/users/jbr/orgs","repos_url":"https://api.github.com/users/jbr/repos","events_url":"https://api.github.com/users/jbr/events{/privacy}","received_events_url":"https://api.github.com/users/jbr/received_events","type":"User","site_admin":false},"body":"This PR allows library users to specify their own auth mechanism implementations in the `preferred_auth_mechanism` list. Because of the X in XMPP, it is likely preferable for romeo to avoid implementing extensions to the protocol, but instead provide extension apis.  The proposed API retains the orderedness of the `preferred_auth_mechanisms` list and still checks against the server's supported auth mechanisms.\r\n\r\nExample usage:\r\n\r\n```elixir\r\n  def start_link({host, jid, access_token}) do\r\n    romeo_options =\r\n      [host: host,\r\n       jid: jid,\r\n       password: access_token,\r\n       preferred_auth_mechanisms: [{\"X-OAUTH2\", &oauth2_mechanism/1}]]\r\n\r\n    {:ok, pid} = Romeo.Connection.start_link romeo_options\r\n  end\r\n\r\n  defp oauth2_mechanism(%{transport: mod, jid: jid, password: password} = conn) do\r\n    payload = <<0>> <> jid <> <<0>> <> password\r\n    additional_attrs = [{\"auth:service\", \"oauth2\"}, {\"xmlns:auth\", \"http://www.google.com/talk/protocol/auth\"}]\r\n    mod.send(conn, Romeo.Stanza.auth(\"X-OAUTH2\", Romeo.Stanza.base64_cdata(payload), additional_attrs))\r\n  end\r\n```","created_at":"2016-09-16T21:24:23Z","updated_at":"2016-10-08T05:55:48Z","closed_at":"2016-10-08T05:55:48Z","merged_at":"2016-10-08T05:55:48Z","merge_commit_sha":"88d50f32dc240af1a1308da57e3e1bfc58329d0e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/scrogson/romeo/pulls/21/commits","review_comments_url":"https://api.github.com/repos/scrogson/romeo/pulls/21/comments","review_comment_url":"https://api.github.com/repos/scrogson/romeo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scrogson/romeo/issues/21/comments","statuses_url":"https://api.github.com/repos/scrogson/romeo/statuses/329c04f0e36ef74505bd22d38c4c1399cc98998c","head":{"label":"jbr:auth-mechanism-extension-api","ref":"auth-mechanism-extension-api","sha":"329c04f0e36ef74505bd22d38c4c1399cc98998c","user":{"login":"jbr","id":13301,"avatar_url":"https://avatars.githubusercontent.com/u/13301?v=3","gravatar_id":"","url":"https://api.github.com/users/jbr","html_url":"https://github.com/jbr","followers_url":"https://api.github.com/users/jbr/followers","following_url":"https://api.github.com/users/jbr/following{/other_user}","gists_url":"https://api.github.com/users/jbr/gists{/gist_id}","starred_url":"https://api.github.com/users/jbr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbr/subscriptions","organizations_url":"https://api.github.com/users/jbr/orgs","repos_url":"https://api.github.com/users/jbr/repos","events_url":"https://api.github.com/users/jbr/events{/privacy}","received_events_url":"https://api.github.com/users/jbr/received_events","type":"User","site_admin":false},"repo":{"id":67638737,"name":"romeo","full_name":"jbr/romeo","owner":{"login":"jbr","id":13301,"avatar_url":"https://avatars.githubusercontent.com/u/13301?v=3","gravatar_id":"","url":"https://api.github.com/users/jbr","html_url":"https://github.com/jbr","followers_url":"https://api.github.com/users/jbr/followers","following_url":"https://api.github.com/users/jbr/following{/other_user}","gists_url":"https://api.github.com/users/jbr/gists{/gist_id}","starred_url":"https://api.github.com/users/jbr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbr/subscriptions","organizations_url":"https://api.github.com/users/jbr/orgs","repos_url":"https://api.github.com/users/jbr/repos","events_url":"https://api.github.com/users/jbr/events{/privacy}","received_events_url":"https://api.github.com/users/jbr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jbr/romeo","description":"An XMPP Client for Elixir","fork":true,"url":"https://api.github.com/repos/jbr/romeo","forks_url":"https://api.github.com/repos/jbr/romeo/forks","keys_url":"https://api.github.com/repos/jbr/romeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jbr/romeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jbr/romeo/teams","hooks_url":"https://api.github.com/repos/jbr/romeo/hooks","issue_events_url":"https://api.github.com/repos/jbr/romeo/issues/events{/number}","events_url":"https://api.github.com/repos/jbr/romeo/events","assignees_url":"https://api.github.com/repos/jbr/romeo/assignees{/user}","branches_url":"https://api.github.com/repos/jbr/romeo/branches{/branch}","tags_url":"https://api.github.com/repos/jbr/romeo/tags","blobs_url":"https://api.github.com/repos/jbr/romeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jbr/romeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jbr/romeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/jbr/romeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jbr/romeo/statuses/{sha}","languages_url":"https://api.github.com/repos/jbr/romeo/languages","stargazers_url":"https://api.github.com/repos/jbr/romeo/stargazers","contributors_url":"https://api.github.com/repos/jbr/romeo/contributors","subscribers_url":"https://api.github.com/repos/jbr/romeo/subscribers","subscription_url":"https://api.github.com/repos/jbr/romeo/subscription","commits_url":"https://api.github.com/repos/jbr/romeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/jbr/romeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/jbr/romeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/jbr/romeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/jbr/romeo/contents/{+path}","compare_url":"https://api.github.com/repos/jbr/romeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jbr/romeo/merges","archive_url":"https://api.github.com/repos/jbr/romeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jbr/romeo/downloads","issues_url":"https://api.github.com/repos/jbr/romeo/issues{/number}","pulls_url":"https://api.github.com/repos/jbr/romeo/pulls{/number}","milestones_url":"https://api.github.com/repos/jbr/romeo/milestones{/number}","notifications_url":"https://api.github.com/repos/jbr/romeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jbr/romeo/labels{/name}","releases_url":"https://api.github.com/repos/jbr/romeo/releases{/id}","deployments_url":"https://api.github.com/repos/jbr/romeo/deployments","created_at":"2016-09-07T19:53:56Z","updated_at":"2016-09-07T19:53:57Z","pushed_at":"2016-10-04T23:43:37Z","git_url":"git://github.com/jbr/romeo.git","ssh_url":"git@github.com:jbr/romeo.git","clone_url":"https://github.com/jbr/romeo.git","svn_url":"https://github.com/jbr/romeo","homepage":"","size":105,"stargazers_count":0,"watchers_count":0,"language":"Elixir","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scrogson:master","ref":"master","sha":"fe92d500a030555ad5ed0b36ac75c6a14f33935e","user":{"login":"scrogson","id":53274,"avatar_url":"https://avatars.githubusercontent.com/u/53274?v=3","gravatar_id":"","url":"https://api.github.com/users/scrogson","html_url":"https://github.com/scrogson","followers_url":"https://api.github.com/users/scrogson/followers","following_url":"https://api.github.com/users/scrogson/following{/other_user}","gists_url":"https://api.github.com/users/scrogson/gists{/gist_id}","starred_url":"https://api.github.com/users/scrogson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrogson/subscriptions","organizations_url":"https://api.github.com/users/scrogson/orgs","repos_url":"https://api.github.com/users/scrogson/repos","events_url":"https://api.github.com/users/scrogson/events{/privacy}","received_events_url":"https://api.github.com/users/scrogson/received_events","type":"User","site_admin":false},"repo":{"id":46234958,"name":"romeo","full_name":"scrogson/romeo","owner":{"login":"scrogson","id":53274,"avatar_url":"https://avatars.githubusercontent.com/u/53274?v=3","gravatar_id":"","url":"https://api.github.com/users/scrogson","html_url":"https://github.com/scrogson","followers_url":"https://api.github.com/users/scrogson/followers","following_url":"https://api.github.com/users/scrogson/following{/other_user}","gists_url":"https://api.github.com/users/scrogson/gists{/gist_id}","starred_url":"https://api.github.com/users/scrogson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrogson/subscriptions","organizations_url":"https://api.github.com/users/scrogson/orgs","repos_url":"https://api.github.com/users/scrogson/repos","events_url":"https://api.github.com/users/scrogson/events{/privacy}","received_events_url":"https://api.github.com/users/scrogson/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/scrogson/romeo","description":"An XMPP Client for Elixir","fork":false,"url":"https://api.github.com/repos/scrogson/romeo","forks_url":"https://api.github.com/repos/scrogson/romeo/forks","keys_url":"https://api.github.com/repos/scrogson/romeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrogson/romeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrogson/romeo/teams","hooks_url":"https://api.github.com/repos/scrogson/romeo/hooks","issue_events_url":"https://api.github.com/repos/scrogson/romeo/issues/events{/number}","events_url":"https://api.github.com/repos/scrogson/romeo/events","assignees_url":"https://api.github.com/repos/scrogson/romeo/assignees{/user}","branches_url":"https://api.github.com/repos/scrogson/romeo/branches{/branch}","tags_url":"https://api.github.com/repos/scrogson/romeo/tags","blobs_url":"https://api.github.com/repos/scrogson/romeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrogson/romeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrogson/romeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrogson/romeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrogson/romeo/statuses/{sha}","languages_url":"https://api.github.com/repos/scrogson/romeo/languages","stargazers_url":"https://api.github.com/repos/scrogson/romeo/stargazers","contributors_url":"https://api.github.com/repos/scrogson/romeo/contributors","subscribers_url":"https://api.github.com/repos/scrogson/romeo/subscribers","subscription_url":"https://api.github.com/repos/scrogson/romeo/subscription","commits_url":"https://api.github.com/repos/scrogson/romeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrogson/romeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrogson/romeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrogson/romeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrogson/romeo/contents/{+path}","compare_url":"https://api.github.com/repos/scrogson/romeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrogson/romeo/merges","archive_url":"https://api.github.com/repos/scrogson/romeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrogson/romeo/downloads","issues_url":"https://api.github.com/repos/scrogson/romeo/issues{/number}","pulls_url":"https://api.github.com/repos/scrogson/romeo/pulls{/number}","milestones_url":"https://api.github.com/repos/scrogson/romeo/milestones{/number}","notifications_url":"https://api.github.com/repos/scrogson/romeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrogson/romeo/labels{/name}","releases_url":"https://api.github.com/repos/scrogson/romeo/releases{/id}","deployments_url":"https://api.github.com/repos/scrogson/romeo/deployments","created_at":"2015-11-15T20:42:26Z","updated_at":"2016-09-13T23:53:34Z","pushed_at":"2016-10-08T05:55:48Z","git_url":"git://github.com/scrogson/romeo.git","ssh_url":"git@github.com:scrogson/romeo.git","clone_url":"https://github.com/scrogson/romeo.git","svn_url":"https://github.com/scrogson/romeo","homepage":"","size":124,"stargazers_count":23,"watchers_count":23,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":2,"forks":12,"open_issues":2,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scrogson/romeo/pulls/21"},"html":{"href":"https://github.com/scrogson/romeo/pull/21"},"issue":{"href":"https://api.github.com/repos/scrogson/romeo/issues/21"},"comments":{"href":"https://api.github.com/repos/scrogson/romeo/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/scrogson/romeo/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/scrogson/romeo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scrogson/romeo/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/scrogson/romeo/statuses/329c04f0e36ef74505bd22d38c4c1399cc98998c"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"scrogson","id":53274,"avatar_url":"https://avatars.githubusercontent.com/u/53274?v=3","gravatar_id":"","url":"https://api.github.com/users/scrogson","html_url":"https://github.com/scrogson","followers_url":"https://api.github.com/users/scrogson/followers","following_url":"https://api.github.com/users/scrogson/following{/other_user}","gists_url":"https://api.github.com/users/scrogson/gists{/gist_id}","starred_url":"https://api.github.com/users/scrogson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrogson/subscriptions","organizations_url":"https://api.github.com/users/scrogson/orgs","repos_url":"https://api.github.com/users/scrogson/repos","events_url":"https://api.github.com/users/scrogson/events{/privacy}","received_events_url":"https://api.github.com/users/scrogson/received_events","type":"User","site_admin":false},"comments":4,"review_comments":3,"commits":3,"additions":36,"deletions":17,"changed_files":2}}
{"actor":{"display_login":"scrogson"}}