Demo for OAuth2 learning.
Use Docker to setup local test environment with Keycloak. Run
docker compose up -d
Start Demo API server, under ./demo-api directory, run
./gradlew bootRun
Start Demo UI, under ./demo-ui directory, run
ng serve
In browser, open localhost:4200, and click Log in
button, it will redirect to Keycloak login page.
Use user/user or manager/manager to login, and back to demo ui.
You can click call /api/greet
or call /api/admin
buttons and check console to see result from demo-api server.
- Blog: OAuth 2 with Spring, Angular, Keycloak – Spring for Resource Server
- Blog: Securing a Spring Boot REST API with OAuth 2.0, Keycloak, and Angular
- StackOverflow: How configure the JwtAuthenticationConverter for a specific claim structure?
- Keycloak JavaScript adapter
- keycloak-angular
- spring-boot
- spring-security
- Angular