-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement new extension points in IdentityPlugin and add ContextProvi…
…dingPluginSubject (#4896) Signed-off-by: Craig Perkins <[email protected]>
- Loading branch information
Showing
33 changed files
with
1,424 additions
and
64 deletions.
There are no files selected for viewing
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
27 changes: 0 additions & 27 deletions
27
src/integrationTest/java/org/opensearch/security/http/ExampleSystemIndexPlugin.java
This file was deleted.
Oops, something went wrong.
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
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
22 changes: 22 additions & 0 deletions
22
.../org/opensearch/security/systemindex/sampleplugin/IndexDocumentIntoSystemIndexAction.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,22 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* 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.security.systemindex.sampleplugin; | ||
|
||
import org.opensearch.action.ActionType; | ||
|
||
public class IndexDocumentIntoSystemIndexAction extends ActionType<IndexDocumentIntoSystemIndexResponse> { | ||
public static final IndexDocumentIntoSystemIndexAction INSTANCE = new IndexDocumentIntoSystemIndexAction(); | ||
public static final String NAME = "cluster:mock/systemindex/index"; | ||
|
||
private IndexDocumentIntoSystemIndexAction() { | ||
super(NAME, IndexDocumentIntoSystemIndexResponse::new); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...org/opensearch/security/systemindex/sampleplugin/IndexDocumentIntoSystemIndexRequest.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,48 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* 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.security.systemindex.sampleplugin; | ||
|
||
import java.io.IOException; | ||
|
||
import org.opensearch.action.ActionRequest; | ||
import org.opensearch.action.ActionRequestValidationException; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
|
||
public class IndexDocumentIntoSystemIndexRequest extends ActionRequest { | ||
|
||
private final String indexName; | ||
|
||
private final String runAs; | ||
|
||
public IndexDocumentIntoSystemIndexRequest(String indexName, String runAs) { | ||
this.indexName = indexName; | ||
this.runAs = runAs; | ||
} | ||
|
||
public IndexDocumentIntoSystemIndexRequest(StreamInput in) throws IOException { | ||
super(in); | ||
this.indexName = in.readString(); | ||
this.runAs = in.readOptionalString(); | ||
} | ||
|
||
@Override | ||
public ActionRequestValidationException validate() { | ||
return null; | ||
} | ||
|
||
public String getIndexName() { | ||
return this.indexName; | ||
} | ||
|
||
public String getRunAs() { | ||
return this.runAs; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...rg/opensearch/security/systemindex/sampleplugin/IndexDocumentIntoSystemIndexResponse.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,48 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* 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.security.systemindex.sampleplugin; | ||
|
||
// CS-SUPPRESS-SINGLE: RegexpSingleline It is not possible to use phrase "cluster manager" instead of master here | ||
import java.io.IOException; | ||
|
||
import org.opensearch.action.support.master.AcknowledgedResponse; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.StreamOutput; | ||
import org.opensearch.core.xcontent.ToXContent; | ||
import org.opensearch.core.xcontent.ToXContentObject; | ||
import org.opensearch.core.xcontent.XContentBuilder; | ||
// CS-ENFORCE-SINGLE | ||
|
||
public class IndexDocumentIntoSystemIndexResponse extends AcknowledgedResponse implements ToXContentObject { | ||
|
||
private String plugin; | ||
|
||
public IndexDocumentIntoSystemIndexResponse(boolean status, String plugin) { | ||
super(status); | ||
this.plugin = plugin; | ||
} | ||
|
||
public IndexDocumentIntoSystemIndexResponse(StreamInput in) throws IOException { | ||
super(in); | ||
} | ||
|
||
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
super.writeTo(out); | ||
out.writeString(plugin); | ||
} | ||
|
||
@Override | ||
public void addCustomFields(XContentBuilder builder, ToXContent.Params params) throws IOException { | ||
super.addCustomFields(builder, params); | ||
builder.field("plugin", plugin); | ||
} | ||
} |
Oops, something went wrong.