@Deprecated
public class KeycloakRBACAuthorizer
extends java.lang.Object
implements org.apache.kafka.server.authorizer.Authorizer
OAuthKafkaPrincipalBuilder to be configured as
'principal.builder.class' in 'server.properties' file.
To install this authorizer in Kafka, specify the following in your 'server.properties':
authorizer.class.name=io.strimzi.kafka.oauth.server.authorizer.KeycloakRBACAuthorizer
principal.builder.class=io.strimzi.kafka.oauth.server.OAuthKafkaPrincipalBuilder
This authorizer only supports Kafka running in 'zookeeper' mode. It does not support 'KRaft' mode.
There is a KeycloakAuthorizer class that auto-detects the environment and works both in 'KRaft' and 'zookeeper' mode,
that should be used instead of this class.
There is additional configuration that needs to be specified in order for this authorizer to work.
Note: The following configuration keys can be specified as properties in Kafka `server.properties` file, or as ENV vars in which case an all-uppercase key name is also attempted with '.' replaced by '_' (e.g. STRIMZI_AUTHORIZATION_TOKEN_ENDPOINT_URI). They can also be specified as system properties. The priority is in reverse - system property overrides the ENV var, which overrides `server.properties`.
Required configuration:
https://keycloak:8443/auth/realms/master/protocol/openid-connect/token).Optional configuration:
TLS configuration:
This authorizer honors the super.users configuration. Super users are automatically granted any authorization request.
| Constructor and Description |
|---|
KeycloakRBACAuthorizer()
Deprecated.
Create a new instance
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Iterable<org.apache.kafka.common.acl.AclBinding> |
acls(org.apache.kafka.common.acl.AclBindingFilter filter)
Deprecated.
|
java.util.List<org.apache.kafka.server.authorizer.AuthorizationResult> |
authorize(org.apache.kafka.server.authorizer.AuthorizableRequestContext requestContext,
java.util.List<org.apache.kafka.server.authorizer.Action> actions)
Deprecated.
The method that makes the authorization decision.
|
void |
close()
Deprecated.
|
void |
configure(java.util.Map<java.lang.String,?> configs)
Deprecated.
|
java.util.List<? extends java.util.concurrent.CompletionStage<org.apache.kafka.server.authorizer.AclCreateResult>> |
createAcls(org.apache.kafka.server.authorizer.AuthorizableRequestContext requestContext,
java.util.List<org.apache.kafka.common.acl.AclBinding> aclBindings)
Deprecated.
|
java.util.List<? extends java.util.concurrent.CompletionStage<org.apache.kafka.server.authorizer.AclDeleteResult>> |
deleteAcls(org.apache.kafka.server.authorizer.AuthorizableRequestContext requestContext,
java.util.List<org.apache.kafka.common.acl.AclBindingFilter> aclBindingFilters)
Deprecated.
|
java.util.Map<org.apache.kafka.common.Endpoint,? extends java.util.concurrent.CompletionStage<java.lang.Void>> |
start(org.apache.kafka.server.authorizer.AuthorizerServerInfo serverInfo)
Deprecated.
|
java.lang.String |
toString()
Deprecated.
|
public KeycloakRBACAuthorizer()
public void configure(java.util.Map<java.lang.String,?> configs)
configure in interface org.apache.kafka.common.Configurablepublic java.util.List<org.apache.kafka.server.authorizer.AuthorizationResult> authorize(org.apache.kafka.server.authorizer.AuthorizableRequestContext requestContext,
java.util.List<org.apache.kafka.server.authorizer.Action> actions)
We assume authorize() is thread-safe in a sense that there will not be two concurrent threads calling it at the same time for the same session.
Should that not be the case, the side effect could be to make more calls to token endpoint than necessary. Other than that it should not affect proper functioning of this authorizer.
authorize in interface org.apache.kafka.server.authorizer.AuthorizerrequestContext - Request context including request type, security protocol and listener nameactions - Actions being authorized including resource and operation for each actionpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic java.util.Map<org.apache.kafka.common.Endpoint,? extends java.util.concurrent.CompletionStage<java.lang.Void>> start(org.apache.kafka.server.authorizer.AuthorizerServerInfo serverInfo)
start in interface org.apache.kafka.server.authorizer.Authorizerpublic java.util.List<? extends java.util.concurrent.CompletionStage<org.apache.kafka.server.authorizer.AclCreateResult>> createAcls(org.apache.kafka.server.authorizer.AuthorizableRequestContext requestContext,
java.util.List<org.apache.kafka.common.acl.AclBinding> aclBindings)
createAcls in interface org.apache.kafka.server.authorizer.Authorizerpublic java.util.List<? extends java.util.concurrent.CompletionStage<org.apache.kafka.server.authorizer.AclDeleteResult>> deleteAcls(org.apache.kafka.server.authorizer.AuthorizableRequestContext requestContext,
java.util.List<org.apache.kafka.common.acl.AclBindingFilter> aclBindingFilters)
deleteAcls in interface org.apache.kafka.server.authorizer.Authorizerpublic java.lang.Iterable<org.apache.kafka.common.acl.AclBinding> acls(org.apache.kafka.common.acl.AclBindingFilter filter)
acls in interface org.apache.kafka.server.authorizer.Authorizerpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2023. All rights reserved.