Browse Source

Provide Casting for ReactiveJwtDecoder

Closes gh-15773
pull/15823/head
Tran Ngoc Nhan 1 year ago committed by Josh Cummings
parent
commit
2c9c309d7f
  1. 12
      oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/ReactiveJwtDecoders.java

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -49,11 +49,12 @@ public final class ReactiveJwtDecoders {
* @return a {@link ReactiveJwtDecoder} that was initialized by the OpenID Provider * @return a {@link ReactiveJwtDecoder} that was initialized by the OpenID Provider
* Configuration. * Configuration.
*/ */
public static ReactiveJwtDecoder fromOidcIssuerLocation(String oidcIssuerLocation) { @SuppressWarnings("unchecked")
public static <T extends ReactiveJwtDecoder> T fromOidcIssuerLocation(String oidcIssuerLocation) {
Assert.hasText(oidcIssuerLocation, "oidcIssuerLocation cannot be empty"); Assert.hasText(oidcIssuerLocation, "oidcIssuerLocation cannot be empty");
Map<String, Object> configuration = JwtDecoderProviderConfigurationUtils Map<String, Object> configuration = JwtDecoderProviderConfigurationUtils
.getConfigurationForOidcIssuerLocation(oidcIssuerLocation); .getConfigurationForOidcIssuerLocation(oidcIssuerLocation);
return withProviderConfiguration(configuration, oidcIssuerLocation); return (T) withProviderConfiguration(configuration, oidcIssuerLocation);
} }
/** /**
@ -85,11 +86,12 @@ public final class ReactiveJwtDecoders {
* @return a {@link ReactiveJwtDecoder} that was initialized by one of the described * @return a {@link ReactiveJwtDecoder} that was initialized by one of the described
* endpoints * endpoints
*/ */
public static ReactiveJwtDecoder fromIssuerLocation(String issuer) { @SuppressWarnings("unchecked")
public static <T extends ReactiveJwtDecoder> T fromIssuerLocation(String issuer) {
Assert.hasText(issuer, "issuer cannot be empty"); Assert.hasText(issuer, "issuer cannot be empty");
Map<String, Object> configuration = JwtDecoderProviderConfigurationUtils Map<String, Object> configuration = JwtDecoderProviderConfigurationUtils
.getConfigurationForIssuerLocation(issuer); .getConfigurationForIssuerLocation(issuer);
return withProviderConfiguration(configuration, issuer); return (T) withProviderConfiguration(configuration, issuer);
} }
/** /**

Loading…
Cancel
Save