Skip to content

Consider Making JwtDecoders return type generic #8412

@jzheaux

Description

@jzheaux

Related to #6010

Expected Behavior

Change the methods in JwtDecoders from returning JwtDecoder to returning <J extends JwtDecoder>:

public static <J extends JwtDecoder> J fromOidcIssuerLocation(...)

Then, a downcast isn't necessary:

NimbusJwtDecoder jwtDecoder = JwtDecoders.fromOidcIssuerLocation(...);

Current Behavior

To further configure a JwtDecoder returned by JwtDecoders, it's necessary to perform a downcast:

NimbusJwtDecoder jwtDecoder = (NimbusJwtDecoder) JwtDecoders.fromOidcIssuerLocation(...);
jwtDecoder.setJwtValidator(...);

Context

I'm not certain if this is passive from this chart. There are two points that seem relevant in the "Evolving API classes - API methods and constructors" section:

Change result type (including void) .... Breaks compatibility
Add type parameter if method has no type parameters .... Binary compatible

Testing against the latest release of Spring Boot could help to confirm one way or the other.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions