Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix token exchange #4915

Merged
merged 1 commit into from
Aug 14, 2024
Merged

fix: fix token exchange #4915

merged 1 commit into from
Aug 14, 2024

Conversation

marikaner
Copy link
Contributor

The token exchange was looking at the token's audiences before and basically did a token verification for XSUAA in the case of IAS tokens. This is incorrect, the token should be merely exchanged.

@@ -129,8 +129,8 @@ export async function getAllDestinationsFromDestinationService(
logger.debug(
'Attempting to retrieve all destinations from destination service.'
);
if (shouldExchangeToken(options)) {
options.jwt = await exchangeToken(options);
if (shouldExchangeToken(options) && options.jwt) {
Copy link
Member

Choose a reason for hiding this comment

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

I assume you only added this so the IDE doesn't complain?
Because shouldExchangeToken only returns true if options.jwt is set.

Copy link
Member

@tomfrenken tomfrenken Aug 14, 2024

Choose a reason for hiding this comment

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

Alternatively, you could use options.jwt! in the exchangeToken function call but I do not really have a [pp] here.

  if (shouldExchangeToken(options)) {
    options.jwt = await exchangeToken(options.jwt!);
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exactly. Using ! is worse in my opinion.

Copy link
Member

@tomfrenken tomfrenken left a comment

Choose a reason for hiding this comment

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

Just one comment, other than that LGTM

@marikaner marikaner merged commit c1bf319 into main Aug 14, 2024
21 checks passed
@marikaner marikaner deleted the fix-token-exchange branch August 14, 2024 08:40
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