Class RestAuthorizer

java.lang.Object
io.confluent.security.auth.client.RestAuthorizer
All Implemented Interfaces:
io.confluent.security.authorizer.Authorizer, Closeable, AutoCloseable, org.apache.kafka.common.Configurable

public class RestAuthorizer extends Object implements io.confluent.security.authorizer.Authorizer
This is the implementation of Authorizer which connects to the given metadata service Urls to perform the operations.

An instance of RestAuthorizer can be instantiated by passing configuration properties like below.

     Mapinvalid input: '<'String, Object> configs = new HashMapinvalid input: '<'>();
     configs.put(RestClientConfig.BOOTSTRAP_METADATA_SERVER_URLS_PROP, "http://localhost:8080");
     Authorizer RestAuthorizer = new RestAuthorizer();
     rbacRestAuthorizer.configure(configs);
 

There are different options available as mentioned in RestClientConfig like

 - RestClientConfig.BOOTSTRAP_METADATA_SERVER_URLS_PROP.
 - RestClientConfig.METADATA_SERVER_URL_MAX_AGE_PROP.
 - RestClientConfig.BASIC_AUTH_CREDENTIALS_PROVIDER_PROP.
 - RestClientConfig.BASIC_AUTH_USER_INFO_PROP.
 
 This can be used to authorize list of Action for a given userPrincipal
 
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    RestAuthorizer(io.confluent.security.auth.client.rest.RestClient restClient)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<io.confluent.security.authorizer.AuthorizeResult>
    authorize(io.confluent.security.auth.client.provider.HttpCredentialProvider credentialProvider, org.apache.kafka.common.security.auth.KafkaPrincipal sessionPrincipal, String host, List<io.confluent.security.authorizer.Action> actions)
     
    List<io.confluent.security.authorizer.AuthorizeResult>
    authorize(io.confluent.security.authorizer.RequestContext requestContext, List<io.confluent.security.authorizer.Action> actions)
     
    List<io.confluent.security.authorizer.AuthorizeResult>
    authorize(org.apache.kafka.common.security.auth.KafkaPrincipal sessionPrincipal, String host, List<io.confluent.security.authorizer.Action> actions)
     
    void
     
    void
    configure(Map<String,?> configs)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.confluent.security.authorizer.Authorizer

    authorize, authorize
  • Constructor Details

    • RestAuthorizer

      public RestAuthorizer()
    • RestAuthorizer

      public RestAuthorizer(io.confluent.security.auth.client.rest.RestClient restClient)
  • Method Details

    • configure

      public void configure(Map<String,?> configs)
      Specified by:
      configure in interface org.apache.kafka.common.Configurable
    • authorize

      public List<io.confluent.security.authorizer.AuthorizeResult> authorize(org.apache.kafka.common.security.auth.KafkaPrincipal sessionPrincipal, String host, List<io.confluent.security.authorizer.Action> actions)
      Specified by:
      authorize in interface io.confluent.security.authorizer.Authorizer
    • authorize

      public List<io.confluent.security.authorizer.AuthorizeResult> authorize(io.confluent.security.authorizer.RequestContext requestContext, List<io.confluent.security.authorizer.Action> actions)
      Specified by:
      authorize in interface io.confluent.security.authorizer.Authorizer
    • authorize

      public List<io.confluent.security.authorizer.AuthorizeResult> authorize(io.confluent.security.auth.client.provider.HttpCredentialProvider credentialProvider, org.apache.kafka.common.security.auth.KafkaPrincipal sessionPrincipal, String host, List<io.confluent.security.authorizer.Action> actions)
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException