This project covers integration needed between sample spring boot application and OPA (Open Policy Agent)
#Project Dependencies
- OpenJDK 17
- Spring Boot 3.0
#OPA Build Steps
-
Pull latest OPA image in docker desktop
-
Run container docker run -p 8181:8181 openpolicyagent/opa run --server --log-level debug
-
Insert sample policy using curl or through postman: curl --location --request PUT 'localhost:8181/v1/policies/opaweb/authz'
--header 'Content-Type: text/plain'
--data-binary @opaweb-policy.rego
#Docker Image Build - Web App
- Change directory where you have Dockerfile
- Build Image docker build -t spring-boot-opa-integration .
- Run the container docker run -p 8080:8080 spring-boot-opa-integration
- Access app endpoint through Postman with Basic auth, providing username and password http://localhost:8080/hello