question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Make sure all RestTemplate are managed by AadRestTemplateCreator

See original GitHub issue

Context

To support connect Azure AD via proxy, AadRestTemplateCreator is used to create all RestTempalte that used to send http request to Azure AD endpoint or Graph endpoint. But some RestTemplate are not created by AadRestTemplateCreator. For example: #31233

Goal

Find all RestTemplate used to send http request to Azure AD endpoint or Graph endpoint, make sure they are all created by AadRestTemplateCreator.

Solution

(Just potential solution. update is possible when this task started and find something new)

  • Fix #31233 : 1 day
  • ~Search all new RestTemplate in spring-security-oauth2 related package. Make sure all related RestTemplate are all created by AadRestTemplateCreator. 1 day~ Debug sample app (aad-web-application), add break point at RestTemplate’s constructor. Make sure all RestTemplate instance is (1) created by AadRestTemplateCreator or (2) will be replaced by AadRestTemplateCreator created instance.
  • Setup a proxy and test this feature. Fix potential problems. 2 day

Toal man-day = 1 + 1 + 2 = 4

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
chenrujuncommented, Oct 21, 2022

Confirmed that after #31597, proxy setting will take effect for all http requests sent by RestTemplate.

Here is the list of http request urls:

Azure AD web application

Azure AD resource-server

Azure AD B2C web application

  • https://{directory-name}.b2clogin.com/{directory-name}.onmicrosoft.com/oauth2/v2.0/token?p={flow-name}
  • https://{directory-name}.b2clogin.com/{directory-name}.onmicrosoft.com/discovery/v2.0/keys?p={flow-name}

Azure AD B2C resource-server

Closing this issue.

1reaction
chenrujuncommented, Oct 18, 2022

Record of this step:

  • Debug sample app (aad-web-application), add break point at RestTemplate’s constructor. Make sure all RestTemplate instance is (1) created by AadRestTemplateCreator or (2) will be replaced by AadRestTemplateCreator created instance.

Here are some examples:

  1. RestTemplate createc by AadRestTemplateCreator

    image

  2. RestTemplate not createc by AadRestTemplateCreator, but will be replaced by AadRestTemplateCreator created instance.

    image

    image

    image

    image

    image

  3. DefaultOAuth2UserService’s RestTemplate is not created by AadRestTemplateCreator. But it will not be executed. Need more investigation about this. Issue created: https://github.com/Azure/azure-sdk-for-java/issues/31546

    image

    image

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] OAuth2 config-> JwtDecoder / NimbusJwtDecoder still ...
[BUG] OAuth2 config-> JwtDecoder / NimbusJwtDecoder still uses RestTemplate() instead ... [BUG] Make sure all RestTemplate are managed by ...
Read more >
Spring RestTemplate - how to enable full debugging/logging ...
Now all RestTemplate HTTP traffic will be logged to ... Make sure spring doesn't ignore your logging config ... Install and run Fiddler....
Read more >
Spring RestTemplate Error Handling - Baeldung
Learn how to handle errors with Spring's RestTemplate. ... if we could implement a reusable error handler for all of our remote calls....
Read more >
Complete Guide to Spring RestTemplate - Reflectoring
The REST web service contains the methods to create, read, update, and delete product resources and supports the HTTP verbs GET, POST, PUT,...
Read more >
Spring RestTemplate Example - DigitalOcean
Final step is to create the client classes that will use RestTemplate bean defined above. package com.journaldev.spring.config; import java.util ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found