{"id":21334926,"url":"https://github.com/vlsergey/spring-data-entity-security","last_synced_at":"2025-07-12T12:30:51.071Z","repository":{"id":46135284,"uuid":"399495293","full_name":"vlsergey/spring-data-entity-security","owner":"vlsergey","description":"Extension to Spring Data to add security filters to repositories","archived":false,"fork":false,"pushed_at":"2021-11-11T12:50:20.000Z","size":221,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-13T03:14:52.928Z","etag":null,"topics":["java","security","spring-data","spring-data-jpa"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vlsergey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-24T14:27:14.000Z","updated_at":"2023-05-17T13:14:12.000Z","dependencies_parsed_at":"2022-09-07T13:40:57.882Z","dependency_job_id":null,"html_url":"https://github.com/vlsergey/spring-data-entity-security","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlsergey%2Fspring-data-entity-security","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlsergey%2Fspring-data-entity-security/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlsergey%2Fspring-data-entity-security/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlsergey%2Fspring-data-entity-security/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vlsergey","download_url":"https://codeload.github.com/vlsergey/spring-data-entity-security/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225820293,"owners_count":17529138,"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":["java","security","spring-data","spring-data-jpa"],"created_at":"2024-11-21T23:36:24.809Z","updated_at":"2024-11-21T23:36:25.226Z","avatar_url":"https://github.com/vlsergey.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# spring-data-entity-security\n[![](https://jitpack.io/v/vlsergey/spring-data-entity-security.svg)](https://jitpack.io/#vlsergey/spring-data-entity-security)\nExtension to Spring Data to add security filters to repositories\n\n- ✨ Adds security conditions to all standard JPA methods from JpaRepository and JpaSpecificationExecutor\n- ✨ Also adds conditions to QuerydslPredicateExecutor if querydsl is enabled for the repository\n- ✨ Injects security conditions into queries generated from user-specific methods in JpaRepository (like `findBySomeField`)\n\n\n- 🚧 Find-by-example is not implemented (will throw `UnsupportedOperationException`)\n- 🚧 Compound IDs will not work for all operations\n\n\n- ⚠️ Only methods of JPA repository are affected. Thus, any code working with JPA `EntityManager` will not be affected.\n- ⚠️ Also, any links from one entity to another (`@OneToOne`, `@ManyToOne`, `@OneToMany`, `@ManyToMany`) are not affected. The code will receive entities without security filtering using such link methods.  \n\nExamples and test-cases:\n* [Simple entity with `owner` field, but `root` is allowed to see all entities](https://github.com/vlsergey/spring-data-entity-security/tree/master/src/test/java/com/github/vlsergey/springdata/entitysecurity/owned)\n* [File-alike permission check with owner user and group](https://github.com/vlsergey/spring-data-entity-security/tree/master/src/test/java/com/github/vlsergey/springdata/entitysecurity/noquerydsl)\n\n## Installation\n\n_Important:_ version 2.5.0+ of `spring-data-jpa` is required (due to changes in `JpaRepositoryFactory`).\n\n### Gradle\n\nAdd the JitPack repository to your `build.gradle`:\n\n```grooxmlvy\nrepositories {\n    maven {\n        url = uri(\"https://jitpack.io\")\n    }\n}\n```\n\nAdd package as a dependency:\n\n```groovy\ndependencies {\n    implementation group: 'com.github.vlsergey', name: 'spring-data-entity-security', version: '0.4.0'\n}\n```\n\n### Maven\nAdd the JitPack repository to your build file:\n\n```xml\n    \u003crepositories\u003e\n        \u003crepository\u003e\n            \u003cid\u003ejitpack.io\u003c/id\u003e\n            \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n        \u003c/repository\u003e\n    \u003c/repositories\u003e\n```\n\nStep 2. Add the dependency\n\n```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.vlsergey\u003c/groupId\u003e\n        \u003cartifactId\u003espring-data-entity-security\u003c/artifactId\u003e\n        \u003cversion\u003e0.4.0\u003c/version\u003e\n    \u003c/dependency\u003e\n```\n\n## Usage\n\nAdd `repositoryFactoryBeanClass` parameter to your `@EnableJpaRepositories` annotation:\n```java\n@EnableJpaRepositories(value = \"com.mycompany.data\",\n    repositoryFactoryBeanClass = com.github.vlsergey.springdata.entitysecurity.SecuredJpaRepositoryFactoryBean.class)\n```\n\nFor each repository you want to enforce entity security implement `SecurityMixin` (that describes details of how to build security constrains for each domain entity) and add `@SecuredWith` annotation to repository interface.\n\nIf querydsl is used implement `SecurityMixinWithQuerydsl` instead of `SecurityMixin` for such repository.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlsergey%2Fspring-data-entity-security","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvlsergey%2Fspring-data-entity-security","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlsergey%2Fspring-data-entity-security/lists"}