This is a demo project to show how BFF Architecture works and authenticate user based on OAuth2/OIDC protocol.
- Java 17
- Spring Boot 3
- Spring Security
- Spring Boot Starter OAuth2 Client
- Spring Boot Starter OAuth2 Resource Server
- Spring Cloud Gateway
- Keycloak
- ReactJS
- Get the latest source code
- Add the following entry to your hosts file
127.0.0.1 backoffice
127.0.0.1 keycloak.local
127.0.0.1 pgadmin.local
- Open terminal of your choice, go to
bff-spring-keycloak-react-demodirectory, rundocker-compose up, wait for all the containers up and running - Open another terminal, go to
backofficedirectory, runnpm installandnpm run devto start the backoffice application - Open
bff-spring-keycloak-react-demoproject by your favorite IDE, openbackoffice-bffto runBackofficeBffApplication.javaand openproductto runProductApplication.javaas Spring Boot Application - Open your browser, now you can access the websites via
http://backoffice/login withadmin|123456oruser|123456
http://keycloak.local/to access Keycloak Admin Console, login withadmin|adminhttp://pgadmin.local/to access PgAdmin, login with[email protected]|admin. Register a server: postgres, port 5432, username: admin, password: admin. The Postgresql server is also exposed to the host machine at port 5432.- Test Authentication Flow + PKCE with Swagger UI:
http://backoffice/api/product/swagger-ui/index.html
© 2023 HQT-Team
🤟 Feel free to use our repository and star it if you find something interesting 🤟
