Skip to content

Support 401 responses for Batch API - #415

Merged
rubyist merged 14 commits into
masterfrom
401batch
Jun 29, 2015
Merged

rubyist merged 14 commits into
masterfrom
401batch

Conversation

@rubyist

@rubyist rubyist commented Jun 18, 2015

Copy link
Copy Markdown
Contributor

This PR adds full 401 support for the Batch API.

  • If access is not marked private, request Batch with no creds
  • If access is marked private, request Batch with creds
  • If a 401 is received, mark private, get creds, and reattempt the request

Related test server PR: git-lfs/lfs-test-server#33

@technoweenie

Copy link
Copy Markdown
Contributor

Don't worry about documentation, I already did that here. It's a PR, so still subject to changes of course.

Comment thread lfs/config.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to use strings.ToLower() here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll fix up nitpicks when things are closer to working. Just wanted to get this linked to your roadmap.

@technoweenie technoweenie mentioned this pull request Jun 19, 2015
8 of 13 tasks
@rubyist rubyist added review and removed wip labels Jun 24, 2015
@rubyist

rubyist commented Jun 24, 2015

Copy link
Copy Markdown
Contributor Author

This is ready for some 👀. The gist of things:

A copy of the newApiRequest and newClientRequest code was made for batch operations (the old code will eventually go away, so I'm OK with the copy).

When a batch request is run, it will check for an lfs.<url>.access configuration key, where <url> is the endpoint url. If the value is set to "private", the request will run with the credential helpers as it normally has. If the value is missing or any other value, the request will be attempted without authorization.

If a request fails with a 401, the lfs.<url>.access key will be set to private in .git/config, the credentials will be retrieved, and the request will be retried. All future batch requests will then get the credentials when they're run.

rubyist added a commit that referenced this pull request Jun 29, 2015
Support 401 responses for Batch API
@rubyist
rubyist merged commit 9783bff into master Jun 29, 2015
@rubyist
rubyist deleted the 401batch branch June 29, 2015 16:13
@rubyist rubyist removed the review label Jun 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants