{"id":13787783,"url":"https://github.com/Bisnode/opa-spring-security","last_synced_at":"2025-05-12T01:31:39.323Z","repository":{"id":45509078,"uuid":"242080215","full_name":"Bisnode/opa-spring-security","owner":"Bisnode","description":"Open Policy Agent for Spring Security","archived":false,"fork":false,"pushed_at":"2021-04-13T07:48:21.000Z","size":190,"stargazers_count":32,"open_issues_count":8,"forks_count":6,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-07T01:45:49.512Z","etag":null,"topics":["authentication","authorization","jwt","opa","opa-spring-filter","opa-spring-security","openpolicyagent","spring-boot","spring-security"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bisnode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-21T07:31:31.000Z","updated_at":"2024-06-05T15:19:42.000Z","dependencies_parsed_at":"2022-08-04T12:00:20.421Z","dependency_job_id":null,"html_url":"https://github.com/Bisnode/opa-spring-security","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bisnode%2Fopa-spring-security","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bisnode%2Fopa-spring-security/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bisnode%2Fopa-spring-security/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bisnode%2Fopa-spring-security/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bisnode","download_url":"https://codeload.github.com/Bisnode/opa-spring-security/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253659393,"owners_count":21943629,"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":["authentication","authorization","jwt","opa","opa-spring-filter","opa-spring-security","openpolicyagent","spring-boot","spring-security"],"created_at":"2024-08-03T21:00:30.914Z","updated_at":"2025-05-12T01:31:38.926Z","avatar_url":"https://github.com/Bisnode.png","language":"Java","readme":"# OPA Spring Security Library\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.bisnode.opa/opa-filter-spring-boot-starter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.bisnode.opa/opa-filter-spring-boot-starter) ![build](https://github.com/Bisnode/opa-spring-security/workflows/build/badge.svg)\n\nOPA Spring Security is a library that enables using OPA for authorization in Spring applications.\n\n## Installation\n\n#### Prerequisites \n\n- Java 11 or higher\n\n#### Using the starter\n\nAdd dependency using Maven\n\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.bisnode.opa/opa-filter-spring-boot-starter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.bisnode.opa/opa-filter-spring-boot-starter)\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.bisnode.opa\u003c/groupId\u003e\n    \u003cartifactId\u003eopa-filter-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e{version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nor Gradle\n\n```groovy\nimplementation 'com.bisnode.opa:opa-filter-spring-boot-starter:{version}'\n```\n\n## Configuration\n\n**All properties are prefixed with `opa.filter`**\n\n| Property             | Default value           | Description                                                                    | Example                  |\n|----------------------|-------------------------|--------------------------------------------------------------------------------|--------------------------|\n| `enabled`            |          `true`         | Whether the filter should be enabled                                           |                          |\n| `documentPath`       |                         | Name of OPA document path to use for queries                                   | _\"http/request/authz\"_   |\n| `instance`           | `http://localhost:8181` | Address of OPA instance                                                        |                          |\n| `endpointsWhitelist` |                         | Comma-separated list of ant patterns to use for matching whitelisted endpoints | /ping,/info,/api-docs/** |\n\n## Policy requirements\n\nCurrently, the filter sends following information to OPA:\n\n- `path` - path of the resource, that's being requested, e.g. `/messages/2` \n- `method` - HTTP method, e.g. `GET`\n- `encodedJwt` - encoded token from authorization (if found, `null` otherwise)\n\nThose properties are available in your policy's `input`.\n\n---\n\nYour OPA policy response should contain following properties:\n\n- `allow` - with value `true` if to requested resource should be allowed. `false` otherwise \n- `reason` - an **optional** string containing reason behind given accessDecision, it will be supplied to exception message \n\nUnknown properties are ignored.\n\n\u003e Example OPA response would look as follows:\n\u003e ```json\n\u003e {\n\u003e   \"result\": \n\u003e   {\n\u003e       \"allow\": false,\n\u003e       \"reason\": \"You shall not pass\"\n\u003e   }\n\u003e }\n\u003e ```\n\n## Published events\nWhen library denies access to the resource, `AuthorizationFailureEvent` is published and therefore can be used in user's code. \n\n\n## Developing and building\nBuild process and dependency management is done using Gradle.\nTests are written in Spock.\n\n## Contribution\n\nInterested in contributing? Please, start by reading [this document](https://github.com/Bisnode/opa-spring-security/blob/master/CONTRIBUTING.md).\n","funding_links":[],"categories":["Language and Platform Integrations"],"sub_categories":["Java"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBisnode%2Fopa-spring-security","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBisnode%2Fopa-spring-security","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBisnode%2Fopa-spring-security/lists"}