Polish "Configure Issuer Validator for Resource Server"
See gh-17952
This commit is contained in:
@@ -32,6 +32,7 @@ import org.springframework.security.oauth2.jwt.ReactiveJwtDecoders;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @author Artsiom Yudovin
|
||||
* @author HaiTao Zhang
|
||||
*/
|
||||
@Configuration
|
||||
class ReactiveOAuth2ResourceServerJwkConfiguration {
|
||||
@@ -48,9 +49,9 @@ class ReactiveOAuth2ResourceServerJwkConfiguration {
|
||||
public ReactiveJwtDecoder jwtDecoder() {
|
||||
NimbusReactiveJwtDecoder nimbusReactiveJwtDecoder = new NimbusReactiveJwtDecoder(
|
||||
this.properties.getJwt().getJwkSetUri());
|
||||
if (this.properties.getJwt().getIssuerUri() != null) {
|
||||
nimbusReactiveJwtDecoder
|
||||
.setJwtValidator(JwtValidators.createDefaultWithIssuer(this.properties.getJwt().getIssuerUri()));
|
||||
String issuerUri = this.properties.getJwt().getIssuerUri();
|
||||
if (issuerUri != null) {
|
||||
nimbusReactiveJwtDecoder.setJwtValidator(JwtValidators.createDefaultWithIssuer(issuerUri));
|
||||
}
|
||||
return nimbusReactiveJwtDecoder;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.security.oauth2.jwt.NimbusJwtDecoderJwkSupport;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @author Artsiom Yudovin
|
||||
* @author HaiTao Zhang
|
||||
*/
|
||||
@Configuration
|
||||
class OAuth2ResourceServerJwtConfiguration {
|
||||
@@ -49,9 +50,9 @@ class OAuth2ResourceServerJwtConfiguration {
|
||||
public JwtDecoder jwtDecoderByJwkKeySetUri() {
|
||||
NimbusJwtDecoderJwkSupport nimbusJwtDecoder = new NimbusJwtDecoderJwkSupport(
|
||||
this.properties.getJwt().getJwkSetUri());
|
||||
if (this.properties.getJwt().getIssuerUri() != null) {
|
||||
nimbusJwtDecoder
|
||||
.setJwtValidator(JwtValidators.createDefaultWithIssuer(this.properties.getJwt().getIssuerUri()));
|
||||
String issuerUri = this.properties.getJwt().getIssuerUri();
|
||||
if (issuerUri != null) {
|
||||
nimbusJwtDecoder.setJwtValidator(JwtValidators.createDefaultWithIssuer(issuerUri));
|
||||
}
|
||||
return nimbusJwtDecoder;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ import static org.mockito.Mockito.mock;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @author Artsiom Yudovin
|
||||
* @author HaiTao Zhang
|
||||
*/
|
||||
public class ReactiveOAuth2ResourceServerAutoConfigurationTests {
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ import static org.mockito.Mockito.mock;
|
||||
*
|
||||
* @author Madhura Bhave
|
||||
* @author Artsiom Yudovin
|
||||
* @author HaiTao Zhang
|
||||
*/
|
||||
public class OAuth2ResourceServerAutoConfigurationTests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user