{"id":28028372,"url":"https://github.com/permitio/permitio-java-spring-boot-example","last_synced_at":"2025-06-25T23:04:10.066Z","repository":{"id":247626922,"uuid":"825785648","full_name":"permitio/permitio-java-spring-boot-example","owner":"permitio","description":"This Spring Boot API demonstrates the use of Permit.io permission checks via the Permit.io SDK using RBAC+ABAC and ReBAC policy models. ","archived":false,"fork":false,"pushed_at":"2024-07-09T16:10:50.000Z","size":219,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T23:03:12.047Z","etag":null,"topics":["example"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/permitio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-08T13:47:12.000Z","updated_at":"2025-03-13T15:22:05.000Z","dependencies_parsed_at":"2024-07-09T20:41:59.247Z","dependency_job_id":"c837f239-e94a-4000-a72c-9bc1223f4c56","html_url":"https://github.com/permitio/permitio-java-spring-boot-example","commit_stats":null,"previous_names":["ocap-kirk/permitio-java-example","permitio/permitio-java-spring-boot-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/permitio/permitio-java-spring-boot-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permitio%2Fpermitio-java-spring-boot-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permitio%2Fpermitio-java-spring-boot-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permitio%2Fpermitio-java-spring-boot-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permitio%2Fpermitio-java-spring-boot-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/permitio","download_url":"https://codeload.github.com/permitio/permitio-java-spring-boot-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/permitio%2Fpermitio-java-spring-boot-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261967127,"owners_count":23237662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example"],"created_at":"2025-05-11T07:11:57.712Z","updated_at":"2025-06-25T23:04:09.996Z","avatar_url":"https://github.com/permitio.png","language":"Java","readme":"# Permit.io LoTR RBAC+ABAC and ReBAC example\n## About\nThis Spring Boot API demonstrates the use of Permit.io permission checks via the Permit.io SDK using RBAC+ABAC and ReBAC policy models. All of the policy data is inside of Permit.io and user, action, resource are passed current passed as query string params (see  [src/main/java/com/permit/check/example/ExampleApplication.java](src/main/java/com/permit/check/example/ExampleApplication.java ))\n\n## Dependencies\n\n1. Spring Boot 3.3.1\n1. Java 22 (built with `java version \"22.0.1\" 2024-04-16`)\n1. Permit.io PDP running on :7766\n\n## Setup\n1. Copy the `permit_key` from the Permit.io dashboard\n1. Replace the value in [src/main/java/com/permit/check/example/ExampleApplication.java:31](src/main/java/com/permit/check/example/ExampleApplication.java:31 )\n1. Replace the value in the PDP call below.\n\n## Steps to run\n1. Start the Permit.io PDP:\n    \n     `docker run -it -p 7766:7000 --env PDP_DEBUG=True --env PDP_API_KEY=permit_key_abc permitio/pdp-v2:latest`\n1. Start this app:\n\n    `./mvnw spring-boot:run`\n1. Make API calls to test the permissions\n\n\n## Example API calls\n### RBAC+ABAC\nThe following are values that can be tested with:\n1. Frodo/High Potential: \n\n    `{\"sub\":\"frodo@middle-earth.com\",\"name\":\"Frodo Baggins\",\"subscription\":\"High Potential\"}`\n1. Gimli/Sustain: \n\n    `{\"sub\":\"gimli@middle-earth.com\",\"name\":\"Gimli\",\"subscription\":\"Sustain\"}`\n1. Gandalf/Core: \n\n    `{\"sub\":\"gandalf@middle-earth.com\",\"name\":\"Gandalf the Grey\",\"subscription\":\"Core\"}`\n1. Aragorn/Flagship: \n\n    `{\"sub\":\"aragorn@middle-earth.com\",\"name\":\"Aragorn\",\"subscription\":\"Flagship\"}`\n\n#### Example curl calls with response\n```\ncurl --location 'http://localhost:8080/API/1?user=gandalf%40middle-earth.com\u0026segment=US'\n``` \n`gandalf@middle-earth.com` IS PERMITTED to GET API 1!\u003cbr /\u003e\u003cbr /\u003e\n\n```\ncurl --location 'http://localhost:8080/API/2?user=gandalf%40middle-earth.com\u0026segment=US'\n```\n`gandalf@middle-earth.com` IS PERMITTED to GET API 2!\u003cbr /\u003e\u003cbr /\u003e\n```\ncurl --location 'http://localhost:8080/API/3?user=gandalf%40middle-earth.com\u0026segment=US'\n```\n`gandalf@middle-earth.com` IS PERMITTED to GET API 3!\u003cbr /\u003e\u003cbr /\u003e\n```\ncurl --location 'http://localhost:8080/API/4?user=gandalf%40middle-earth.com\u0026segment=US'\n```\n`gandalf@middle-earth.com` is NOT PERMITTED to GET API 4!\u003cbr /\u003e\u003cbr /\u003e\n\n\n### ReBAC\nExample of the ReBAC structure\n![ReBAC for this Example App](ReBAC.png \"Teams and Dashboard\")\n\n#### Example curl calls with response\n```\ncurl --location 'http://localhost:8080/dashboard/OneRing?user=gandalf%40middle-earth.com\u0026action=update'\n```\n`gandalf@middle-earth.com` IS PERMITTED to update Dashboard OneRing!\u003cbr /\u003e\u003cbr /\u003e\n\n```\ncurl --location 'http://localhost:8080/dashboard/TheEyeOfSauron?user=gandalf%40middle-earth.com\u0026action=update'\n```\n`gandalf@middle-earth.com` is NOT PERMITTED to update Dashboard TheEyeOfSauron!\u003cbr /\u003e\u003cbr /\u003e\n\n```\ncurl --location 'http://localhost:8080/dashboard/TheEyeOfSauron?user=sauron%40middle-earth.com\u0026action=update'\n```\n`sauron@middle-earth.com` IS PERMITTED to update Dashboard TheEyeOfSauron!\u003cbr /\u003e\u003cbr /\u003e\n\n```\ncurl --location 'http://localhost:8080/dashboard/OneRing?user=sauron%40middle-earth.com\u0026action=update'\n```\n`sauron@middle-earth.com` is NOT PERMITTED to update Dashboard OneRing!\u003cbr /\u003e\u003cbr /\u003e\n\n### Todo\n1. Make API calls to Permit.io to setup the env\n1. Make API calls to setup permissions\n1. Make API calls Populate ReBAC data","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermitio%2Fpermitio-java-spring-boot-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpermitio%2Fpermitio-java-spring-boot-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpermitio%2Fpermitio-java-spring-boot-example/lists"}