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: [#4544] JwtTokenExtractor.getIdentity:err! FetchError: request to https://login.botframework.com/v1/.well-known/openidconfiguration #4583

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

ceciliaavila
Copy link
Collaborator

Fixes #4544

Description

This PR fixes the error thrown in openIdMetadata when the bot is used behind a proxy server by setting the proxy's URL in the fetch agent.

Specific Changes

  • Updated parameterizedBotFrameworkAuthentication to pass the proxy settings to jwtTokenExtractor.
  • Updated jwtTokenExtractor to pass the proxy settings to openIdMetadata.
  • Updated openIdMetada to set the agent in the fetch, containing the proxy URL.
  • Replaced cross-fetch with node-fetch to pass the agent option.

Testing

We tested this using different tools to simulate HTTP and HTTPS proxies.
These images show the request intercepted by the proxy and the bot working.
image

@coveralls
Copy link

coveralls commented Dec 12, 2023

Pull Request Test Coverage Report for Build 7573729133

  • 9 of 12 (75.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 84.477%

Changes Missing Coverage Covered Lines Changed/Added Lines %
libraries/botframework-connector/src/auth/parameterizedBotFrameworkAuthentication.ts 0 1 0.0%
libraries/botframework-connector/src/auth/openIdMetadata.ts 7 9 77.78%
Totals Coverage Status
Change from base Build 7543331681: -0.03%
Covered Lines: 20411
Relevant Lines: 22877

💛 - Coveralls

@ceciliaavila
Copy link
Collaborator Author

Closing as a better alternative was found and documented in this comment.

@ceciliaavila ceciliaavila deleted the southworks/fix/proxy-issue-authentication branch December 21, 2023 14:36
@ceciliaavila ceciliaavila restored the southworks/fix/proxy-issue-authentication branch January 18, 2024 16:55
@ceciliaavila ceciliaavila reopened this Jan 18, 2024
@ceciliaavila ceciliaavila marked this pull request as ready for review January 18, 2024 17:27
@ceciliaavila ceciliaavila requested a review from a team as a code owner January 18, 2024 17:27
@ceciliaavila
Copy link
Collaborator Author

Reopened in consideration of a new customer's scenario (link).

@tracyboehrer tracyboehrer merged commit 7675c41 into main Jan 18, 2024
23 checks passed
@tracyboehrer tracyboehrer deleted the southworks/fix/proxy-issue-authentication branch January 18, 2024 21:31
tracyboehrer pushed a commit that referenced this pull request Jan 24, 2024
…https://login.botframework.com/v1/.well-known/openidconfiguration (#4583)

* Provide proxy setting to openIdMetadata

* Replace @azure/ms-rest-js with @azure/core-http

* Add missing agent settings in getKeys call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants