Skip to content

Inconsistent Builder API in JwtProvider.Builder #11037

@denyshorman

Description

@denyshorman

Environment Details

  • Helidon Version: 4.3.3
  • Helidon SE or Helidon MP: SE
  • JDK version: 25
  • OS: Linux

Problem Description

The JwtProvider.Builder class in the io.helidon.security.providers.jwt package contains several methods for configuring the provider. Most of these methods follow the fluent API pattern, returning the Builder instance to allow for method chaining.

However, the expectedAudience(String) method was found to have a void return type, which is inconsistent with the rest of the builder's API and Helidon's general builder patterns.

Impact

This inconsistency prevents developers from chaining the expectedAudience method with other builder methods. When attempting to chain, it results in a compilation error because void cannot be used to call subsequent methods.

Example of Failing Code

JwtProvider provider = JwtProvider.builder()
    .issuer("my-issuer")
    .expectedAudience("my-audience") // Returns void
    .optional(true) // Compilation error: void cannot be dereferenced
    .build();

Proposed Fix

Update the return type of expectedAudience(String) in JwtProvider.Builder from void to Builder and return this.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions