Skip to content

Commit

Permalink
Polish "Configure Issuer Validator for Resource Server"
Browse files Browse the repository at this point in the history
  • Loading branch information
mbhave committed Aug 24, 2019
1 parent b3d189c commit 28d374d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
*
* @author Madhura Bhave
* @author Artsiom Yudovin
* @author HaiTao Zhang
*/
@Configuration
class ReactiveOAuth2ResourceServerJwkConfiguration {
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*
* @author Madhura Bhave
* @author Artsiom Yudovin
* @author HaiTao Zhang
*/
@Configuration
class OAuth2ResourceServerJwtConfiguration {
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
*
* @author Madhura Bhave
* @author Artsiom Yudovin
* @author HaiTao Zhang
*/
public class ReactiveOAuth2ResourceServerAutoConfigurationTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
*
* @author Madhura Bhave
* @author Artsiom Yudovin
* @author HaiTao Zhang
*/
public class OAuth2ResourceServerAutoConfigurationTests {

Expand Down

0 comments on commit 28d374d

Please sign in to comment.