spring-projects / spring-projects/spring-boot
Record HTTP client metrics when spring-security requests OAuth2 resources from an authorization server
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
When including the spring-boot-starter-oauth2-resource-server, it would be nice if external requests made by Spring Security were included in the default Micrometer http client metrics. Including these would give visibility and better insight into the performance of the authorization servers.
In many cases it might not be too hard to add. For example, the default JwtDecoder in the OAuth2ResourceServerJwtConfiguration is built by NimbusJwtDecoder which uses it's own RestTemplate instance behind the scenes. It looks like the JwkSetUriJwtDecoderBuilder we use for this already has an option to provide a custom RestOperations. We could use this to set the default RestTemplateBuilder instance to get those metrics with minimal effort.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/resource/servlet/OAuth2ResourceServerJwtConfiguration.java and inspect the JwkSetUriJwtDecoderBuilder restOperations option. Trace how the default RestTemplateBuilder could be used for the NimbusJwtDecoder; done means external OAuth2 authorization-server requests are included in the default Micrometer HTTP client metrics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- observability, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100