Stephen Doxsee
by Stephen Doxsee

Tags

The JHipster UAA (User Account and Authentication) server option shouldn’t be confused with cloudfoundry’s UAA – although they do similar things.

JHipster allows you to generate a UAA app that contains the user database and is responsible for authenticating users and granting oauth2 JWT access tokens using a spring-security authorization server.

Since JHipster currently uses the gateway for the login screen, there can be no SSO between different gateway apps. However, it makes for a familiar JHipster experience with UAA acting only as the backend for user-management and authentication. UAA does expose its public key at http://localhost:9999/oauth/token but otherwise acts invisibly.

Setup

Folder structure:

jhipster-uaa
|- gateway
|- jhipster-registry
|- resource
|- uaa

hint: you should handle each project in a separate tab

jhipster-registry

Inside a new jhipster-uaa folder, I clone the jhipster-registry and start it up.

git clone https://github.com/jhipster/jhipster-registry
cd jhipster-registry
./mvnw

uaa

Beside the new jhipster-registry folder created by the clone, I create the uaa project

mkdir uaa
cd uaa
yo jhipster

…choosing the UAA option and selecting defaults otherwise.

and start it up (important: after the jhipster-registry is up)

./mvnw

resource

Next, I create the resource project inside the jhipster-uaa folder:

mkdir resource
cd resource
yo jhipster

…choosing the UAA option and selecting defaults otherwise.

Next, I create the “foo” entity

yo jhipster:entity foo

…only selecting one “name” field of type String.

Then, start up the resource project (important: after UAA is registered with jhipster-registry)

./mvnw

gateway

Next, I create the gateway project inside the jhipster-uaa folder

mkdir gateway
cd gateway
yo jhipster

…choosing the UAA option and selecting defaults otherwise.

Just like the resource project, I create the “foo” entity

yo jhipster:entity foo

…regenerating based on the one in resource.

Then, start up the gateway project (important: after UAA is registered with jhipster-registry)

./mvnw

Try it out!

Wait until everything is up and then you should be good to go!

Explore the github source and screencast