Skip to content

florinn/dropwizard-spring-security-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dropwizard + Spring Security Sample

This sample demonstrates how to use Spring Security for authenticating requests to REST services implemented with Dropwizard.

The sample uses Spring Framework for dependency injection and it shows both XML and Java based Spring configuration.


Highlights

  • Spring Security for authentication
  • Spring Framework for dependency injection
  • Shows how to get hold of the authenticated user through a Principal object, enabling to run any subsequent authorization logic
  • Demonstrates how to take advantage of Dropwizard built-in capability of caching succesfully authenticated credentials
  • Makes self evident how to create other variations of authenticators enabling to run path specific authentication logic
  • Packaging as a fat jar file, making the app wholly self containted

Note: The sample is configured to use Basic Authentication, other authentication schemes supported by Spring Security may be specified in spring-context.xml

Build and Run the Application

To package the application run:

mvn package

To run the application:

java -jar target/dropwizard-spring-security-sample-0.0.1-SNAPSHOT.jar server myapp.yml

To make a successfully authenticated request use a tool like httpie:

http -a [email protected]:supersecret GET http://localhost:8080/hello

and the server should politely greet you back.

About

Dropwizard with Spring Security sample

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages