I have found Dropwizard to be amazing framework to quickly build REST services and most of my enterprise conserns are taken care by this f/w except one. It does provide mechanism to secure you service but it is not as extensive as Spring Security.
I want to understand how these two can marry and whether gluing them together is right or not. Any suggestions?
Of the available Dropwizard integrations, Spring support is also included.
Spring Boot consumes much more memory. This was true. Spring Boot loaded 7591 classes whereas Dropwizard loaded 6255 classes. Also, heap space consumption of Spring Boot was twice compared to Dropwizard.
Dropwizard is an open source Java framework for developing ops-friendly, high-performance RESTful backends. It was developed by Yammer to power their JVM based backend.
I have been able to successfully integrate Spring Security with Dropwizard in the project I just finished. Spring Security is really just a glorified ServletFilter that you can add to the Dropwizard application.
Jacek Furmankiewicz has a small sample project that integrates Spring with Dropwizard and this is the specific part regarding how to add the Spring Security filter to the DW app.
https://github.com/jacek99/dropwizard-spring-di-security-onejar-example/blob/master/src/main/java/com/github/jacek99/myapp/MyAppService.java
One thing to keep in mind with the example provided is that this is for Dropwizard 0.6.2 and the current recommended release is 0.7.0.
So instead of this (0.6.2):
environment.addFilter(DelegatingFilterProxy.class,"/*").setName("springSecurityFilterChain");
use this:
FilterRegistration.Dynamic filterRegistration = environment.servlets().addFilter("springSecurityFilterChain", DelegatingFilterProxy.class);
filterRegistration.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false, "/*");
-Matt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With