Skip to content

Add timeouts for JWT decoder in AadResourceServerConfiguration#49312

Open
berry120 wants to merge 2 commits into
Azure:mainfrom
berry120:patch-1
Open

Add timeouts for JWT decoder in AadResourceServerConfiguration#49312
berry120 wants to merge 2 commits into
Azure:mainfrom
berry120:patch-1

Conversation

@berry120
Copy link
Copy Markdown

@berry120 berry120 commented May 29, 2026

Set default read & connect timeouts on NimbusJwtDecoder.

Description

This spring security issue highlighted the potential for 15 minute (or longer) hangs due to the absence of explicit connect & read timeouts on the NimbusJwtDecoder. This is fixed in Spring Security, however the Azure SDK explicitly overrides restOperations in the NimbusJwtDecoder it creates, meaning we need the fix explicitly here, too.

As a current workaround, the following can be defined as a bean on a configuration class:

    @Bean
    RestTemplateBuilder restTemplateBuilder(RestTemplateBuilderConfigurer configurer) {
        return configurer.configure(new RestTemplateBuilder())
            .connectTimeout(Duration.ofMillis(JWKSourceBuilder.DEFAULT_HTTP_CONNECT_TIMEOUT))
            .readTimeout(Duration.ofMillis(JWKSourceBuilder.DEFAULT_HTTP_READ_TIMEOUT));
    }

However, this isn't ideal as it applies globally, and has to be specified in each project.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Set connection and read timeouts for JWT decoder.
Copilot AI review requested due to automatic review settings May 29, 2026 14:54
@berry120 berry120 requested review from a team, Netyyyy, moarychan, rujche and saragluna as code owners May 29, 2026 14:54
@github-actions github-actions Bot added azure-spring All azure-spring related issues Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thank you for your contribution @berry120! We will review the pull request and get back to you soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-spring All azure-spring related issues Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant