Merge branch '1.5.x'
This commit is contained in:
commit
517b30acbb
|
|
@ -207,6 +207,9 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate(ResourceServerProperties target, Errors errors) {
|
private void validate(ResourceServerProperties target, Errors errors) {
|
||||||
|
if (!StringUtils.hasText(this.clientId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean jwtConfigPresent = StringUtils.hasText(this.jwt.getKeyUri())
|
boolean jwtConfigPresent = StringUtils.hasText(this.jwt.getKeyUri())
|
||||||
|| StringUtils.hasText(this.jwt.getKeyValue());
|
|| StringUtils.hasText(this.jwt.getKeyValue());
|
||||||
boolean jwkConfigPresent = StringUtils.hasText(this.jwk.getKeySetUri());
|
boolean jwkConfigPresent = StringUtils.hasText(this.jwk.getKeySetUri());
|
||||||
|
|
@ -228,8 +231,7 @@ public class ResourceServerProperties implements Validator, BeanFactoryAware {
|
||||||
+ "JWT verifier key");
|
+ "JWT verifier key");
|
||||||
}
|
}
|
||||||
if (StringUtils.hasText(target.getTokenInfoUri()) && isPreferTokenInfo()) {
|
if (StringUtils.hasText(target.getTokenInfoUri()) && isPreferTokenInfo()) {
|
||||||
if (StringUtils.hasText(this.clientId)
|
if (!StringUtils.hasText(this.clientSecret)) {
|
||||||
&& !StringUtils.hasText(this.clientSecret)) {
|
|
||||||
errors.rejectValue("clientSecret", "missing.clientSecret",
|
errors.rejectValue("clientSecret", "missing.clientSecret",
|
||||||
"Missing client secret");
|
"Missing client secret");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,14 @@ public class ResourceServerPropertiesTests {
|
||||||
assertThat(jwt.get("keyUri")).isNotNull();
|
assertThat(jwt.get("keyUri")).isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void validateWhenClientIdNullShouldNotFail() throws Exception {
|
||||||
|
this.properties = new ResourceServerProperties(null, "secret");
|
||||||
|
setListableBeanFactory();
|
||||||
|
this.properties.validate(this.properties, this.errors);
|
||||||
|
verifyZeroInteractions(this.errors);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void validateWhenBothJwtAndJwkKeyUrisPresentShouldFail() throws Exception {
|
public void validateWhenBothJwtAndJwkKeyUrisPresentShouldFail() throws Exception {
|
||||||
this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys");
|
this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue