Class PkgRepoCredentialResolver

java.lang.Object
io.root.patcher.PkgRepoCredentialResolver

public class PkgRepoCredentialResolver extends Object
Resolves credentials for the pkg Maven repository.

Priority:

  1. Explicit pkgUsername + pkgPassword — use as-is (e.g. JFrog credentials).
  2. Root.io apiKey — used as the password with the fixed username "token" (the default pkg.root.io convention).
  3. Neither set — no credentials injected (anonymous or externally managed).

Note: apiKey is separate from pkg repo credentials. It is used exclusively for authenticating against the Root.io /v3/analyze API. When the API becomes open, apiKey will no longer be required and pkg repo credentials will be the only thing needed.

  • Constructor Details

    • PkgRepoCredentialResolver

      public PkgRepoCredentialResolver()
  • Method Details

    • resolve

      @Nullable public static org.gradle.api.Action<? super org.gradle.api.artifacts.repositories.PasswordCredentials> resolve(RootIoExtension extension, ApiKeyResolver apiKeyResolver, File rootDir)
      Returns an Action that applies credentials to a Gradle PasswordCredentials, or null if no credentials should be used (anonymous or file:// repo).
      Parameters:
      extension - the rootio extension; pkgUrl is read to determine if the repo is HTTP(S) — file:// repos never get credentials
      apiKeyResolver - used to resolve the apiKey from env/system-property/.env as a fallback
      rootDir - root directory passed to apiKeyResolver
      Returns:
      an Action that configures credentials, or null for anonymous/file repos