{"action":"created","issue":{"url":"https://api.github.com/repos/rabbitmq/rabbitmq-java-client/issues/350","repository_url":"https://api.github.com/repos/rabbitmq/rabbitmq-java-client","labels_url":"https://api.github.com/repos/rabbitmq/rabbitmq-java-client/issues/350/labels{/name}","comments_url":"https://api.github.com/repos/rabbitmq/rabbitmq-java-client/issues/350/comments","events_url":"https://api.github.com/repos/rabbitmq/rabbitmq-java-client/issues/350/events","html_url":"https://github.com/rabbitmq/rabbitmq-java-client/pull/350","id":297196219,"number":350,"title":"Allow pluggable means of acquiring the username and password for authentication","user":{"login":"spatula75","id":7718879,"avatar_url":"https://avatars1.githubusercontent.com/u/7718879?v=4","gravatar_id":"","url":"https://api.github.com/users/spatula75","html_url":"https://github.com/spatula75","followers_url":"https://api.github.com/users/spatula75/followers","following_url":"https://api.github.com/users/spatula75/following{/other_user}","gists_url":"https://api.github.com/users/spatula75/gists{/gist_id}","starred_url":"https://api.github.com/users/spatula75/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spatula75/subscriptions","organizations_url":"https://api.github.com/users/spatula75/orgs","repos_url":"https://api.github.com/users/spatula75/repos","events_url":"https://api.github.com/users/spatula75/events{/privacy}","received_events_url":"https://api.github.com/users/spatula75/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-14T18:19:21Z","updated_at":"2018-02-14T18:56:54Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/rabbitmq/rabbitmq-java-client/pulls/350","html_url":"https://github.com/rabbitmq/rabbitmq-java-client/pull/350","diff_url":"https://github.com/rabbitmq/rabbitmq-java-client/pull/350.diff","patch_url":"https://github.com/rabbitmq/rabbitmq-java-client/pull/350.patch"},"body":"Use a CredentialsProvider to pass usernames & passwords into AMQConnection with default\r\nimplementation that simply tracks a static username and password. Useful\r\nfor reconnect scenarios where the username or password might have\r\nchanged between the connect & reconnect.  Doesn't break the existing API,\r\nwhich uses the DefaultCredentialsProvider unless otherwise configured\r\nwith setCredentialsProvider.\r\n\r\n## Proposed Changes\r\n\r\nRationale: in some customized AuthC/AuthZ scenarios, especially where someone may be using  auth_backend_http, a username or a password might change between the time it was first used and the time it was needed to reconnect for a connection recovery.\r\n\r\nBy passing a CredentialsProvider (in a ConnectionParameters) to AMQConnection instead of a static username and password, and by requesting the username and password of the CredentialsProvider just prior to using them to connect, it is possible to provide a custom instance which knows how to go and fetch new credentials if necessary prior to making the connection.\r\n\r\nSo for example, if a custom token-based oauth scheme is used, and the token is short-lived, this custom implementation could request a new oauth token to be provided as the 'password', which then gets validated on the other side of the request by auth_backend_http.\r\n\r\nWithout some mechanism to refresh credentials, a recovery would continue to use the original token, which may no longer be valid.\r\n\r\nIt's also conceivable that it may be useful in some cases to have a username provided to a dumb client by some API call in a manner which is semi-random or at least changeable.  That, too, would be supportable by a custom CredentialsProvider (and then again handled by a custom server with auth_backend_http).\r\n\r\n## Types of Changes\r\n\r\nWhat types of changes does your code introduce to this project?\r\n_Put an `x` in the boxes that apply_\r\n\r\n- [ ] Bugfix (non-breaking change which fixes issue #NNNN)\r\n- [X] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)\r\n- [ ] Documentation (correction or otherwise)\r\n- [ ] Cosmetics (whitespace, appearance)\r\n\r\n## Checklist\r\n\r\n_Put an `x` in the boxes that apply. You can also fill these out after creating\r\nthe PR. If you're unsure about any of them, don't hesitate to ask on the\r\nmailing list. We're here to help! This is simply a reminder of what we are\r\ngoing to look for before merging your code._\r\n\r\n- [X] I have read the `CONTRIBUTING.md` document\r\n- [X] I have signed the CA (see https://cla.pivotal.io/sign/rabbitmq)\r\n- [X] All tests pass locally with my changes\r\n- [ ] I have added tests that prove my fix is effective or that my feature works\r\n- [X] I have added necessary documentation (if appropriate)\r\n- [ ] Any dependent changes have been merged and published in related repositories\r\n\r\n## Further Comments\r\n\r\nI'm still finding my way around in the test infrastructure, but I will try to add some tests for a custom CredentialsProvider as well once I figure it out.  Existing tests with the new DefaultCredentialsProvider are working in my local environment, so I'm reasonably confident.\r\n\r\nApologies for hitting cmd-shift-O (force of habit) once in ConnectionFactory and creating some spurious differences where Eclipse did an \"organize imports\".  I can try to revert that if it's important.\r\n\r\nI selfishly made these changes on the 4.4 branch because we're stuck with 4.4 until we can end our Java 7 support in the wild."},"comment":{"url":"https://api.github.com/repos/rabbitmq/rabbitmq-java-client/issues/comments/365708744","html_url":"https://github.com/rabbitmq/rabbitmq-java-client/pull/350#issuecomment-365708744","issue_url":"https://api.github.com/repos/rabbitmq/rabbitmq-java-client/issues/350","id":365708744,"user":{"login":"spatula75","id":7718879,"avatar_url":"https://avatars1.githubusercontent.com/u/7718879?v=4","gravatar_id":"","url":"https://api.github.com/users/spatula75","html_url":"https://github.com/spatula75","followers_url":"https://api.github.com/users/spatula75/followers","following_url":"https://api.github.com/users/spatula75/following{/other_user}","gists_url":"https://api.github.com/users/spatula75/gists{/gist_id}","starred_url":"https://api.github.com/users/spatula75/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spatula75/subscriptions","organizations_url":"https://api.github.com/users/spatula75/orgs","repos_url":"https://api.github.com/users/spatula75/repos","events_url":"https://api.github.com/users/spatula75/events{/privacy}","received_events_url":"https://api.github.com/users/spatula75/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T18:56:54Z","updated_at":"2018-02-14T18:56:54Z","author_association":"NONE","body":"Unfortunately I am not able to log in to concourse-ci to see what failed a check or why it failed.  If someone can copy/paste for me, I can look into it more thoroughly."}}
{"actor":{"display_login":"spatula75"}}