@Test public void validateWhenUserInfoUriConfiguredShouldNotFail() throws Exception { this.properties.setUserInfoUri("http://my-auth-server/userinfo"); setListableBeanFactory(); this.properties.validate(); verifyZeroInteractions(this.errors); }
@Test public void validateWhenTokenUriAbsentAndClientSecretAbsentShouldNotFail() throws Exception { this.properties = new ResourceServerProperties("client", ""); this.properties.setUserInfoUri("http://my-auth-server/userinfo"); setListableBeanFactory(); this.properties.validate(); verifyZeroInteractions(this.errors); }
@Test public void validateWhenTokenUriNotPreferredAndClientSecretAbsentShouldNotFail() throws Exception { this.properties = new ResourceServerProperties("client", ""); this.properties.setPreferTokenInfo(false); this.properties.setTokenInfoUri("http://my-auth-server/check_token"); this.properties.setUserInfoUri("http://my-auth-server/userinfo"); setListableBeanFactory(); this.properties.validate(); verifyZeroInteractions(this.errors); }
@Test public void validateWhenTokenUriPreferredAndClientSecretAbsentShouldFail() throws Exception { this.properties = new ResourceServerProperties("client", ""); this.properties.setTokenInfoUri("http://my-auth-server/check_token"); this.properties.setUserInfoUri("http://my-auth-server/userinfo"); setListableBeanFactory(); this.thrown.expect(IllegalStateException.class); this.thrown.expect(getMatcher("Missing client secret", "clientSecret")); this.properties.validate(); }