forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DRAFT] Resource permissions and sharing #166
Draft
DarshitChanpura
wants to merge
345
commits into
main
Choose a base branch
from
resource-permissions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 15 commits
Commits
Show all changes
345 commits
Select commit
Hold shift + click to select a range
23fcfba
Fixes license
DarshitChanpura fba48ab
Adds changelog entry
DarshitChanpura 9cb8d0e
Adds a notion of scope
DarshitChanpura e7ad37d
Change version checks from CURRENT to 2.18 (#16174)
ltaragi bf6566e
Add changes to block calls in cat shards, indices and segments based …
sumitasr 5771e81
Separate Remote State and Publication enabled and configured methods …
shiv0408 6020c58
[Snapshot V2] Remove orphan timestamps post create snapshot completio…
gbbafna 3d7184b
Bump Netty to 4.1.114.Final (#16182)
reta d1fd47c
Implement phone number analyzer (#15915)
rursprung f9e0c85
Fix japicmp configuration by treating abstract-to-default method chan…
reta aef7eca
Add more unit tests for RemoteStoreUtils and RemoteFsTimestampAwareTr…
sachinpkale ba8f1be
Run queued operations post v2 operations completion (#16179)
gbbafna b06ddb6
Fix warnings from SLF4J on startup when repository-s3 is installed (#…
cwperks 421a1cc
Fix unknown parameter source_remote_translog_repository bug (#16192)
sachinpkale 848234e
Modifies sharedwith to accomodate scope
DarshitChanpura eaf0c6e
Adds missing JavaDoc
DarshitChanpura 6a6e6f7
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura 566913a
Adds NamedWriteable capability and removes un-needed method
DarshitChanpura 7a58f5e
Mute snapshot v2 flaky tests (#16193)
gbbafna a81b868
Implementing pagination for _cat/shards (#14641)
gargharsh3134 146b0f7
Update Apache Lucene to 9.12.0 (#15333)
reta e885aa9
Latency improvements to Multi Term Aggregations (#14993)
expani e24b4c9
Add wlm resiliency orchestrator (query group service) (#15925)
kaushalmahi12 266bdd3
[Tiered Caching] Segmented cache changes (#16047)
sgup432 1e49aa8
[Star tree] Add date field rounding support in star tree (#15249)
bharath-techie 3696c29
[Star tree] Refactoring builder tests (#16036)
bharath-techie 5279d21
Change successfulSearchShardIndices to Set<Index> (#16110)
dzane17 e8e041b
Add more concurrent Snapshot V2 Integ Tests (#16207)
gbbafna aad325f
Bump com.azure:azure-json from 1.1.0 to 1.3.0 in /plugins/repository-…
dependabot[bot] 96082f7
Close RemoteStorePinnedTimestampService on Node.close() (#16228)
sachinpkale febbc00
Add TLSv1.3 in jdk.tls.client.protocols systemProp in gradle.properti…
cwperks 2ed8ff0
Attempt to delete backport branches only for OpenSearch repo (#16240)
gaiksaya 62b1537
Fix Cache backward compatibility breaking change (#16238)
sgup432 b5917c5
[Star tree] Moving compositeCodec to composite912Codec and dropping c…
bharath-techie acf209f
Bump com.google.api-client:google-api-client from 2.2.0 to 2.7.0 in /…
dependabot[bot] e7757e7
Update Apache Lucene version for 2.18.0 (#16252)
reta 9225aa2
Bump com.squareup.okio:okio from 3.9.0 to 3.9.1 in /test/fixtures/hdf…
dependabot[bot] ba0ccfa
Bump io.grpc:grpc-api from 1.57.2 to 1.68.0 in /plugins/discovery-gce…
dependabot[bot] a09750a
Remove redundant force merge - histo rest tests (#16144)
finnegancarroll 68e3e45
The protobuf-java leaks through client library dependencies (#16254)
reta 9e53d9b
Fix Flaky Test org.opensearch.gateway.RecoveryFromGatewayIT.testShard…
kkewwei d7b0116
Revert remote publication method renaming in DiscoveryNode (#16250)
soosinha 58adc18
BugFix: call listener.onFailure on failure to pin the timestamp (#16248)
sachinpkale b2253f1
[Workload Management] QueryGroup Stats API Logic (#15777)
ruai0511 b3b8c9b
Add Integration Tests for Workload Management CRUD APIs (#15955)
ruai0511 691f725
Reconfigure remote state thread pool count (#16245)
soosinha 942765e
Add snapshot_path prefix to snapshot shards path file on S3 (#16267)
ashking94 b4f876f
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura 9baac32
Updates toXContent implementations
DarshitChanpura 0eb47ac
Fix toString implementation
DarshitChanpura 1e7f6df
Support JDK-23 (build time and runtime) (#16257)
reta 34b794b
Making wlm stats output easier to understand (#16278)
kaushalmahi12 d6ea8eb
Change remote store restore cluster state priority to URGENT (#16281)
sachinpkale b3459fd
Update setting API honors cluster's replica setting as default #14810…
chishui 53c9ddf
Remove ApproximateIndexOrDocValuesQuery (#16273)
msfroh 20536ee
Fix IndicesRequestCacheIt flaky tests (#16276)
sgup432 5d2d392
Skip unnecessary string format in RemoteStoreMigrationAllocationDecid…
imRishN 2166b44
Optimise clone operation for incremental full cluster snapshots (#16296)
ashking94 55e98ed
Fix multi-search with template doesn't return status code (#16265)
gaobinlong b5dcde3
[Snapshot V2] Move timestamp pinning before cluster state update (#16…
gbbafna 7065e6b
Bump ch.qos.logback:logback-core from 1.5.8 to 1.5.10 in /test/fixtur…
dependabot[bot] f4bf0da
Bump me.champeau.gradle.japicmp from 0.4.3 to 0.4.4 in /server (#16309)
dependabot[bot] 0ff0439
Bump com.google.oauth-client:google-oauth-client from 1.35.0 to 1.36.…
dependabot[bot] 32c1a43
Bump lycheeverse/lychee-action from 1.10.0 to 2.0.2 (#16310)
dependabot[bot] 931339e
Bump com.azure:azure-core-http-netty from 1.15.4 to 1.15.5 in /plugin…
dependabot[bot] 783d3e1
Bump com.google.code.gson:gson from 2.10.1 to 2.11.0 in /plugins/repo…
dependabot[bot] 88d13eb
Enable coordinator search.request_stats_enabled by default (#16290)
dzane17 9ddee61
Flat object field should delegate to keyword field for most query typ…
kkewwei 6c17119
Add new benchmark config for query approximation (#16323)
msfroh e313071
Allows the ability to list resource permissions
DarshitChanpura a53e0c6
Update last seen cluster state in commit phase (#16215)
soosinha 35c366d
Add support to dynamically resize threadpools size (#16236)
gbbafna 23d1c7a
Fix deletion permits flow in RemoteFsTimestampAwareTranslog (#16282)
sachinpkale a853b75
Fix wrong default value when setting index.number_of_routing_shards t…
gaobinlong d404359
JDK-23: Mitigation for https://bugs.openjdk.org/browse/JDK-8341127 is…
reta dd5a87a
Bugfix in snapshot V2 restore flow (#16332)
sachinpkale 62081f2
fix cluster not able to spin up issue when disk usage exceeds thresho…
zane-neo 6594516
[Snapshot V2] Use metadata from source snapshot while cloning snapsho…
gbbafna ec7b652
[Streaming Indexing] Fix intermittent 'The bulk request must be termi…
reta 1a7018a
Fixed inefficient Stream API call chains ending with count() (#15386)
dk2k 74dba3f
Update 10_basic.yml (#16349)
reta 0c3e3c0
Make Remote Publication a dynamic setting (#15937)
shiv0408 dc8a435
[Star tree] Performance optimizations during flush flow (#16037)
bharath-techie e360ceb
Skip media type parsing for known string values (#16358)
andrross ebcf5e3
Fixed assignment to catch block parameter (#15384)
dk2k 3b004bf
Make query groups persistent across process restarts (#16370)
kaushalmahi12 4456d55
Removed suspicious call of getClass() on instance of Class, which era…
dk2k 0bded88
Revert #15258 to figure out a better approach to fix the issue. (#16377)
zane-neo 9096aee
Fix bug in snapshot update check for multiple v2 repo (#16379)
gbbafna f1c98a4
Do orphan timestamp cleanup before completing the snapshot (#16365)
gbbafna f346788
Add method to return dynamic SecureTransportParameters from SecureTra…
cwperks 0f7d572
Fix array hashCode calculation in ResyncReplicationRequest (#16378)
dk2k 0419e5d
Fix typo super->sb in method toString() of RemoteStoreNodeAttribute (…
dk2k 78d2a4e
Treat last fetch timestamp of pinned timestamp as one of the pinned t…
sachinpkale c4a9cc1
BugFix - Extract snapshot UUID from pinned entity correctly (#16398)
gbbafna ad7f9e7
Handle delete cases for star tree (#16380)
bharath-techie 2dfd519
Bump org.jline:jline in /test/fixtures/hdfs-fixture (#16404)
dependabot[bot] 6c7581e
Snapshot _status API: Include in-progress snapshots in total shard co…
ltaragi e3db742
Bump com.microsoft.azure:msal4j from 1.17.1 to 1.17.2 in /plugins/rep…
dependabot[bot] 322bdc4
[BUG] Add missing fields to resolve Strict Dynamic Mapping issue in .…
inpink 456ca97
[Star Tree] [Search] Support for metric aggregations with/without ter…
sandeshkr419 1982427
URI path filtering support in cluster stats API (#15938)
SwethaGuptha 20e233e
Fixing inline javadocs usage in PaginationStrategy (#16428)
gargharsh3134 267c68e
Fix unclosed store references with node-node segrep when primary node…
mch2 5120efb
Update JDK to 23.0.1 (#16429)
reta 6891267
Improve the rejection logic for soft mode query groups during node du…
kaushalmahi12 760e676
Wlm create/update REST API bug fix (#16422)
kaushalmahi12 ca40ba4
Make multiple settings dynamic for tuning on larger clusters (#16347)
rahulkarajgikar 9489a21
Add new parameters to snapshot restore to rename the restored aliases…
mispencer bb1359f
Disallow snapshot deletion while a v2 snapshot is in progress (#16430)
gbbafna 15607b1
Downgrade version to 2.18.0 for ser/de of new ClusterStatsRequest met…
SwethaGuptha 5941a7e
Fix get index settings API doesn't show number_of_routing_shards when…
gaobinlong 9a476b6
Avoid making further transport calls if paginationStrategy outputs em…
gargharsh3134 8eccbb5
Add log message if SSL dual mode is enabled (#16437)
cwperks 66f0110
Fix flaky test in `testApproximateRangeWithSizeOverDefault` by adjust…
inpink 9dd1a59
Add support for restoring from snapshot with search replicas (#16111)
vinaykpud 119abaf
Update version to 2.18.0 for CatShards request and response (#16455)
gargharsh3134 9498793
Update 2.x to 2.19.0 (since 2.18.0 was cut) (#16466)
reta 936cdb9
Change to correct version since this has been backported (#16472)
mispencer 4ad1be3
Revert uploading of manifest using min codec version (#16403)
soosinha bb45f03
Add Setting to adjust the primary constraint weights (#16471)
Arpit-Bandejiya b2d537a
Update version check in yaml test file for the bug fix for get index …
gaobinlong 6f1b59e
Add logic in master service to optimize performance and retain detail…
sumitasr 72559bf
create publication repos during join task execution (#16383)
rajiv-kv 0fcb3ab
Bump ch.qos.logback:logback-core from 1.5.10 to 1.5.12 in /test/fixtu…
dependabot[bot] 9f7d3b6
using the routing allocation to cancel existing recoveries (#16468)
rajiv-kv af7a067
Switch from `buildSrc/version.properties` to Gradle version catalog (…
cwperks 6385ad3
Add 2.18 release notes (#16511)
andrross 08dc3bb
Remove CHANGELOG entry for change that was backported (#16514)
andrross 1e7c122
Ensure index templates are not applied to system indices (#16418)
pyek-bot 1ec5bcb
Bump com.google.apis:google-api-services-compute from v1-rev20240407-…
dependabot[bot] f57b889
Bump com.azure:azure-storage-common from 12.25.1 to 12.27.1 (#16521)
gaobinlong 4b284c5
Bump com.azure:azure-storage-blob from 12.23.0 to 12.28.1 in /plugins…
dependabot[bot] 80ca32f
remove resource usages object from headers (#16532)
ansjcy 0363aa7
Adds cluster setting to allow caching requests with size>0 in request…
peteralfonsi a2a01f8
Support retrieving doc values of unsigned long field (#16543)
bugmakerrrrrr bb131f9
Bump versions in README to 2.19.0 and 2.18.1 (#16554)
cwperks f32f5c6
Bump org.apache.hadoop:hadoop-minicluster from 3.4.0 to 3.4.1 in /tes…
dependabot[bot] 4c35a2b
fix rollover alias supports restored searchable snapshot index (#16483)
kkewwei b25e10a
Ensure support of the transport-nio by security plugin (HTTP) (#16474)
reta e07499a
Improve performance for resolving derived fields (#16564)
robson-glean bd91162
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura 4213cc2
Make cacheEntry.getIndexInput() privileged when fetching blobs from r…
finnegancarroll 034bd2b
Bump com.google.apis:google-api-services-compute from v1-rev20241015-…
dependabot[bot] 9f790ee
Fix non-x64 bwc build targets (#16575)
andrross aa5c39b
Detect Breaking Changes check does not fail on new method added to an…
reta 9b7681c
Make IndexStoreListener a pluggable interface (#16583)
jed326 5909e1a
Update dependency org.apache.zookeeper:zookeeper to v3.9.3 (#16593)
mend-for-github-com[bot] e688388
[AUTO] [main] Add bwc version 2.18.1. (#16573)
opensearch-trigger-bot[bot] 10873f1
Increase segrep pressure checkpoint default limit to 10 (#16577)
gbbafna 607a08e
Bump lycheeverse/lychee-action from 2.0.2 to 2.1.0 (#16610)
dependabot[bot] 6e34a80
Bump me.champeau.gradle.japicmp from 0.4.4 to 0.4.5 in /server (#16614)
dependabot[bot] 46ded36
Adds Integration Tests for Search Pipeline (#16561)
owaiskazi19 c9edb48
Add a flag in QueryShardContext to differentiate between a normal que…
heemin32 b9d9729
Bump com.nimbusds:nimbus-jose-jwt from 9.41.1 to 9.46 in /test/fixtur…
dependabot[bot] 7f27ddc
Complete keyword changes for star tree (#16233)
bharath-techie e9f77e3
Bump org.apache.xmlbeans:xmlbeans from 5.2.1 to 5.2.2 in /plugins/ing…
dependabot[bot] 53d41d3
feat: add vertical scaling and SoftReference for snapshot repository …
inpink 5068fad
Add a new configuration setting `synonym_analyzer` for `synonym_graph…
prudhvigodithi 548a650
Support prefix list for remote repository attributes (#16271)
rajiv-kv 3f18562
Bump google-auth-library-oauth2-http from 1.7.0 to 1.29.0 in /plugin…
gaobinlong 4cce608
Fix stale index deletion in snapshots for hashed prefix path type (#1…
ashking94 ac3e4ff
Bump com.google.cloud:google-cloud-core-http from 2.23.0 to 2.47.0 in…
dependabot[bot] 3b9ca63
Support installing plugin SNAPSHOTs with SNASPHOT distribution (#16581)
reta 26e6ea1
Update DEVELOPER_GUIDE.md instructions for JDK-11 (#16533)
reta efef676
Update version check in yaml test file for allowing composite aggrega…
gaobinlong 3b4fa0e
Bump mockito from 5.14.1 to 5.14.2, objenesis from 3.2 to 3.3 and byt…
cwperks 8e097ee
Update to Netty 4.1.115.Final (#16661)
reta d4d70d8
Search dv only IP masks (#16628)
mkhludnev dccd40f
Bump org.xerial.snappy:snappy-java from 1.1.10.6 to 1.1.10.7 in /test…
dependabot[bot] f105e4e
Bump com.gradle.develocity from 3.18.1 to 3.18.2 (#16669)
dependabot[bot] ac44300
Fix stale cluster state custom file deletion (#16670)
soosinha 9b8b9fd
Update Gradle to 8.11 (#16386)
reta 1d8568e
Update Gradle version for Detect Breaking Changes Github action (#16685)
reta 2ac64a6
Changing request cache size > 0 setting to int threshold (#16570)
peteralfonsi b17c295
Bump codecov/codecov-action from 4 to 5 (#16667)
dependabot[bot] 05513df
Bump com.google.apis:google-api-services-compute from v1-rev20241021-…
dependabot[bot] 2327258
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura b1a7743
Separating remote download and publication stats (#16682)
himshikha 9388217
Update Gradle to 8.11.1 (#16694)
reta c82cd2e
[Bugfix] Fix TieredSpilloverCache stats not adding correctly when sha…
peteralfonsi 774a4a1
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura 3da97f2
Bump org.apache.logging.log4j:log4j-core from 2.24.1 to 2.24.2 in /bu…
dependabot[bot] 5817710
Removed unused array (#15364)
dk2k 37cacf0
Adds NamedWriteable implementations
DarshitChanpura ad982c2
Support more than 1024 IP/masks with indexed field (#16391)
mkhludnev 6d3fd37
Library changes for Apache Arrow integration (#16691)
rishabhmaurya b75f27a
Fix Flaky Test SearchWithRandomExceptionsIT.testRandomExceptions (#16…
kkewwei d2a1477
Deprecate performing update operation with default pipeline or final …
gaobinlong ac45643
Update 75_update.yml (#16759)
reta d6157d6
Fix allowed_warnings takes no effect for the yaml test in 75_update.y…
gaobinlong 80ba41f
Bump ch.qos.logback:logback-classic from 1.2.13 to 1.5.12 in /test/fi…
dependabot[bot] 5b05dcb
Update Jackson to 2.18.2 (#16758)
reta b1bf72f
Bound the size of cache in deprecation logger (#16724)
andrross 4107407
Adds TODO for Noop Implementation
DarshitChanpura d199096
Ensure consistency of system flag on IndexMetadata after diff is appl…
cwperks 274c64f
Adds fromValue method to EntityType
DarshitChanpura 42dc22e
Bump com.azure:azure-identity from 1.13.2 to 1.14.2 in /plugins/repos…
cwperks 014be82
Refactors variables from List to Set
DarshitChanpura 75a2fc3
Make entries for dependencies from server/build.gradle to gradle vers…
cwperks 3143796
Updates revokeAccess signature to accept scopes to revoke access from
DarshitChanpura 04a02cb
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura e468f91
Convert sets to lists
DarshitChanpura 3a0b4b1
Upper-case the default scope
DarshitChanpura 98dbc4a
Refactor Docker Compose version detection to predictably pick v2 only…
reta d12fc32
Bump com.azure:azure-storage-common from 12.27.1 to 12.28.0 in /plugi…
dependabot[bot] 2d18c34
Consolidate cleanup for Azure blob tests (#16789)
reta 5ba909a
Overflow prevention (#16812)
prudhvigodithi da6eda7
Skip remote-repositories validations for node-joins when Repositories…
Pranshu-S 336bb5f
Added release notes for 1.3.20 (#16824)
bshien c5f3818
Bump com.nimbusds:nimbus-jose-jwt from 9.46 to 9.47 in /test/fixtures…
dependabot[bot] 5aa6509
Update opensearch.release-notes-1.3.20.md (#16825)
dbwiddis 0056807
Adds concrete implementation of getResources in Noop RAC plugin
DarshitChanpura 0548fc2
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura 2b402ec
Fixing _list/shards API for closed indices (#16606)
gargharsh3134 b67cdf4
Added support for search replica to return segrep stats (#16678)
vinaykpud 193112b
Updates the ResourceAccessControlPlugin to have noop actions, renames…
DarshitChanpura cbbefa6
Adds ReflectPermissions for DefaultResourceAccessControlPlugin
DarshitChanpura d7d1f25
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura b359dd8
Fix remote shards balance (#15335)
bugmakerrrrrr d37cc9b
Handle version during repository registration for prefix mode verific…
ashking94 e46d4bc
introduce a setting to disable full cluster state from remote on term…
rajiv-kv ef44e86
Bump com.gradle.develocity from 3.18.2 to 3.19 (#16855)
dependabot[bot] bc4f44b
Update Apache Lucene to 9.12.1 (#16846)
reta d676592
Bump org.apache.logging.log4j:log4j-core from 2.24.2 to 2.24.3 in /bu…
dependabot[bot] 231c6d6
Bump org.apache.xmlbeans:xmlbeans from 5.2.2 to 5.3.0 in /plugins/ing…
dependabot[bot] d947df0
Bump org.jline:jline from 3.27.1 to 3.28.0 in /test/fixtures/hdfs-fix…
dependabot[bot] a44b06a
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura 57a6605
Bump com.azure:azure-core from 1.51.0 to 1.54.1 in /plugins/repositor…
dependabot[bot] b58308e
Adds missing package-info
DarshitChanpura 8aa3185
Change Remote state read thread pool to Fixed type (#16850)
soosinha b5f651f
[Backport] [2.18] Update Apache Lucene to 9.12.1 (#16846) (#16870) (#…
reta b25a9a7
Adds unit and integration tests
DarshitChanpura eb43578
Adds missing experimental annotations
DarshitChanpura bcd0f2b
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura 686f037
Uses jackson object-mapper to read resource class and updates the int…
DarshitChanpura 0bf9fd1
Completes the integrations tests
DarshitChanpura 4a073f1
Updates SHAs
DarshitChanpura 34f160c
Comment and code cleanup
DarshitChanpura 1df8e11
Fixes tests
DarshitChanpura e6d71d2
Changes to support IP field in star tree indexing (#16641)
bharath-techie f4fd707
Remove the events-correlation-engine plugin (#16885)
andrross 7050ecf
Fix Flaky Test SearchTimeoutIT.testSimpleTimeout (#16828)
kkewwei eee5ce1
Merge remote-tracking branch 'upstream/main' into resource-permissions
DarshitChanpura 77c56be
Adds integration tests for non-default RAC plugin
DarshitChanpura bb584bb
Removes unused dependency licenses
DarshitChanpura 448307b
Adds missing license headers
DarshitChanpura d9f5262
Adds type bounding to Resource
DarshitChanpura 1aff350
Updates Resource to be a serializable
DarshitChanpura f90b165
Adds getResourceName as API contract for Resource
DarshitChanpura File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
server/src/main/java/org/opensearch/accesscontrol/resources/CreatedBy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.accesscontrol.resources; | ||
|
||
import org.opensearch.core.xcontent.ToXContentFragment; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* This class contains information on the creator of a resource. | ||
* Creator can either be a user or a backend_role. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class CreatedBy implements ToXContentFragment { | ||
|
||
private String user; | ||
|
||
private String backendRole; | ||
|
||
public CreatedBy(String user, String backendRole) { | ||
this.user = user; | ||
this.backendRole = backendRole; | ||
} | ||
|
||
public String getBackendRole() { | ||
return backendRole; | ||
} | ||
|
||
public void setBackendRole(String backendRole) { | ||
this.backendRole = backendRole; | ||
} | ||
|
||
public String getUser() { | ||
return user; | ||
} | ||
|
||
public void setUser(String user) { | ||
this.user = user; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CreatedBy {" + "user='" + user + '\'' + ", backendRole='" + backendRole + '\'' + '}'; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
return builder.startObject().field("user", user).field("backend_role", backendRole).endObject(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
server/src/main/java/org/opensearch/accesscontrol/resources/EntityType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.accesscontrol.resources; | ||
|
||
/** | ||
* This enum contains the type of entities a resource can be shared with. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public enum EntityType { | ||
|
||
USERS, | ||
|
||
ROLES, | ||
|
||
BACKEND_ROLES, | ||
} |
59 changes: 59 additions & 0 deletions
59
server/src/main/java/org/opensearch/accesscontrol/resources/ResourceService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.accesscontrol.resources; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.opensearch.OpenSearchException; | ||
import org.opensearch.plugins.NoOpResourceAccessControlPlugin; | ||
import org.opensearch.plugins.ResourceAccessControlPlugin; | ||
import org.opensearch.plugins.ResourcePlugin; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Resource access control for OpenSearch | ||
* | ||
* @opensearch.experimental | ||
* */ | ||
public class ResourceService { | ||
private static final Logger log = LogManager.getLogger(ResourceService.class); | ||
|
||
private final ResourceAccessControlPlugin resourceACPlugin; | ||
private final List<ResourcePlugin> resourcePlugins; | ||
|
||
public ResourceService(final List<ResourceAccessControlPlugin> resourceACPlugins, List<ResourcePlugin> resourcePlugins) { | ||
this.resourcePlugins = resourcePlugins; | ||
|
||
if (resourceACPlugins.isEmpty()) { | ||
log.info("Security plugin disabled: Using NoOpResourceAccessControlPlugin"); | ||
resourceACPlugin = new NoOpResourceAccessControlPlugin(); | ||
} else if (resourceACPlugins.size() == 1) { | ||
log.info("Security plugin enabled: Using OpenSearchSecurityPlugin"); | ||
resourceACPlugin = resourceACPlugins.get(0); | ||
} else { | ||
throw new OpenSearchException( | ||
"Multiple resource access control plugins are not supported, found: " | ||
+ resourceACPlugins.stream().map(Object::getClass).map(Class::getName).collect(Collectors.joining(",")) | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Gets the current ResourcePlugin to perform authorization | ||
*/ | ||
public ResourceAccessControlPlugin getResourceAccessControlPlugin() { | ||
return resourceACPlugin; | ||
} | ||
|
||
/** | ||
* List active plugins that define resources | ||
*/ | ||
public List<ResourcePlugin> listResourcePlugins() { | ||
return resourcePlugins; | ||
} | ||
} |
115 changes: 115 additions & 0 deletions
115
server/src/main/java/org/opensearch/accesscontrol/resources/ResourceSharing.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.accesscontrol.resources; | ||
|
||
import org.opensearch.core.xcontent.ToXContentFragment; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
import java.util.Objects; | ||
|
||
/** | ||
* A document in .resource_sharing index. | ||
* Holds information about the resource (obtained from defining plugin's meta-data), | ||
* the index which defines the resources, the creator of the resource, | ||
* and the information on whom this resource is shared with. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class ResourceSharing implements ToXContentFragment { | ||
|
||
private String sourceIdx; | ||
|
||
private String resourceId; | ||
|
||
private CreatedBy createdBy; | ||
|
||
private ShareWith shareWith; | ||
|
||
public ResourceSharing(String sourceIdx, String resourceId, CreatedBy createdBy, ShareWith shareWith) { | ||
this.sourceIdx = sourceIdx; | ||
this.resourceId = resourceId; | ||
this.createdBy = createdBy; | ||
this.shareWith = shareWith; | ||
} | ||
|
||
public String getSourceIdx() { | ||
return sourceIdx; | ||
} | ||
|
||
public void setSourceIdx(String sourceIdx) { | ||
this.sourceIdx = sourceIdx; | ||
} | ||
|
||
public String getResourceId() { | ||
return resourceId; | ||
} | ||
|
||
public void setResourceId(String resourceId) { | ||
this.resourceId = resourceId; | ||
} | ||
|
||
public CreatedBy getCreatedBy() { | ||
return createdBy; | ||
} | ||
|
||
public void setCreatedBy(CreatedBy createdBy) { | ||
this.createdBy = createdBy; | ||
} | ||
|
||
public ShareWith getShareWith() { | ||
return shareWith; | ||
} | ||
|
||
public void setShareWith(ShareWith shareWith) { | ||
this.shareWith = shareWith; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ResourceSharing resourceSharing = (ResourceSharing) o; | ||
return Objects.equals(getSourceIdx(), resourceSharing.getSourceIdx()) | ||
&& Objects.equals(getResourceId(), resourceSharing.getResourceId()) | ||
&& Objects.equals(getCreatedBy(), resourceSharing.getCreatedBy()) | ||
&& Objects.equals(getShareWith(), resourceSharing.getShareWith()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(getSourceIdx(), getResourceId(), getCreatedBy(), getShareWith()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Resource {" | ||
+ "sourceIdx='" | ||
+ sourceIdx | ||
+ '\'' | ||
+ ", resourceId='" | ||
+ resourceId | ||
+ '\'' | ||
+ ", createdBy=" | ||
+ createdBy | ||
+ ", sharedWith=" | ||
+ shareWith | ||
+ '}'; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
return builder.startObject() | ||
.field("source_idx", sourceIdx) | ||
.field("resource_id", resourceId) | ||
.field("created_by", createdBy) | ||
.field("share_with", shareWith) | ||
.endObject(); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
server/src/main/java/org/opensearch/accesscontrol/resources/ShareWith.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.accesscontrol.resources; | ||
|
||
import org.opensearch.core.xcontent.ToXContentFragment; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
/** | ||
* This class contains information about whom a resource is shared with. | ||
* It could be a user-name, a role or a backend_role. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class ShareWith implements ToXContentFragment { | ||
|
||
private List<String> users; | ||
|
||
private List<String> roles; | ||
|
||
private List<String> backendRoles; | ||
|
||
public ShareWith(List<String> users, List<String> roles, List<String> backendRoles) { | ||
this.users = users; | ||
this.roles = roles; | ||
this.backendRoles = backendRoles; | ||
} | ||
|
||
public List<String> getUsers() { | ||
return users; | ||
} | ||
|
||
public void setUsers(List<String> users) { | ||
this.users = users; | ||
} | ||
|
||
public List<String> getRoles() { | ||
return roles; | ||
} | ||
|
||
public void setRoles(List<String> roles) { | ||
this.roles = roles; | ||
} | ||
|
||
public List<String> getBackendRoles() { | ||
return backendRoles; | ||
} | ||
|
||
public void setBackendRoles(List<String> backendRoles) { | ||
this.backendRoles = backendRoles; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ShareWith {" + "users=" + users + ", roles=" + roles + ", backendRoles=" + backendRoles + '}'; | ||
} | ||
|
||
@Override | ||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { | ||
return builder.startObject().field("users", users).field("roles", roles).field("backend_roles", backendRoles).endObject(); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
server/src/main/java/org/opensearch/accesscontrol/resources/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
/** | ||
* Actions that OpenSearch can take either on the data stored on disk or on other nodes. | ||
*/ | ||
/* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
/** | ||
* This package defines all classes required for Resource Sharing and Access Control | ||
*/ | ||
package org.opensearch.accesscontrol.resources; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see pushback on introducing these concepts into the core. Is there a way to make this generic and let a plugin define an implementation?