Repository navigation
Add NTLM Auth - #714
Add NTLM Auth#714
Conversation
* Switched the NTLM toggle to use the same url access pattern as private batch auth * Updated the NTLM session to pull the credentials from the cred helper
|
Checks are failing because I haven't yet included the ntlm auth library. Assuming that folks are ok with this implementation and the libraries used I'll add it in the next iteration. |
There was a problem hiding this comment.
Remove the ntlm check here--ntlm is private access.
There was a problem hiding this comment.
Looks like this is hiding a possible error. I think that this function should be private, and should return a possible error that other functions can bubble up.
There was a problem hiding this comment.
If we read the entire response into memory, large files can definitely crash the client on low memory machines. We could maybe do this if content length is set and it's under some value - but I would really prefer to not do it at all for downloads. This is also ignoring the error.
|
Reading the whole body into memory doesn't seem like it's going to help much, because it still takes time to do that. Reading into memory vs reading into a file will probably not differ significantly enough to matter while running concurrent transfers, particularly with groups of files of varying sizes. I think the way to guarantee that the connection will be reused is to not run it concurrently. This could be done at a higher level by setting the number of workers for the transfer queue to 1. But then I'd have to wonder if that's really worth it vs re-authing connections. What's the cost there? Do we have benchmarks? I'm thinking setting the max idle conns to be >= the number of concurrent workers should limit the number of connections that get tossed. |
|
If you're reading the entire body in order to try to force the re-use of the authenticated connection, you're just serialising all the transfers anyway, so you might as well make that explicit by disabling concurrency for NTLM. The first request is always issued serially anyway (others are delayed until auth has been performed) so once you've detected NTLM in that first request you could disable parallel requests if you wanted to re-use the connection, without bulk reading into memory all the time. I'm actually not convinced that the ReadAll is guaranteed not to be interrupted by another goroutine anyway, Go makes no assurances on that, so using it to try to serialise the requests probably isn't 100% watertight - it might be in this Go version but not always. Only deliberately running only one request at a time would do that, and then the regular code paths would ensure the body is read & closed before the next request. But, I also agree with @rubyist that the proper solution is to allow the parallel transfers and to find a way to do the NTLM auth per connection, although I suspect that needs a to be implemented in a Transport implementation. TBH there's probably a good argument that our existing auth sequence should be in a Transport and not in the calling code. |
.. although the first request would still need to be serialised in order to ensure the user only gets one login prompt. |
|
I think that we were just missing a close in an earlier version somewhere. I removed the body copying and upload works just fine with |
|
I lied. Upload works fine, but Download has race conditions where some number of files don't get downloaded depending on interleaving. Setting |
There was a problem hiding this comment.
We shouldn't need this. res comes from doLegacyApiRequest(), which calls decodeApiResponse(). That function parses json and immediately closes the response body. While it doesn't hurt, these lines shouldn't be required.
|
See #820 |
This a first attempt at adding NTLM auth. It addresss the proposal in #617. Please let me know your thoughts.
It uses lfs.{endpoint}.access to toggle NTLM and most ntlm specific logic is in its own class. We store user/pass in the cred helper but could later go get them from AD.
Things that still need to be done: