Add a new auth function, `DoWithAuthNoRetry()`, which sends an
HTTP request with authorization but won't retry if authorization
failed.
This commit also removes the `allowRetry` parameter from
`DoWithAuth()` as a result, and that function will now
retry requests where authorization failed as before.
Add an allowRetry parameter to DoWithAuth(). This parameter is a
boolean, and allows any requests without an authentication header
to be retried if an authorization error was returned.
This change is required to get things working with the basic
upload adapter. Since it passes along a file reader in the
request body, and since that reader is read by the HTTP Client
in a copy operation to construct a new request, an upload request
body can't be re-used in a new request.
Add a new Access parameter to DoWithAuth() to allow callers to
specify the URL Access Mode. This removes the assumption that
DoWithAuth() will always be used for an LFS API request. This
commit also adds DoAPIRequestWithAuth(), which provides the
functionality of DoWithAuth() while explicitly using the LFS API
endpoint for the access mode, allowing parity with the previous
DoWithAuth() functionality.
In a future commit, we're going to be accessing credential handling from
multiple packages. To avoid an import loop, move credential handling
into its own package. Update all the callers of the credential handling
code to use a qualified name.
Where there is a local variable called "creds", which would conflict
with our package name, rename it "cred" instead.
Extract more basic http-related functionality out of lfsapi and
into a new package, lfshttp. Everything is currently functional
aside from authorization.
This brings support for SingleSignOn on windows using the default credentials of the currently logged in user if
an empty username and empty password is provided from gitcredentials. This plays well with the Git for windows
implementation which stores an empty username and password if it should use the default credentials.