Microservices Authentication & Authorization
  • README
  • Introduction
    • Requirements and Setup
    • Sample Application Architecture
  • Intro Labs
    • Authorization Grant Flows in Action
    • Authorization Code Grant Demo
  • Hands-On Labs
    • Lab 1: Resource Server
    • Lab 2: Testing the Resource Server
    • Lab 3: Call another Microservice
Powered by GitBook
On this page
  • Application Components
  • Tech Stack
  • Server Architecture
  • Server Layers
  • REST API
  • Server Users and roles
  • Provided Server applications
  • Client Architecture
  • Client Layers
  • Client Users and Roles
  • Provided Client application
  1. Introduction

Sample Application Architecture

PreviousRequirements and SetupNextAuthorization Grant Flows in Action

Last updated 2 years ago

For the hands-on workshop labs you will be provided a complete spring mvc web server application together with a corresponding spring mvc thymeleaf web client app.

Table of Contents

Application Components

The server application provides a RESTful service for administering todo items and users.

Use cases of this application are:

  • Administer todo items (List, view and create todo items)

  • Administer users

Tech Stack

The following figure shows a typical Microservice technology stack implemented by various Spring projects.

Server Architecture

The RESTful service for todo items and users is build using the Spring MVC annotation model and Spring HATEOAS.

The server application is already secured by basic authentication and also includes authorization using static roles.

Server Layers

The domain model of the server application is quite simple and just consists of ToDoItem and User models. The packages of the application are organized according to the different application layers:

  • api: Contains the complete RESTful service

  • service: The service classes (quite simple for workshop, usually these contain the business logic)

  • entity: All domain models and repositories

In addition, there more packages with supporting functions:

  • config: All spring configuration classes

  • security: All security relevant classes, e.g. a UserDetailsService implementation

REST API

Server Users and roles

There are two target user roles for this application:

  • USER: Standard user who can list and add todo items

  • ADMIN: An administrator user who can list, add or remove users and can see all todo items of all users

Important: We will use the following users in all subsequent labs from now on:

Username
Email
Password
Role

bwayne

bruce.wayne@example.com

wayne

USER

ckent

clark.kent@example.com

kent

USER

pparker

peter.parker@example.com

parker

ADMIN

These users are configured for basic authentication and also later for authenticating using keycloak.

Provided Server applications

ToDo Server application

Suggest ToDo Server application

This application is used as target server to propagate an access token to when calling from the ToDo item server application.

Client Architecture

The client is just able to perform the login using the spring authorization server and to make a test call to get and display the list of all ToDo items for the currently authenticated user. This way you can test the correct communication between client and server without any other tool like postman.

Client Layers

The domain model of the client application is quite simple and just consists of ToDoItemResource and User models. The packages of the application are organized according to the different application layers:

  • web: Contains the complete spring web mvc layer with all required client side resources

In addition, there is one more package with supporting functions:

  • config: All spring configuration classes

In resources/templates you find all thymeleaf html templates. These templates use the bootstrap framework that resides in resources/static folder.

Client Users and Roles

There are two target user roles for this client-/server application:

  • USER: Standard user who can list and add todo items

  • ADMIN: An administrator user who can list, add or remove users and can see all todo items (of all users)

Username
Email
Password
Role

bwayne

bruce.wayne@example.com

wayne

USER

ckent

clark.kent@example.com

kent

USER

pparker

peter.parker@example.com

parker

ADMIN

Provided Client application

The demo client and server application both are build using the programming language and utilizing the .

The application also contains a complete documentation for the RESTful API that is automatically initialized when starting the provided application. You can find this after starting the server application: .

Alternatively you can also use postman and the provided .

To call the provided REST API you can use curl, postman or httpie. For details on how to call the REST API please consult the which also provides the possibility to execute requests for the API endpoints.

You can find the provided initial server application beneath the as .

You can find the provided Suggest ToDo items server application beneath the as .

You can find the provided initial client application beneath the .

Java
Spring Framework
REST API documentation
postman collection
REST API documentation
lab 1 folder
initial
lab 3 folder
other
test-client folder
Application Component View
Technology Stack
Server Architecture
REST Api
Server Layers
Users and Roles
Provided application
Client Architecture
Client Layers
Users and Roles
Provided application
Workshop Architecture
Workshop Tech Stack