You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/auth-flows.md
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,21 @@
1
1
# Authentication Flows
2
2
3
3
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.
5
5
6
6
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,
8
8
and also acts as a specification for a few PkgAuthentication-specific conventions that _authenticated_ package servers should follow.
_Note: the discussions of the package server protocol itself (i.e. downloading of registires, packages, and artifacts) is out of scope of this document._
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".
17
19
For each package server host, it is generally stored as a TOML file at `~/.julia/servers/{hostname}/auth.toml`.
18
20
19
21
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),
28
30
29
31
The two other fields mentioned in RFC6750 are `token_type` and `scope`.
30
32
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.
32
34
33
35
As an example, a valid `auth.toml` file might look something like this:
34
36
@@ -49,7 +51,7 @@ The expiration time is the minimum of `expires_at` and `mtime(auth_file) + expir
49
51
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.
50
52
This combination of policies allows expiration to work gracefully even in the presence of clock skew between the server and the client.
51
53
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.
53
55
Pkg will refuse to make the refresh request unless `refresh_url` is an HTTPS URL.
54
56
55
57
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
64
66
65
67
## Acquiring Authentication Tokens
66
68
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.
68
70
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:
70
72
71
73
*`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`.
73
75
74
76
### Notational Conventions
75
77
@@ -101,9 +103,9 @@ The flow goes through the following steps:
101
103
$(pkg_server)/$(auth_suffix)/response?$(response)
102
104
```
103
105
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.
107
109
108
110
4. Polling the package server's token claiming endpoint.
0 commit comments