Skip to content

nate9/keycloak-dropwizard-integration

 
 

Repository files navigation

Integration of Keycloak and Dropwizard

About

Summary

This project shows how JBoss Keycloak and Dropwizard can be used together.

To read this tutorial fully rendered, please visit: https://ahus1.github.io/keycloak-dropwizard-integration/tutorial.html.

JBoss Keycloak provides a standalone OAuth 2.0 and Open ID Connect server. It handles user credentials for you application, so you can focus on business requirements.

Dropwizard is a Java framework for developing ops-friendly, high-performance, RESTful web services.

TL;DR: The module keycloak-dropwizard-jaxrs-example shows how to use Dropwizard’s @Auth annotation with Keycloak using a full OAuth flow.

At the time I write this there is no open source integration of the two, so I set up this project. See https://github.com/ahus1/keycloak-dropwizard-integration for the latest version.

How to use

The module keycloak-dropwizard-jaxrs is evolving into a ready-to-use Dropwizard module. The first releases are now available (both from jcenter and Maven central):

download

Version 0.3.x is tested with Keycloak 1.6 and Dropwizard 0.9

pom.xml
<dependencies>
  <dependency>
    <groupId>de.ahus1.keycloak.dropwizard</groupId>
    <artifactId>keycloak-dropwizard</artifactId>
    <version>0.x.x</version>
  </dependency>
</dependencies>

Prerequisites

These examples need a local JBoss Keycloak instance with Realm test and user demo with password demo.

Please download the Keycloak distribution version 1.5.0 from http://keycloak.org and extract it to a subfolder keycloak-server of this directory. Then call keycloak-server.bat to import an already configured realm. Using this startup file the configuration will be reset every time you start Keycloak.

Parts

This example will guide you through setting up JBoss Keycloak in several configurations:

For completeness and an even simple setup a standard Servlet configuration is also included (without and with Keycloak):

License

Copyright 2015 Alexander Schwartz

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

This project shows how JBoss Keycloak and Dropwizard can be used together.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 88.5%
  • JavaScript 3.9%
  • FreeMarker 2.9%
  • HTML 2.4%
  • Shell 1.2%
  • Batchfile 0.8%
  • Ruby 0.3%