Skip to content

fork distribution client v3 auth-challenge as an internal package#2247

Closed
thaJeztah wants to merge 17 commits intogoogle:mainfrom
thaJeztah:fork_registryclient_authchallenge
Closed

fork distribution client v3 auth-challenge as an internal package#2247
thaJeztah wants to merge 17 commits intogoogle:mainfrom
thaJeztah:fork_registryclient_authchallenge

Conversation

@thaJeztah
Copy link
Copy Markdown
Contributor

fork distribution client v3 auth-challenge as an internal package

This forks the distribution's registry client auth-challenge code v3.0.0;
distribution/distribution@9ed95e7

The client code has moved to an internal package in the distribution project,
and is used to handle WWW-Authenticate headers. It was written a long time
ago, and only handles RFC 2617 (superseded by RFC 9110). Possibly there's more
current implementations for this, but this would introduce new dependencies, so
we can keep the status quo for now, and fork this code as an internal package.

Keeping it internal, due to the known limitations mentioned above, and to avoid
it being used by others assuming it's a general-purpose implementation.

This is the result of the following steps:

# install filter-repo (https://github.com/newren/git-filter-repo/blob/main/INSTALL.md)
brew install git-filter-repo

# create a temporary clone of docker
cd ~/Projects
git clone https://github.com/distribution/distribution.git distribution_auth
cd distribution_auth

# switch to v3.0.0 (git-filter doesn't like multiple branches, so reset)
git reset --hard v3.0.0

# commit taken from
git rev-parse --verify HEAD
9ed95e7365224025ee89365e12cf128e1f1bf965

git filter-repo --analyze

# remove all code, except for 'internal/client/auth/challenge'
# rename to 'pkg/v1/remote/internal/authchallenge'
# include history of old location ('registry/client/auth/challenge')
git filter-repo \
  --force \
  --path 'internal/client/auth/challenge' \
  --path 'registry/client/auth/challenge' \
  --path-rename internal/client/auth/challenge:pkg/v1/remote/internal/authchallenge

# go to the target github.com/docker/docker repository
cd ~/go/src/github.com/google/go-containerregistry

# create a branch to work with
git checkout -b fork_registryclient_authchallenge

# add the temporary repository as an upstream and make sure it's up-to-date
git remote add distribution_auth ~/Projects/distribution_auth
git fetch distribution_auth

# merge the upstream code
git merge --allow-unrelated-histories --signoff -S distribution_auth/main

After adding the internal fork;

  • authchallenge: rename package and update imports
  • pkg/v1/remote/internal/authchallenge: make manager-code a test-util
    The Manager code is only used as part of tests; move it to _test files
    to have a clearer separation between "production" code and test-code.

Misty Stanley-Jones and others added 15 commits September 28, 2016 14:14
Split challenges into its own package. Avoids possible
import cycle with challenges from client.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
Signed-off-by: Manish Tomar <manish.tomar@docker.com>
Signed-off-by: Michael Vetter <jubalh@iodoru.org>
Merge remote-tracking branch 'cli_temp/master' into vlan_network

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
…docs' into restore_docs3

Restore the documentation that was moved to https://github.com/docker/docker.github.io

 Conflicts:
	docs/compatibility.md
	docs/deploying.md
	docs/deprecated.md
	docs/garbage-collection.md
	docs/glossary.md
	docs/help.md
	docs/images/notifications.png
	docs/index.md
	docs/insecure.md
	docs/introduction.md
	docs/migration.md
	docs/notifications.md
	docs/recipes/apache.md
	docs/recipes/index.md
	docs/recipes/mirror.md
	docs/recipes/nginx.md
	docs/recipes/osx-setup-guide.md
	docs/recipes/osx/config.yml
	docs/storage-drivers/azure.md
	docs/storage-drivers/filesystem.md
	docs/storage-drivers/gcs.md
	docs/storage-drivers/index.md
	docs/storage-drivers/inmemory.md
	docs/storage-drivers/oss.md
	docs/storage-drivers/s3.md
	docs/storage-drivers/swift.md
gofumpt (https://github.com/mvdan/gofumpt) provides a supserset of `gofmt` / `go fmt`,
and addresses various formatting issues that linters may be checking for.

We can consider enabling the `gofumpt` linter to verify the formatting in CI, although
not every developer may have it installed, so for now this runs it once to get formatting
in shape.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Our registry client is not currently in a good place to be used as the
reference OCI Distribution client implementation. But the registry proxy
currently depends on it. Make the registry client internal to the
distribution application to remove it from the API surface area (and any
implied compatibility promises) of distribution/v3@v3.0.0 without
breaking the proxy.

Signed-off-by: Cory Snider <csnider@mirantis.com>
We make sure they're not hiding at the bottom or in the middle
which makes debugging an utter nightmare!

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This forks the distribution's registry client auth-challenge code v3.0.0;
distribution/distribution@9ed95e7

The client code has moved to an internal package in the distribution project,
and is used to handle `WWW-Authenticate` headers. It was written a long time
ago, and only handles RFC 2617 (superseded by RFC 9110). Possibly there's more
current implementations for this, but this would introduce new dependencies, so
we can keep the status quo for now, and fork this code as an internal package.

Keeping it internal, due to the known limitations mentioned above, and to avoid
it being used by others assuming it's a general-purpose implementation.

This is the result of the following steps:

    # install filter-repo (https://github.com/newren/git-filter-repo/blob/main/INSTALL.md)
    brew install git-filter-repo

    # create a temporary clone of docker
    cd ~/Projects
    git clone https://github.com/distribution/distribution.git distribution_auth
    cd distribution_auth

    # switch to v3.0.0 (git-filter doesn't like multiple branches, so reset)
    git reset --hard v3.0.0

    # commit taken from
    git rev-parse --verify HEAD
    9ed95e7365224025ee89365e12cf128e1f1bf965

    git filter-repo --analyze

    # remove all code, except for 'internal/client/auth/challenge'
    # rename to 'pkg/v1/remote/internal/authchallenge'
    # include history of old location ('registry/client/auth/challenge')
    git filter-repo \
      --force \
      --path 'internal/client/auth/challenge' \
      --path 'registry/client/auth/challenge' \
      --path-rename internal/client/auth/challenge:pkg/v1/remote/internal/authchallenge

    # go to the target github.com/docker/docker repository
    cd ~/go/src/github.com/google/go-containerregistry

    # create a branch to work with
    git checkout -b fork_registryclient_authchallenge

    # add the temporary repository as an upstream and make sure it's up-to-date
    git remote add distribution_auth ~/Projects/distribution_auth
    git fetch distribution_auth

    # merge the upstream code
    git merge --allow-unrelated-histories --signoff -S distribution_auth/main

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Mar 28, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The Manager code is only used as part of tests; move it to _test files
to have a clearer separation between "production" code and test-code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the fork_registryclient_authchallenge branch from 761ab02 to b0cc5e1 Compare March 28, 2026 13:10
@thaJeztah
Copy link
Copy Markdown
Contributor Author

Doh! Looks like preserving the commit history trips up the CLA check; I could forego that, but tried to keep history (but maybe it's not critical)? cc @Subserial @jonjohnsonjr any thoughts?

@thaJeztah
Copy link
Copy Markdown
Contributor Author

@thaJeztah thaJeztah closed this Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants