Interface AuthorizationBackend

  • All Known Subinterfaces:
    AuthorizationBackend, SyncAuthorizationBackend
    All Known Implementing Classes:
    InternalAuthenticationBackend, NoOpAuthorizationBackend

    public interface AuthorizationBackend
    Search Guard custom authorization backends need to implement this interface.

    Authorization backends populate a prior authenticated User with backend roles who's the user is a member of.

    Implementation classes must provide a public constructor

    public MyHTTPAuthenticator(org.elasticsearch.common.settings.Settings settings, java.nio.file.Path configPath)

    The constructor should not throw any exception in case of an initialization problem. Instead catch all exceptions and log a appropriate error message. A logger can be instantiated like:

    private final Logger log = LogManager.getLogger(this.getClass());

    Custom authorizers is a commercial feature. To make them work you need to obtain a license here: https://floragunn.com

    • Method Detail

      • getType

        String getType()
        The type (name) of the authorizer. Only for logging.
        Returns:
        the type
      • retrieveRoles

        void retrieveRoles​(User user,
                           AuthCredentials credentials,
                           Consumer<Collection<String>> onSuccess,
                           Consumer<Exception> onFailure)
        Populate a User with backend roles. This method will not be called for cached users.

        Add them by calling either user.addRole() or user.addRoles()

        Parameters:
        user - The authenticated user to populate with backend roles, never null
        credentials - Credentials to authenticate to the authorization backend, maybe null. This parameter is for future usage, currently always empty credentials are passed!
        Throws:
        org.elasticsearch.ElasticsearchSecurityException - in case when the authorization backend cannot be reached or the credentials are insufficient to authenticate to the authorization backend.