New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix #9827] Add basic auth support to download raw yml config from private repo #9828
Conversation
39b3280
to
6933447
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some tests for this feature please?
b7c1342
to
afd2ab6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new feature. So it will be merged when we can confirm that the next release is not a bugfix release. Thank you.
lib/rubocop/remote_config.rb
Outdated
@@ -55,6 +55,7 @@ def request(uri = @uri, limit = 10, &block) | |||
def generate_request(uri) | |||
request = Net::HTTP::Get.new(uri.request_uri) | |||
|
|||
request['Authorization'] = "token #{uri.user}" if uri.user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this really should be Github specific. A Personal Access Token (PAT) can be used in Github using basic auth - which is the syntax suggested here where the user field of the URL is the PAT. Should this line be removed and set the user on the request
object like this?
request.basic_auth(uri.user, uri.password) if uri.user
I tested some sample code and this works for Github using a PAT and should work for any URL that supports basic auth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O cool. That works. Didn't know PAT works with basic auth. Thanks
@dvandersluis and @koic Let me know if you guys are good with the changes |
This PR adds Token auth support so that users can inherit shared config from the internal private repo.
This addresses #9827
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.