Skip to content

Commit 95b24f6

Browse files
committed
non-substantials edits
1 parent 65915fd commit 95b24f6

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

docs/auth-flows.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# Authentication Flows
22

33
If authentication is required, Julia uses [bearer tokens (RFC 6750)](https://datatracker.ietf.org/doc/html/rfc6750) to authenticate package server requests.
4-
That is, the HTTP requests set the `Authorization: Bearer $access_token` header when fetching data from the package server.
4+
That is, the HTTP requests set the `Authorization: Bearer $(access_token)` header when fetching data from the package server.
55

66
The PkgAuthentication manages acquiring these tokens from package server, generally via an interactive flow.
7-
This document describes the details related to the authentication,
7+
This document describes the protocols related to the authentication,
88
and also acts as a specification for a few PkgAuthentication-specific conventions that _authenticated_ package servers should follow.
99

1010
Additional resources & references:
1111

1212
- [Original implementation notes `JuliaLang/Pkg.jl#1538`](https://github.com/JuliaLang/Pkg.jl/pull/1538#issuecomment-564118431)
1313

14+
_Note: the discussions of the package server protocol itself (i.e. downloading of registires, packages, and artifacts) is out of scope of this document._
15+
1416
## Authenticated package requests & `auth.toml` files
1517

16-
Julia (i.e. Pkg - the package manager) stores the token information in a `auth.toml` file in the "server directory".
18+
Julia (i.e. Pkg.jl - the package manager) stores the token information in a `auth.toml` file in the "server directory".
1719
For each package server host, it is generally stored as a TOML file at `~/.julia/servers/{hostname}/auth.toml`.
1820

1921
Pkg uses the following top-level key values pairs:
@@ -28,7 +30,7 @@ The `auth.toml` file may contain other fields (e.g. a username, or user email),
2830

2931
The two other fields mentioned in RFC6750 are `token_type` and `scope`.
3032
These are omitted since only Bearer tokens are currently supported, and the scope is always implicitly to provide access to Pkg protocol URLs.
31-
Pkg servers should, however, not send `auth.toml` files with token_type or scope fields, as these names may be used in the future, e.g. to support other kinds of tokens or to limit the scope of an authorization to a subset of Pkg protocol URLs.
33+
Pkg servers, however, SHOULD NOT send `auth.toml` files with `token_type` or `scope` fields, as these names may be used in the future, e.g. to support other kinds of tokens or to limit the scope of an authorization to a subset of Pkg protocol URLs.
3234

3335
As an example, a valid `auth.toml` file might look something like this:
3436

@@ -49,7 +51,7 @@ The expiration time is the minimum of `expires_at` and `mtime(auth_file) + expir
4951
When the Pkg client downloads a new `auth.toml` file, if there is a relative `expires_in` field, an absolute `expires_at` value is computed based on the client's current clock time.
5052
This combination of policies allows expiration to work gracefully even in the presence of clock skew between the server and the client.
5153

52-
If the access token is expired and there are `refresh_token` and `refresh_url` fields in `auth.toml`, a new auth file is requested by making a request to `refresh_url` with an `Authorization: Bearer $refresh_token` header.
54+
If the access token is expired and there are `refresh_token` and `refresh_url` fields in `auth.toml`, a new auth file is requested by making a request to `refresh_url` with an `Authorization: Bearer $(refresh_token)` header.
5355
Pkg will refuse to make the refresh request unless `refresh_url` is an HTTPS URL.
5456

5557
Note that `refresh_url` need not be a URL on the Pkg server: token refresh can be handled by separate server.
@@ -64,12 +66,12 @@ If, after attempting to refresh the access token, the server still returns HTTP
6466

6567
## Acquiring Authentication Tokens
6668

67-
PkgAuthentication is designed to assist the user in acquiring authentication tokens by performing an interactive, browser-base authentication flow.
69+
PkgAuthentication is designed to assist the user in acquiring authentication tokens by performing an interactive, browser-based authentication flow.
6870

69-
To start an authentication flow, the following information is necessary to know which URL to request the token from:
71+
The following information is necessary to start the authentication flow, to know which URL to request the token from:
7072

7173
* `pkg_server`: the package server URL; i.e. the value that is used (and generally automatically determined from) the `JULIA_PKG_SERVER` environment variable.
72-
* `auth_suffix`: specifies an additional URL suffix to append to the `pkg_server` URL to form authentication URLs. This defaults to `/auth`.
74+
* `auth_suffix`: specifies an additional URL suffix to append to the `pkg_server` URL to form the authentication URLs. This defaults to `/auth`.
7375

7476
### Notational Conventions
7577

@@ -101,9 +103,9 @@ The flow goes through the following steps:
101103
$(pkg_server)/$(auth_suffix)/response?$(response)
102104
```
103105

104-
The package server should implement a basic interface for the user to approve or deny the authentication request.
105-
It should also indicate which user is logged in and which package server is being authenticated against.
106-
When the user approves the request, it should indicate to the user that the request has been approved and that they can close the browser window and return to their application.
106+
The package server SHOULD implement a basic interface for the user to approve or deny the authentication request.
107+
It SHOULD also indicate which user is logged in and which package server is being authenticated against.
108+
When the user approves the request, it SHOULD indicate to the user that the request has been approved and that they can close the browser window and return to their application.
107109

108110
4. Polling the package server's token claiming endpoint.
109111

0 commit comments

Comments
 (0)