Skip to content

Add credentials support #473

Open
yisraelU wants to merge 5 commits intocoursier:mainfrom
yisraelU:AddCredentials
Open

Add credentials support #473
yisraelU wants to merge 5 commits intocoursier:mainfrom
yisraelU:AddCredentials

Conversation

@yisraelU
Copy link

@yisraelU yisraelU commented Mar 17, 2026

Add credentials support to Cache and fix auto-loading from config files

Expose credentials on the Java Cache API, matching the underlying Scala
FileCache model. Credentials stored in ~/.config/coursier/credentials.properties
(or COURSIER_CREDENTIALS) are now automatically picked up by all entry
points (Fetch, Complete, Versions, ArchiveCache, JvmManager). Also add the ability to manually add FileCredentials

Changes:

  • Expand Credentials with host, realm, optional, matchHost, httpsOnly,
    and passOnRedirect fields to match coursier's DirectCredentials
  • Add withCredentials/addCredentials/getCredentials to Cache
  • Add addCredentials convenience methods to Fetch, Complete, and Versions
  • Use addCredentials instead of withCredentials in ApiHelper.cache() so
    FileCache's default config-file credentials are preserved rather than
    overridden with an empty list
  • Fix per-repo credential round-trip to preserve realm, optional,
    httpsOnly, and passOnRedirect through Authentication conversion
  • Add comprehensive tests covering auto-loading, round-trips, all entry
    points, and the Credentials API surface

Yisrael Union added 5 commits March 10, 2026 22:22
…Redirect were being dropped in the credentials(Authentication) and credentials(Credentials) round-trip methods at lines
Copy link
Member

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this, this looks great! I'll review that in more detail in the days to come, then merge I think.

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.

2 participants