Schema Registry authorization
Ranger policies control which Schema Registry operations each user can perform and determine what is visible in Cloudera Surveyor.
Authorization model
A Ranger policy for Schema Registry specifies a resource, a set of permitted operations, and the principals the policy applies to. A principal is a user's Cloudera Anywhere Cloud Console login username. An administrator configures these policies in the Schema Registry Ranger service to define who can access which schema resources and what they can do with them.
Schema Registry enforces these policies for every access request. When a Kafka client using the Cloudera SerDes classes, Cloudera Surveyor, or a direct API caller attempts an operation such as reading or registering a schema, Schema Registry evaluates the request against the policies in the Schema Registry Ranger service. If a matching allow policy exists for the requesting principal, the request proceeds. If no matching policy exists, the request is denied.
Cloudera Surveyor access and Schema Registry authorization
When you use Cloudera Surveyor to work with schemas, the Schema Registry Ranger policies for the user who is logged in to Cloudera Surveyor apply. There is no separate Cloudera Surveyor authorization configuration for Schema Registry. Those policies define what that user can see and do in the schema views.
Ranger permissions affect Cloudera Surveyor in two distinct ways:
- Visibility: Read permission on a schema controls whether that schema appears in Cloudera Surveyor. Schemas the user is not authorized to read are filtered from view.
- Management actions: Create, Update, and Delete on the relevant Schema Registry resources control whether the user can perform schema management actions in Cloudera Surveyor, such as adding schemas, registering versions, or changing version state. Schema Registry enforces authorization when Cloudera Surveyor submits the request. Create actions also require Read permission.
Programmatic clients and principals
The primary path for programmatic Schema Registry access is integrating your Kafka producer or consumer with Schema Registry using the Cloudera-provided SerDes classes. The SerDes classes include an embedded Schema Registry client that handles schema registration and lookup automatically as your application produces and consumes messages.
The embedded Schema Registry client establishes its own separate connection to Schema Registry and authenticates independently using OAuth credentials. OAuth credentials provisioned through Cloudera Anywhere Cloud Console are permanently bound to the Cloudera Anywhere Cloud Console user who requested them. In a typical setup, both connections use the same credentials. In this case, Ranger evaluates Schema Registry requests against the same principal as the Kafka connection.
Because both connections authenticate as the same principal, the Ranger policies you configure for that principal must cover both Kafka and Schema Registry operations. To limit an application to a controlled set of Schema Registry permissions, use a dedicated Cloudera Anywhere Cloud Console account, configure the appropriate Schema Registry Ranger policies for it, and provision credentials as that account.
Schema Registry resources and Ranger permissions
Ranger controls Schema Registry access through four resource types, each with the same set of Create, Read, Update, and Delete permissions that control which operations a principal can perform.
The Schema Registry resources are as follows:
- Schema Registry Service
- Schema Group
- Serializer/Deserializer
- Export/Import Schemas
For each resource, a set of permissions controls which operations principals can perform. A user can access Schema Registry in two ways: directly, or through Cloudera Surveyor. Direct access includes Kafka producers and consumers that use the Cloudera SerDes classes, as well as any other application, script, or tool that calls the Schema Registry API. The tables in the following sections describe both. The Schema Registry access column describes what a permission allows for direct access, and the Cloudera Surveyor access column describes what it allows in the Cloudera Surveyor UI.
Schema Registry Service permissions
The Schema Registry Service resource represents the entire registry instance and only
accepts a wildcard (*) value. A policy on this resource has the same effect
as granting that permission on every other resource.
| Permission | Schema Registry access | Cloudera Surveyor access |
|---|---|---|
| Create | Register schemas, schema versions, schema branches, and serializers or deserializers; import schemas | Can add schemas and add schema versions |
| Read | Read all schemas, schema versions, schema branches, and serializers or deserializers; export schemas | All schemas appear in the schema list; schema details pages, version lists, and schema text are accessible |
| Update | Update schema properties and version states; upload serializer or deserializer implementation jars | Can enable, disable, and archive schema versions |
| Delete | Delete schemas, schema branches, and schema versions | No effect |
Schema Group permissions
The Schema Group resource controls access to individual schemas or sets of schemas. In Schema Registry, a schema group is a property of a schema, similar to a tag. Ranger uses this property as the top level of a hierarchy, so a group works like a container for all schemas that have the same group. The group does not exist on its own. It appears when the first schema with that group is registered.
A policy on this resource specifies four values, from top to bottom: Schema Group, Schema Name, Schema Branch, and Schema Version. A group contains schemas, a schema contains branches, and a branch contains versions. A policy always specifies all four values.
Schema Version only accepts a wildcard (*) value, so access cannot be
restricted to individual versions of a schema.
Because a policy specifies all four values, it covers each matching schema together with its branches and versions. For example, Delete covers deleting a schema along with its versions and branches, and Read covers reading a schema's properties and its schema text.
| Permission | Schema Registry access | Cloudera Surveyor access |
|---|---|---|
| Create | Register new schemas, add schema versions, and create schema branches | Can add schemas and add schema versions |
| Read | Read schema properties, schema versions, schema text, and schema branches | Schemas appear in the schema list; schema details pages, version lists, and schema text are accessible |
| Update | Update schema properties such as description and compatibility setting; change the state of a schema version (enable, disable, archive) | Can enable, disable, and archive schema versions |
| Delete | Delete schemas, schema versions, and schema branches | No effect |
Serializer/Deserializer permissions
The Serializer/Deserializer resource controls registering and uploading custom serializer
and deserializer implementations. It only accepts a wildcard (*) value.
These permissions have no effect in Cloudera Surveyor.
| Permission | Schema Registry access | Cloudera Surveyor access |
|---|---|---|
| Create | Register a serializer or deserializer | No effect |
| Read | Read serializer or deserializer information | No effect |
| Update | Upload a serializer or deserializer implementation jar | No effect |
| Delete | No effect | No effect |
Export/Import Schemas permissions
The Export/Import Schemas resource controls exporting and importing schemas in bulk. It
only accepts a wildcard (*) value. These permissions have no effect in Cloudera Surveyor.
| Permission | Schema Registry access | Cloudera Surveyor access |
|---|---|---|
| Create | Import schemas | No effect |
| Read | No effect | No effect |
| Update | No effect | No effect |
| Delete | No effect | No effect |
