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: use RequestExecutor the Bearer AuthenticationManager #126

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

Mohammad-Dwairi
Copy link
Contributor

@Mohammad-Dwairi Mohammad-Dwairi commented Dec 11, 2024

Situation

The current BearerAuthenticationManager expects a Transport in its constructor in order to use it for authentication requests. However, using a raw Transport makes the authentication requests to be executed outside the interceptors defined by the SDK, as these interceptors take place in the higher-level RequestExecutor.

By using the RequestExecutor instead of Transport in the BearerAuthenticationManager, all authentication requests will go through the same interceptors pipeline defined in the passed RequestExecutor.

Task

Modify the BearerAuthenticationManager to accept a RequestExecutor instead of Transport in its constructor, applying any needed changes along with this change.

Action

  1. Updated the RequestExecutor to accept RequestExecutor instead of Transport.
  2. Cleaned up the logging code in the BearerAuthenticationManager, Request/Response logging is now handled by the LoggingInterceptor even on the authentication requests.
  3. Moved the logger instance to the LoggingInterceptor instead of injecting it from outside.

Testing

  1. Manually Verified the results.
  2. All existing tests are passing.

Results

Authentication requests made by the BearerAuthenticationManager are now going through the defined pipeline of interceptors defined by the SDK.

@Mohammad-Dwairi Mohammad-Dwairi requested a review from a team as a code owner December 11, 2024 09:31
@Mohammad-Dwairi Mohammad-Dwairi changed the title chore: use RequestExecutor the Bearer AuthenticationManager fix: use RequestExecutor the Bearer AuthenticationManager Dec 11, 2024
mohnoor94
mohnoor94 previously approved these changes Dec 11, 2024
# Conflicts:
#	code/src/main/kotlin/com/expediagroup/sdk/core/authentication/bearer/BearerAuthenticationManager.kt
@Mohammad-Dwairi Mohammad-Dwairi merged commit c70767a into main Dec 11, 2024
1 check passed
@Mohammad-Dwairi Mohammad-Dwairi deleted the mdwairi/fix-authentication-requests-logging branch December 11, 2024 13:35
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.

3 participants