Microservices for the Masses

Spring Boot · JWT · JHipster

Matt RaibleDeveloper Advocate Okta

James Lewis
Martin Fowler
Adrian Crockfort
Joe Walnes
Conway's Law

Conway’s Law

Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization’s communication structure.

Melvyn Conway 1967

"Do one thing and do it well."

The Future?

You shouldn’t start with a microservices architecture. Instead begin with a monolith, keep it modular, and split it into microservices once the monolith becomes a problem.

Martin Fowler March 2014
Spring Boot
Spring Boot Downloads 2016
Spring Boot

start.spring.io

Spring Initializr
Stormpath
Okta
How We Migrated Our Backend to Spring Boot in 3 Weeks

Microservices are awesome, but they’re not free.

Les Hazlewood Stormpath CTO
Entity Rest Repository
Entity Default Data
Spring Microservices Diagram
Spring Secure Microservices Diagram

Securing Your API

JSON Web Tokens

Typical JWT
Decoded JWT

Create a JWT in Java

String jwt = Jwts.builder()
    .setSubject("users/TzMUocMF4p")
    .setExpiration(new Date(1300819380))
    .claim("name", "Robert Token Man")
    .claim("scope", "self groups/admins")
    .signWith(
      SignatureAlgorithm.HS256,
      "secret".getBytes("UTF-8")
    )
    .compact();

Validating a JWT

String jwt = // get JWT from Authorization header
Jws<Claims> claims = Jwts.parser()
    .setSigningKey("secret".getBytes("UTF-8"))
    .parseClaimsJws(jwt)
String scope = claims.getBody().get("scope")
assertEquals(scope, "self groups/admins");

Better Secret

String b64EncodedSecret =
    "Yn2kjibddFAWtnPJ2AFlL8WXmohJMCvigQggaEypa5E=";

.signWith(SignatureAlgorithm.HS256,
    TextCodec.BASE64.decode(b64EncodedSecret))
Wouldn't it be hip if...?

JHipster by the numbers

How to use JHipster

To install JHipster, you run an npm command:

$ npm install -g generator-jhipster
$ mkdir myapp && cd myapp
$ yo jhipster

What’s Generated?

Security Screens

Admin Screens

Liquibase

Microservices with JHipster

JHipster Microservice Architecture
JHipster Microservices Demo

JHipster on Google Cloud

JHipster

https://youtu.be/dgVQOYEwleA

Never Build Auth Again

Microservices are not free, but you get a deep discount on microservices with JHipster.

Matt Raible 2016

JHipster.next

Do one thing and do it well.

Unix philosophy

This Presentation and Demos

Class Act

https://github.com/mraible/microservices-for-the-masses

Image Credits