Repository navigation
Use authentication challenge for unauthenticated container registry repository - #1797
Merged
Merged
Conversation
Fix NRE when getting scope Fix call to realm Fix scope Add content to the webrequest Remove extra debug Fix error message
Aditya Patwardhan (adityapatwardhan)
requested review from
alerickson and
Anam Navied (anamnavi)
February 19, 2025 21:50
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
…into MCRAuthChallenge
Aditya Patwardhan (adityapatwardhan)
force-pushed
the
MCRAuthChallenge
branch
from
February 19, 2025 22:56
22710de to
54d9cf0
Compare
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
alerickson
approved these changes
Feb 21, 2025
Anam Navied (anamnavi)
pushed a commit
that referenced
this pull request
Mar 6, 2025
alerickson
pushed a commit
to alerickson/PSResourceGet
that referenced
this pull request
Jun 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This pull request includes several changes to improve the handling and testing of unauthenticated access tokens for container registries. The most important changes include updating token templates, modifying access token retrieval logic, and adding new tests for unauthenticated repositories.
Improvements to token handling:
src/code/ContainerRegistryServerAPICalls.cs: Updated thecontainerRegistryAccessTokenTemplateto includeregistry:catalog:*scope and added a newdefaultScopeconstant.Modifications to access token retrieval logic:
src/code/ContainerRegistryServerAPICalls.cs: Modified theGetContainerRegistryAccessTokenmethod to retrieve and return an anonymous access token if available. [1] [2]src/code/ContainerRegistryServerAPICalls.cs: Updated theIsContainerRegistryUnauthenticatedmethod to check for an authentication challenge header and retrieve an anonymous access token if present.Code simplification:
src/code/ContainerRegistryServerAPICalls.cs: Simplified theFindPackagesmethod to handle repository names with and without thepsresource/prefix.Testing improvements:
test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1: Modified a test to ensure all resources are found given the name*.test/FindPSResourceTests/FindPSResourceContainerRegistryServer.Tests.ps1: Added a new test for finding resources in an unauthenticated ACR repository.PR Context
Unauthenticated ACR other than MCR respond with an auth challenge to acquire an anonymous token. This token is required for further operations.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.