spring-projects / spring-projects/spring-boot

Record HTTP client metrics when spring-security requests OAuth2 resources from an authorization server

Open
#31,981 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

theme: observability type: enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.