Skip to content

Conversation

@EyalDelarea
Copy link
Contributor

@EyalDelarea EyalDelarea commented Apr 14, 2025

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • This pull request is on the dev branch.
  • I used npm run format for formatting the code before submitting the pull request.

🔒 Why This Matters

This PR introduces native support for OIDC authentication in the JFrog Azure DevOps extension, allowing pipelines to authenticate without long-lived credentials. By using Azure DevOps as a trusted identity provider, users can securely exchange OIDC tokens for temporary JFrog access tokens at runtime.


✅ Key Features Introduced

  • OIDC token exchange via the JFrog CLI eot command (jf eot <provider> <id-token>)
  • Output variables for username and access token are now exposed via:
    ##vso[task.setvariable variable=oidc_user;isOutput=true]<value>
    ##vso[task.setvariable variable=oidc_token;isOutput=true]<value>
  • Full documentation added to the README.md:
    • How to configure JFrog OIDC integration
    • Setting up Identity Mappings
    • Creating a proper Service Connection with OIDC
  • Support for all JFrog product types (Artifactory, Xray, Distribution) through new endpoint-auth-scheme-none definitions

⚙ Why Use jf eot Instead of jf c add --oidc-*?

The CLI’s jf c add --oidc-* approach adds OIDC configuration directly, but:

  • ❌ It does not expose the resulting credentials (username, access token) for reuse
  • jf eot explicitly exchanges the OIDC ID token and outputs the credentials, which can then be exported and reused for other tools (e.g., Docker login, Helm)

This makes jf eot more flexible for CI environments that rely on short-lived credentials being passed across multiple steps.


🧪 Example: Consuming Exported OIDC Variables in Pipelines

steps:
- task: JfrogCliV2@1
  name: jfStep
  inputs:
    jfrogPlatformConnection: 'azure-oidc'
    command: 'jf rt ping'

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
        echo "OIDC Username (from output): $(jfStep.oidc_user)"
        echo "OIDC Token (from env): $env:oidc_token"
  displayName: 'Use OIDC Output Variables'

Variables are set using tl.setVariable('oidc_user', value, true) within the task logic.


📦 Other Notable Changes

  • Added fetchAzureOidcToken() and exchangeOidcTokenAndSetStepVariables() utility methods
  • Token parsing includes fallback logic (regex) in case CLI output isn’t valid JSON
  • Bumped CLI default version to 2.75.0 to ensure compatibility with jf eot
  • New service connection types and input descriptors added to vss-extension.json
  • Added visual diagrams to README.md to aid with OIDC setup

🙌 Special Thanks

We’d like to recognize and thank the authors of the following PRs for paving the way with early implementations and valuable context:

#495 — Introduced the concept of OIDC integration in the extension

#520 — Added groundwork for platform URL-based token exchange

We delayed merging earlier solutions because we wanted to align this integration natively with the new --oidc-token-id mechanism introduced in the JFrog CLI.
That said, the contributions in both PRs were incredibly helpful in shaping this final implementation — thank you!

@EyalDelarea EyalDelarea added the new feature Automatically generated release notes label Apr 14, 2025
@EyalDelarea EyalDelarea changed the title Add OIDC Add OIDC Service Connection Authentication method Apr 14, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Apr 14, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Apr 14, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Apr 17, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Apr 17, 2025
@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label Apr 23, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label Apr 23, 2025
@EyalDelarea EyalDelarea requested a review from bhanurp April 24, 2025 10:45
@EyalDelarea EyalDelarea marked this pull request as ready for review April 24, 2025 10:45
const cliPackage = 'jfrog-cli-' + getArchitecture();
const jfrogFolderPath = encodePath(join(tl.getVariable('Agent.ToolsDirectory') || '', '_jf'));
const defaultJfrogCliVersion = '2.73.3';
const defaultJfrogCliVersion = '2.75.0';
Copy link
Contributor

Choose a reason for hiding this comment

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

there is an issue with latest version of jfrog-cli in azure devops plugin better to revert to old version until the issue is resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is mandatory for the OIDC token exchange.
Maybe we can merge this and not release yet.

"lint": "npx eslint . --ext .ts,.tsx,.js"
},
"dependencies": {
"semver": "^7.7.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

are we adding new dependencies ? Can't solution achieved without using this.
I know limit is 50MB checking if there is a possibility to avoid.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even with it the size should be under 50MB, i think we are currently at around 31.
We could write a check for version manually without using semver, but if we have some room i think it's better.

Copy link

@MikaLJF MikaLJF left a comment

Choose a reason for hiding this comment

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

Looks great! I added some rephrasing suggestions

@EyalDelarea EyalDelarea added the safe to test Approve running integration tests on a pull request label May 4, 2025
@github-actions github-actions bot removed the safe to test Approve running integration tests on a pull request label May 4, 2025
@EyalDelarea EyalDelarea merged commit e52aeb4 into jfrog:dev May 4, 2025
3 of 6 checks passed
@cplee
Copy link

cplee commented May 12, 2025

Awesome! When can we expect to see this published in the marketplace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants