How to set custom realm for the embedded tomcat? i am using SpringBoot however dont see a way to add custom realm via Embeddedservletcontainercustomizer.
Looks like you should define this bean:
@Bean
public TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory() {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
factory.addContextCustomizers(new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
context.setRealm(new CombinedRealm());
}
});
return factory;
}
And provide the desired Realm
implementation.