Skip to content

refactor: obo-exchange logics after moving them to library#101

Merged
telegrapher merged 6 commits into
adobe:mainfrom
Eiermitsucuk:main
Mar 31, 2026
Merged

refactor: obo-exchange logics after moving them to library#101
telegrapher merged 6 commits into
adobe:mainfrom
Eiermitsucuk:main

Conversation

@Eiermitsucuk

Copy link
Copy Markdown
Contributor

Description

Moved the On-Behalf-Of token exchange logic out of imscli and into the ims-go library. imscli no longer does the raw HTTP call to IMS for OBO; it uses ims-go’s client instead. The dependency go updated so this project pulls in a version of ims-go that includes that code. The CLI still exposes the same OBO command; only where the logic lives changed.

Related Issue

Motivation and Context

The OBO flow was previously implemented inside imscli with direct HTTP calls to IMS, which duplicated protocol details that really belong in the shared ims-go client. Duplication makes it harder to keep behavior aligned with other Adobe tooling and increases maintenance whenever IMS endpoints or error handling change. The logic has been moved into github.com/adobe/ims-go so there is a single, versioned place for OBO support.

How Has This Been Tested?

Manually: I ran the On-Behalf-Of exchange using this CLI against our IMS environment, verified a successful response, and confirmed the returned access token behaved as expected for the intended use case.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Comment thread cmd/obo_exchange.go Outdated
Aliases: []string{"obo"},
Short: "On-Behalf-Of token exchange.",
Long: `On-Behalf-Of token exchange: exchange a user access token for a new token. Do NOT send OBO access tokens to frontend clients.`,
Long: `On-Behalf-Of token exchange: exchange a user access token for a new token. Do NOT send OBO access tokens to frontend clients.`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should change the long description. Remove the Do NOT send OBO access tokens to frontend clients..

It is not the concern of our CLI to be teaching security best practices.

Modify the message to reference rfc8693 since the obo name is more of an Adobe convention

@telegrapher

Copy link
Copy Markdown
Collaborator

Good PR, please update that message, and I'll merge the PR

Comment thread ims/obo_exchange.go
switch {
case i.URL == "":
return fmt.Errorf("missing IMS base URL parameter")
case i.ClientID == "":

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please, keep the client ID & client secret validations here for consistency.

After thinking carefully, I don't think the scopes are mandatory though. It may not make any sense but the CLI should support it.

Comment thread cmd/obo_exchange.go Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is an old one, I updated imscli to wrap errors with %w all over the place, would you do this here too? :)

Comment thread cmd/obo_exchange.go Outdated
@telegrapher
telegrapher merged commit f0c4411 into adobe:main Mar 31, 2026
9 checks passed
Eiermitsucuk added a commit to Eiermitsucuk/imscli that referenced this pull request Mar 31, 2026
refactor: obo-exchange logics after moving them to library (adobe#101)
Eiermitsucuk added a commit to Eiermitsucuk/imscli that referenced this pull request Mar 31, 2026
refactor: obo-exchange logics after moving them to library (adobe#101)
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