Open robmoffat opened 5 years ago
OK, I think I see how this works now - you have the setComponent method in the factory.
Why doesn't it just use Spring IoC?
I'll just give two more examples of the same thing and then I'll shut up.
JacksonParser
:In here, you configure a static ObjectMapper
which you can use. However, in every case you could have used:
@Autowire
ObjectMapper om
Within your code.
In order for these annotations to work, your filter would need to be instantiated by Spring. See here for an example of how to do this: https://www.baeldung.com/spring-boot-add-filter
PropertiesReader
Much like Jackson, you don't have to worry about doing this yourself. Spring Boot has a standard, extensible and well-thought-through process for configuring an application as it starts. See here: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
Given that this exists, your EnvKeystoreProvider
could use it. Consider making this an @Configuration
class and then providing the keystore through that as a bean. The three properties you need (type, location, password) can all be pulled into the class using Spring's @Value annotation.
I sorely want to help you refactor this, but I need to get time/approval.
This project definitely needs to exist! This stuff is waaay to complex to not have a library for.
This is more a question than an issue, possibly.
Looking at
AuthenticationFilter
, I see that it requires aPodCertificateClientFactory
, however this is not injected using Spring's IoC mechanism but hard-coded.How am I supposed to configure how the pod certificates are instantiated?
Also it seems to do the same trick with
providerFactory
, however the providerFactory is never used. :(thanks, Rob