-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Is your feature request related to a problem? Please describe.
I'm deploying a large number of sphinx sites (100+) via private GitLab pages deployments, and it would be useful to be able to use intersphinx to dynamically generate the links between them. We've had good success with this when the deployments via GitLab pages are public, but have run into a critical blocker for pages requiring authentication.
Intersphinx currently provides Basic Authorization [1][2], however GitLab does not support Basic Authorization; it only supports Bearer Authorization for programmatic access.
Describe the solution you'd like
Support for Bearer authorization:
token = "abcde"
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
intersphinx_bearer_token = {'python': token}A more general solution might be to allow the specification of the headers to use in the request
token = "abcde"
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
intersphinx_headers = {
'python': {
"Authorization": f"Bearer {token}",
}.
}Not tied to either of these solutions though - anything that provides Bearer authorization would be acceptable. It seems like exposing a configuration option for headers is likely to be the most robust to future issues though. This could borrow from the implementation of linkcheck_request_headers [3].
Describe alternatives you've considered
- Asking for GitLab to support Basic Authorization for access to GitLab pages. This was raised in https://gitlab.com/gitlab-org/gitlab-pages/-/issues/388 and appears to have been rejected.
- Taking the stub implementation described in this comment on the GitLab issue and using it to intercept the GET requests issued by intersphinx to inject the appropriate headers. This seems more like a hack/workaround though, so I'm not particularly in favour of doing this.
Additional context