Skip to content

Commit 883a985

Browse files
committed
Move the local configuration option to future possibilities to avoid potential confusion
1 parent cc2579d commit 883a985

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

text/0000-cargo-alternative-registry-auth.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ Authorization: <token>
3636
## Interaction with HTTP registries
3737
The approved (but currently unimplemeneted) [RFC2789](https://github.com/rust-lang/rfcs/pull/2789) enables Cargo to fetch the index over HTTP. When fetching `config.json` from an HTTP index, if Cargo receives an `HTTP 401` response, the request will be re-attempted with the Authorization header included. If no authorization token is available, Cargo will suggest that the user run `cargo login` to add one.
3838

39-
To avoid the overhead of an extra HTTP request when fetching `config.json`, the user can optionally configure Cargo locally by setting `auth-required` in the `[registries]` table. If the local `auth-required` flag is `true` then Cargo will include the Authorization token when initially fetching `config.json` over HTTP. If it is `false`, Cargo will never include the Authorization token when fetching `config.json`. If it is unset, Cargo performs the auto-detection described above.
40-
41-
This local configuration option does not impact other registry operations, such as API requests or downloads (which are controlled by the flag in `config.json`). It also does not impact git-based registries.
42-
43-
```toml
44-
[registries]
45-
my-registry = { index = "sparse+https://example.com/index", auth-required = true }
46-
```
47-
4839
## Security
4940
If the server responds with an HTTP redirect, the redirect would be followed, but the Authorization header would *not* be sent to the redirect target.
5041

@@ -103,7 +94,17 @@ Alternatives:
10394
## Credential Process
10495
The `credential-process` system could be extended to support generating tokens rather than only storing them. This would further improve security and allow additional features such as 2FA prompts.
10596

97+
## Local configuration option
98+
To avoid the overhead of an extra HTTP request when fetching `config.json`, the user could optionally configure Cargo locally by setting `auth-required` in the `[registries]` table. If the local `auth-required` flag is `true`, then Cargo could include the Authorization token when initially fetching `config.json` over HTTP. If it is `false`, Cargo would not include the Authorization token when fetching `config.json`. If it is unset, Cargo would perform the auto-detection described above.
99+
100+
This local configuration option would not impact other registry operations, such as API requests or downloads (which are controlled by the flag in `config.json`). It also would not impact git-based registries.
101+
102+
```toml
103+
[registries]
104+
my-registry = { index = "sparse+https://example.com/index", auth-required = true }
105+
```
106+
106107
## Authentication for Git-based registries
107108
Private registries may want to use the same Authorization header for controlling access to a git-based index over `https`, rather than letting git handle the authentication separately.
108109

109-
This could be enabled by the same local configuration key `auth-required = true` in the `[registries]` table. Both `libgit2` and the `git` command line have a mechanism for specifying an additional header that could be used to pass the Authorization header.
110+
This could be enabled by the same local configuration key `auth-required = true` in the `[registries]` table. Both `libgit2` and the `git` command line have a mechanism for specifying an additional header that could be used to pass the Authorization header.

0 commit comments

Comments
 (0)