@Bean @ConditionalOnMissingBean(TokenStore.class) public TokenStore jwkTokenStore() { return new JwkTokenStore(this.resource.getJwk().getKeySetUri()); } }
@Bean @ConditionalOnMissingBean(TokenStore.class) public TokenStore jwkTokenStore() { return new JwkTokenStore(this.resource.getJwk().getKeySetUri()); }
@Test public void validateWhenJwkKeySetUriProvidedShouldSucceed() throws Exception { this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys"); setListableBeanFactory(); this.properties.validate(); verifyZeroInteractions(this.errors); }
@Test public void validateWhenKeysUriOrValuePresentAndUserInfoAbsentShouldNotFail() throws Exception { this.properties = new ResourceServerProperties("client", ""); this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys"); setListableBeanFactory(); this.properties.validate(); verifyZeroInteractions(this.errors); }
@Test public void validateWhenBothJwtKeyValueAndJwkKeyUriPresentShouldFail() throws Exception { this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys"); this.properties.getJwt().setKeyValue("my-key"); setListableBeanFactory(); this.thrown.expect(IllegalStateException.class); this.thrown.expect(getMatcher("Only one of jwt.keyUri (or jwt.keyValue) " + "and jwk.keySetUri should be configured.", null)); this.properties.validate(); }
@Test public void validateWhenBothJwtAndJwkKeyUrisPresentShouldFail() throws Exception { this.properties.getJwk().setKeySetUri("http://my-auth-server/token_keys"); this.properties.getJwt().setKeyUri("http://my-auth-server/token_key"); setListableBeanFactory(); this.thrown.expect(IllegalStateException.class); this.thrown.expect(getMatcher("Only one of jwt.keyUri (or jwt.keyValue) " + "and jwk.keySetUri should be configured.", null)); this.properties.validate(); }