Use Zuul and Spring Security for a global authentication via the popular JWT token.
The service to issue the JWT
token.
- The client POST
{username,password}
to/login
. - This service will authenticate the username and password via
Spring Security
, generate the token, and issue it to client.
Provide three simple services:
/admin
/user
/guest
The Zuul
gateway:
- Define
Zuul
routes toauth-center
andbackend-service
. - Verify
JWT
token. - Define role-based auth via
Spring Security
:/login
is public to all./backend/admin
can only be accessed by roleADMIN
./backend/user
can only be accessed by roleUSER
./backend/guest
is public to all.