Skip to content

(maint) Accept ARTIFACTORY_ACCESS_TOKEN in check_authorization#1277

Closed
isaac-jha wants to merge 1 commit into
1.0.xfrom
support_access_token
Closed

(maint) Accept ARTIFACTORY_ACCESS_TOKEN in check_authorization#1277
isaac-jha wants to merge 1 commit into
1.0.xfrom
support_access_token

Conversation

@isaac-jha

Copy link
Copy Markdown
Contributor

Summary

  • check_authorization in lib/packaging/artifactory.rb now accepts ARTIFACTORY_ACCESS_TOKEN alongside the existing ARTIFACTORY_USERNAME/ARTIFACTORY_PASSWORD and ARTIFACTORY_API_KEY variants.
  • Error message updated to guide callers toward ARTIFACTORY_ACCESS_TOKEN and note that ARTIFACTORY_API_KEY is deprecated by JFrog.
  • Spec extended with positive tests for both the new access-token path and the existing (deprecated) api-key path, with an around hook that isolates env-var state per example.

Why

JFrog deprecated API-key authentication and blocked new API-key creation starting with Artifactory 7.98. The bundled puppet-artifactory-client SDK already accepts an access token via ARTIFACTORY_ACCESS_TOKEN (see lib/artifactory/defaults.rb / lib/artifactory/client.rb in that repo — the auth precedence there is username+password → access_token → api_key). But this gem's check_authorization only recognized the old set, so any caller that migrated to a scoped access token or reference token would hit the "Unable to determine credentials" error even though the underlying SDK would authenticate fine.

This is a prerequisite for the on-prem Artifactory upgrade to 7.146.x — we need callers to be able to run against a new access token without changing this gem's semantics for existing callers.

Test plan

  • bundle exec rspec spec/lib/packaging/artifactory_spec.rb — 66 examples, 0 failures locally.
  • CI passes.

Notes

  • ARTIFACTORY_API_KEY remains fully supported for backwards compatibility until existing callers migrate. No behavior change for them.
  • Priority order between the three auth surfaces is delegated to the SDK, which currently prefers basic auth → access token → api key.

🤖 Generated with Claude Code

JFrog deprecated API-key authentication and blocked new API-key
creation in Artifactory 7.98. The bundled puppet-artifactory-client
SDK already accepts an access token via the ARTIFACTORY_ACCESS_TOKEN
env var, but check_authorization here only recognized
ARTIFACTORY_USERNAME/PASSWORD or ARTIFACTORY_API_KEY. Callers that
had migrated to a scoped access token or reference token would hit
the "unable to determine credentials" error even though the
underlying SDK would authenticate fine.

Add ARTIFACTORY_ACCESS_TOKEN to the accepted set and update the
error message to guide new callers toward it while noting
ARTIFACTORY_API_KEY as deprecated.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@isaac-jha
isaac-jha requested a review from a team as a code owner July 13, 2026 16:50
@isaac-jha

Copy link
Copy Markdown
Contributor Author

Closing — team no longer uses this repo; equivalent fix will land in packaging-private only.

@isaac-jha isaac-jha closed this Jul 13, 2026
@isaac-jha
isaac-jha deleted the support_access_token branch July 13, 2026 17:31
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.

1 participant