|
| 1 | +:_mod-docs-content-type: CONCEPT |
| 2 | + |
| 3 | +// Module included in the following assemblies: |
| 4 | +// |
| 5 | +// assembly-config.adoc |
| 6 | + |
| 7 | +[id='con-kafka-authorization-{context}'] |
| 8 | += Configuring authorization |
| 9 | + |
| 10 | +[role="_abstract"] |
| 11 | +Control what authenticated clients can do in a Kafka cluster by enabling authorization on Kafka brokers. |
| 12 | +Authorization is configured in the `Kafka` custom resource and enforced by the Kafka broker. |
| 13 | + |
| 14 | +Authorization is separate from listener authentication. |
| 15 | +Authentication verifies a client identity. |
| 16 | +Authorization controls which operations the client is allowed to perform. |
| 17 | + |
| 18 | +Kafka supports the following authorization types: |
| 19 | + |
| 20 | +* `simple` |
| 21 | +* `custom` |
| 22 | + |
| 23 | +The `simple` authorization type uses the Kafka `StandardAuthorizer` plugin. |
| 24 | + |
| 25 | +The following examples show how to enable authorization on Kafka brokers. |
| 26 | + |
| 27 | +== Enabling simple authorization |
| 28 | + |
| 29 | +Simple authorization enables ACL-based access control using Kafka’s built-in authorizer. |
| 30 | + |
| 31 | +[source,yaml,subs="+attributes"] |
| 32 | +---- |
| 33 | +spec: |
| 34 | + kafka: |
| 35 | + # Authorization (optional) |
| 36 | + authorization: |
| 37 | + type: simple |
| 38 | +---- |
| 39 | + |
| 40 | +* `spec.kafka.authorization.type: simple` enables ACL-based authorization using the Kafka `StandardAuthorizer`. |
| 41 | +* Access to Kafka resources is controlled using ACL rules. |
| 42 | + |
| 43 | +== Configuring super users |
| 44 | + |
| 45 | +You can define super users that are allowed to perform all operations, regardless of ACL rules. |
| 46 | +Use super users for Kafka administrator identities and internal components that must always be able to operate. |
| 47 | + |
| 48 | +[source,yaml,subs="+attributes"] |
| 49 | +---- |
| 50 | +spec: |
| 51 | + kafka: |
| 52 | + # Authorization (optional) |
| 53 | + authorization: |
| 54 | + type: simple |
| 55 | + superUsers: |
| 56 | + - CN=kafka-admin |
| 57 | + - my-team-admin |
| 58 | +---- |
| 59 | + |
| 60 | +* `spec.kafka.authorization.superUsers` defines super user identities. |
| 61 | +* The identity format must match the principal used by your authentication mechanism. |
| 62 | + |
| 63 | +The `CN=` prefix shown in the example applies to mTLS authentication, where the principal is derived from the certificate subject. |
| 64 | +Other authentication mechanisms, such as SASL-based authentication, use different principal formats. |
| 65 | + |
| 66 | +== Enabling custom authorization |
| 67 | + |
| 68 | +Custom authorization allows the use of a custom authorizer implementation. |
| 69 | +Use custom authorization when you need to integrate Kafka with an external authorization system. |
| 70 | + |
| 71 | +[source,yaml,subs="+attributes"] |
| 72 | +---- |
| 73 | +spec: |
| 74 | + kafka: |
| 75 | + # Authorization (optional) |
| 76 | + authorization: |
| 77 | + type: custom |
| 78 | + authorizerClass: com.example.CustomAuthorizer |
| 79 | +---- |
| 80 | + |
| 81 | +* `spec.kafka.authorization.type: custom` enables a custom authorization implementation. |
| 82 | +* `spec.kafka.authorization.authorizerClass` specifies the fully qualified class name of the custom authorizer. |
| 83 | + |
| 84 | +Authorization configuration enables enforcement of access control on the Kafka broker. |
| 85 | +User identities, credentials, and ACL rules are configured separately. |
| 86 | + |
| 87 | +For step-by-step procedures and examples for configuring authorized access, see |
| 88 | +xref:assembly-securing-access-{context}[Securing access to a Kafka cluster]. |
| 89 | + |
| 90 | +For details of authorization configuration options, see the |
| 91 | +link:{BookURLConfiguring}#type-Kafka-authorization-simple-reference[`KafkaAuthorizationSimple` schema reference^] and |
| 92 | +link:{BookURLConfiguring}#type-Kafka-authorization-custom-reference[`KafkaAuthorizationCustom` schema reference^]. |
0 commit comments