Problem
#5240 isolates authenticated HTTP sessions by registry URL, but API-key authentication remains process-global. After setting a key for registry A, switching to registry B through a registry override creates B's session with A's key. This can cause authentication failures or disclose A's credential to B.
Expected behavior
- Associate each in-memory API key with the resolved registry URL it authenticates to.
- Use a key only when creating a session for that same registry.
- Preserve existing single-registry
login_with_api_key() behavior.
- Allow clearing one registry's key without affecting others;
logout() may continue clearing all authentication state.
- Cover switching, nesting, and concurrent contexts so API keys never cross registry boundaries.
Follow-up to #5240.
Problem
#5240 isolates authenticated HTTP sessions by registry URL, but API-key authentication remains process-global. After setting a key for registry A, switching to registry B through a registry override creates B's session with A's key. This can cause authentication failures or disclose A's credential to B.
Expected behavior
login_with_api_key()behavior.logout()may continue clearing all authentication state.Follow-up to #5240.