This project shows how JBoss Keycloak and Dropwizard can be used together.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea added checkstyle to ensure coding guidelines Jul 21, 2018
conf adding forbidden API testing to prevent for example locale and timezo… Jul 22, 2018
domain added checkstyle to ensure coding guidelines Jul 21, 2018
keycloak-dropwizard-bearer adding error prone testing Jul 21, 2018
keycloak-dropwizard-bearermodule adding forbidden API testing to prevent for example locale and timezo… Jul 22, 2018
keycloak-dropwizard-jaxrs-example working on suggestions by codacy Jul 21, 2018
keycloak-dropwizard-jetty working on suggestions by codacy Jul 21, 2018
keycloak-dropwizard adding forbidden API testing to prevent for example locale and timezo… Jul 22, 2018
keycloak-server-docker adding maintainer, replacing ADD with COPY Jul 22, 2018
keycloak-war added checkstyle to ensure coding guidelines Jul 21, 2018
selenium added selenium driver to project to be run for manual tests Dec 11, 2015
simple-war added checkstyle to ensure coding guidelines Jul 21, 2018
tutorial working on suggestions by codacy Jul 21, 2018
.editorconfig added checkstyle to ensure coding guidelines Jul 21, 2018
.gitattributes added checkstyle to ensure coding guidelines Jul 21, 2018
.gitignore added checkstyle to ensure coding guidelines Jul 21, 2018
.travis.yml added checkstyle to ensure coding guidelines Jul 21, 2018
CHANGELOG.md update to final keycloak version Mar 22, 2017
Gemfile added travis for documents, fixing broken links Aug 18, 2015
LICENSE tuning for upload to github Aug 18, 2015
README.adoc re-checked readme's and examples for Dropwizard 1.3 Mar 31, 2018
config-bearer.yml preparing for keycloak 1.9 Feb 19, 2016
config.yml realm public key is no longer necessary with recent versions of keycl… Jul 14, 2018
keycloak-export.bat update to keycloak 1.8 Jan 29, 2016
keycloak-server.bat Adding docker to run keycloak inside travis Dec 12, 2015
keycloak-war.bat tuning for upload to github Aug 18, 2015
pom.xml adding forbidden API testing to prevent for example locale and timezo… Jul 22, 2018
release.bat Getting ready for release #2 Oct 9, 2015
simple-war.bat tuning for upload to github Aug 18, 2015

README.adoc

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 your 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. If you have a i.e. a JavaScript-Client and want to send only JWT Tokens, go directly to keycloak-dropwizard-bearermodule

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 a ready-to-use Dropwizard module. The releases are available both from jcenter and Maven central:

download
  • Version 0.7.x is tested with Keycloak 1.9.x and Dropwizard 0.9.x

  • Version 0.8.x is tested with Keycloak 2.x.x and Dropwizard 0.9.x

  • Version 0.9.x is tested with Keycloak 2.x.x/3.x.x and Dropwizard 1.0.x

  • Version 1.0.x is tested with Keycloak 3.x.x and Dropwizard 1.1.x/1.2.x/1.3.x

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 matching your keycloak-dropwizard-integration version 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 as a very simple getting started a standard Servlet configuration is also included (without and with Keycloak):

License

Copyright 2015-2018 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.