https://github.com/making/oauth2-sso-demo
OIDC SSO Demo with Spring Boot + Spring Security
https://github.com/making/oauth2-sso-demo
Last synced: 8 months ago
JSON representation
OIDC SSO Demo with Spring Boot + Spring Security
- Host: GitHub
- URL: https://github.com/making/oauth2-sso-demo
- Owner: making
- License: apache-2.0
- Created: 2016-05-14T14:37:31.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2025-07-23T23:57:22.000Z (9 months ago)
- Last Synced: 2025-07-24T02:14:58.642Z (9 months ago)
- Language: Java
- Homepage:
- Size: 27.6 MB
- Stars: 400
- Watchers: 35
- Forks: 186
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OAuth2/OIDC SSO Demo with Spring Boot + Spring Security
This demo app consists of following three components:
* [Authorization](authorization) ... OAuth2/OIDC Authorization Server. Using [Spring Authorization Server](https://docs.spring.io/spring-authorization-server/reference/index.html).
* [Todo API](todo-api) ... OAuth2 Resource Server. Provides REST API. Using [Spring Security's OAuth2 Resource Server](https://docs.spring.io/spring-security/reference/6.4/servlet/oauth2/resource-server/index.html).
* [Todo Frontend](todo-frontend) ... Web UI (React + Spring MVC) backed by [Spring Security's OAuth2 Login](https://docs.spring.io/spring-security/reference/6.4/servlet/oauth2/login/index.html) + [OAuth 2.0 Client](https://docs.spring.io/spring-security/reference/6.4/servlet/oauth2/client/index.html).
* [Todo Frontend WebFlux](todo-frontend) ... Web UI (React + Spring WebFlux) backed by [Spring Security's OAuth2 Login](https://docs.spring.io/spring-security/reference/6.4/reactive/oauth2/login/index.html) + [OAuth 2.0 Client](https://docs.spring.io/spring-security/reference/6.4/reactive/oauth2/client/index.html).
## How to run
Java 21+ and docker are required.
```
./mvnw spring-boot:run -f authorization -Dspring-boot.run.arguments="--spring.docker.compose.enabled=true --spring.docker.compose.file=$(pwd)/compose.yaml"
./mvnw spring-boot:run -f todo-api -Dspring-boot.run.arguments="--spring.docker.compose.enabled=true --spring.docker.compose.file=$(pwd)/compose.yaml"
./mvnw spring-boot:run -f todo-frontend -Dspring-boot.run.arguments="--spring.docker.compose.enabled=true --spring.docker.compose.file=$(pwd)/compose.yaml"
or
./mvnw spring-boot:run -f todo-frontend-webflux -Dspring-boot.run.arguments="--spring.docker.compose.enabled=true --spring.docker.compose.file=$(pwd)/compose.yaml"
```
Visit http://localhost:8080 (todo-frontend). The first time you visit, you will be redirected to http://127.0.0.1:9000 (authorization).

* Username: `john@example.com`
* Password: `password`

Feel free to add new Todos or complete them.

You can see the tracing via Zipkin (http://localhost:9411)

Docker Compose will automatically start up when the app is started, but it will not automatically shut down, so if you do not need Zipkin after stopping the app, please shut down Docker Compose as well.
```
pkill -TERM java
docker compose down
```