Commit 2992d16
feat(cli): rudimentary support for http authentication (#165)
This MR implements the basic infrastructure for adding authentication to
HTTP requests (to indices, project source, ...). It is an intermediate
MR to #157, which intends to
bring more complete support, both in terms of supported authentication
schemes and configurability.
This MR only implements:
- Basic authentication scheme (username:password)
- Configurable in the CLI, via environment variables
The CLI looks for triplets of environment variables following the
pattern `SYSAND_CRED_<X>`, `SYSAND_CRED_<X>_BASIC_USER`,
`SYSAND_CRED_<X>_BASIC_PASS`. The `<X>` part is arbitrary, but every
`<X>` has to appear either not at all, or for all three patterns. The
first variable is a glob pattern to match URLs to allow authentication
for, while the other two provide the actual credentials.
Example
```
SYSAND_CRED_FOO='https://*.foo.com/**' SYSAND_CRED_FOO_BASIC_USER="bar" SYSAND_CRED_BASIC_PASS="baz" sysand <OP>
```
Would allow the use of `bar:baz` as credentials for urls such as
`https://www.foo.com/a/b/c`, `https://index.foo.com/hey.kpar`, ...
Credentials are only actually sent if an initial request generates a 4xx
status. The strictly correct behaviour here would be to try sending
credentials only in response to an explicit `401` with
`WWW-Authenticate` header, but this would, I believe, be incompatible
with using, for example, private GitLab/GitHub pages.
---------
Signed-off-by: Tilo Wiklund <tilo.wiklund@sensmetry.com>
Signed-off-by: Tilo Wiklund <75035892+tilowiklundSensmetry@users.noreply.github.com>
Co-authored-by: Victor Linroth <victor.linroth@sensmetry.com>1 parent 0d4f2ac commit 2992d16
33 files changed
Lines changed: 1490 additions & 190 deletions
File tree
- bindings
- java
- src
- js
- py/src
- core
- scripts
- src
- config
- env
- project
- resolve
- docs/src
- sysand
- scripts
- src
- commands
- tests
- common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
| 230 | + | |
| 231 | + | |
229 | 232 | | |
230 | 233 | | |
231 | 234 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| 160 | + | |
| 161 | + | |
159 | 162 | | |
160 | 163 | | |
161 | 164 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments