-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Allow authorization engines as an extension #37785
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
Changes from 2 commits
3912ecd
73fa5ad
f561192
a82db80
d1d8a86
741375d
39d651b
8b27e9f
e8fe606
9e149f1
3de2f0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| [role="xpack"] | ||
| [[custom-authorization]] | ||
| === Customizing authorization | ||
|
|
||
| If the authorization system that is provided by the {es} {security-features} | ||
| does not meet your needs, the authorization system can be overridden for users | ||
| other than the reserved and internal users. You do this by implementing an | ||
| authorization engine as an SPI loaded security extension that is part of an | ||
| ordinary elasticsearch plugin. | ||
|
|
||
| [[implementing-authorization-engine]] | ||
| ==== Implementing an authorization engine | ||
|
|
||
| Sample code that illustrates the structure and implementation of a custom | ||
| authorization engine is provided in the | ||
| https://github.com/elastic/elasticsearch/tree/master/x-pack/qa/security-example-authorization-engine[elasticsearch] | ||
| repository on GitHub. You can use this code as a starting point for creating your | ||
| own authorization engine. | ||
|
|
||
| To create an authorization engine, you need to: | ||
|
|
||
| . Implement the `org.elasticsearch.xpack.core.security.authz.AuthorizationEngine` | ||
| interface in a class with the desired authorization behavior. | ||
| . Implement the `org.elasticsearch.xpack.core.security.authz.Authorization.AuthorizationInfo` | ||
| interface in a class that contains the necessary information to authorize the request. | ||
|
|
||
| To package your authorization engine as a plugin: | ||
|
|
||
| . Implement a plugin class that extends `org.elasticsearch.plugins.Plugin` | ||
| . Implement an extension class for your authorization engine that extends | ||
| `org.elasticsearch.xpack.core.security.SecurityExtension`. There you need to | ||
| override the following method: | ||
| + | ||
| [source,java] | ||
| ---------------------------------------------------- | ||
| @Override | ||
| public AuthorizationEngine getAuthorizationEngine(Settings settings) { | ||
| ... | ||
| } | ||
| ---------------------------------------------------- | ||
| + | ||
| The `getAuthorizationEngine` method is used to provide the authorization engine | ||
| implementation. | ||
|
|
||
| . Create a build configuration file for the plugin; Gradle is our recommendation. | ||
| . Create a `plugin-descriptor.properties` file as described in the | ||
| <<plugin-authors,plugin authors>> section. | ||
| . Create a `META-INF/services/org.elasticsearch.xpack.core.security.SecurityExtension` descriptor file for the | ||
| extension that contains the fully qualified class name of your `org.elasticsearch.xpack.core.security.SecurityExtension` implementation | ||
| . Bundle all in a single zip file. | ||
|
|
||
| [[using-authorization-engine]] | ||
| ==== Using an authorization engine | ||
|
|
||
| To use an authorization engine: | ||
|
|
||
| . Install the authorization engine extension on each node in the cluster. You run | ||
| `bin/elasticsearch-plugin` with the `install` sub-command and specify the URL | ||
| pointing to the zip file that contains the extension. For example: | ||
| + | ||
| [source,shell] | ||
| ---------------------------------------- | ||
| bin/elasticsearch-plugin install file:///<path>/my-authorization-engine-1.0.zip | ||
| ---------------------------------------- | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this example a repetition of the one below on purpose? If there's a different example we could use, I think that would be more helpful.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that was an oops |
||
|
|
||
| . Restart Elasticsearch. | ||
Uh oh!
There was an error while loading. Please reload this page.