Skip to content

Commit 2c9c309

Browse files
ngocnhan-tran1996jzheaux
authored andcommitted
Provide Casting for ReactiveJwtDecoder
Closes gh-15773
1 parent a88a774 commit 2c9c309

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/ReactiveJwtDecoders.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,11 +49,12 @@ private ReactiveJwtDecoders() {
4949
* @return a {@link ReactiveJwtDecoder} that was initialized by the OpenID Provider
5050
* Configuration.
5151
*/
52-
public static ReactiveJwtDecoder fromOidcIssuerLocation(String oidcIssuerLocation) {
52+
@SuppressWarnings("unchecked")
53+
public static <T extends ReactiveJwtDecoder> T fromOidcIssuerLocation(String oidcIssuerLocation) {
5354
Assert.hasText(oidcIssuerLocation, "oidcIssuerLocation cannot be empty");
5455
Map<String, Object> configuration = JwtDecoderProviderConfigurationUtils
5556
.getConfigurationForOidcIssuerLocation(oidcIssuerLocation);
56-
return withProviderConfiguration(configuration, oidcIssuerLocation);
57+
return (T) withProviderConfiguration(configuration, oidcIssuerLocation);
5758
}
5859

5960
/**
@@ -85,11 +86,12 @@ public static ReactiveJwtDecoder fromOidcIssuerLocation(String oidcIssuerLocatio
8586
* @return a {@link ReactiveJwtDecoder} that was initialized by one of the described
8687
* endpoints
8788
*/
88-
public static ReactiveJwtDecoder fromIssuerLocation(String issuer) {
89+
@SuppressWarnings("unchecked")
90+
public static <T extends ReactiveJwtDecoder> T fromIssuerLocation(String issuer) {
8991
Assert.hasText(issuer, "issuer cannot be empty");
9092
Map<String, Object> configuration = JwtDecoderProviderConfigurationUtils
9193
.getConfigurationForIssuerLocation(issuer);
92-
return withProviderConfiguration(configuration, issuer);
94+
return (T) withProviderConfiguration(configuration, issuer);
9395
}
9496

9597
/**

0 commit comments

Comments
 (0)