Template project demonstrating Dropwizard with OpenID authentication against a few providers (Google, Yahoo etc) and User/Authority annotation support.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


OpenId Demo

This project demonstrates the following

  • Dropwizard - Serves HTML
  • OpenId - Provides integration with OpenId providers (Google, Facebook etc) see this blog post
  • Authorization - Security annotation supporting different levels of access
  • Session token cookie - Demonstrates stateless operation (but uses an in-memory cache so not horizontally scalable)
  • Markdown - see this blog post

Bug fixes


  • Fixed major bug with DiscoveryInformation getting lost between requests.
  • Added some Markdown demo code.
  • Designed for Dropwizard 0.6.2.


  • Initial release.
  • Designed for Dropwizard 0.6.1.

Getting started

From an IDE, just run the OpenIDDemoService.main() with a runtime configuration that passes application parameters of server openid-demo.yml.

From the console, just build with Maven and run it up:

mvn clean install
java -jar target/dropwizard-openid-1.1.0.jar server openid-demo.yml

Proxy settings

If you are behind a firewall you will need to set the proxy. This is configured in PublicOpenIDResource.


Here is an example of the authorization annotation as used in PrivateInfoResource.

 * @return The private home view if authenticated
@CacheControl(noCache = true)
public PublicFreemarkerView viewHome(
User publicUser) {

  BaseModel model = newBaseModel();
  return new PublicFreemarkerView<BaseModel>("private/home.ftl", model);


Adding yourself as an "admin"

The code supports different levels of authority (PUBLIC and ADMIN). To add yourself as an admin, simply edit the following code in PublicOpenIDResource to be the email address you use in your selected OpenID provider:

// Promote to admin if they have a specific email address
// (not a good way, but this is only a demo)
if ("nobody@example.org".equals(user.getEmailAddress())) {
  log.info("Granted admin rights");

Where does the ASCII art come from?

The ASCII art for the startup banner was created using the online tool available at Webestools with a font of Tiza