Este conteúdo não está disponível no idioma selecionado.
Chapter 9. Configuring User Authorization
Authorization is a security feature that requires users to have certain permissions before they can access caches or interact with Data Grid resources. You assign roles to users that provide different levels of permissions, from read-only access to full, super user privileges.
9.1. Enabling Authorization in Cache Configuration Copiar o linkLink copiado para a área de transferência!
Use authorization in your cache configuration to restrict user access. Before they can read or write cache entries, or create and delete caches, users must have a role with a sufficient level of permission.
Procedure
-
Open your
infinispan.xmlconfiguration for editing. If it is not already declared, add the
<authorization />tag inside thesecurityelements for thecache-container.This enables authorization for the Cache Manager and provides a global set of roles and permissions that caches can inherit.
-
Add the
<authorization />tag to each cache for which Data Grid restricts access based on user roles.
The following configuration example shows how to use implicit authorization configuration with default roles and permissions:
9.2. User Roles and Permissions Copiar o linkLink copiado para a área de transferência!
Data Grid includes a default set of roles that grant users with permissions to access data and interact with Data Grid resources.
ClusterRoleMapper is the default mechanism that Data Grid uses to associate security principals to authorization roles.
ClusterRoleMapper matches principal names to role names. A user named admin gets admin permissions automatically, a user named deployer gets deployer permissions, and so on.
| Role | Permissions | Description |
|---|---|---|
|
| ALL | Superuser with all permissions including control of the Cache Manager lifecycle. |
|
| ALL_READ, ALL_WRITE, LISTEN, EXEC, MONITOR, CREATE |
Can create and delete Data Grid resources in addition to |
|
| ALL_READ, ALL_WRITE, LISTEN, EXEC, MONITOR |
Has read and write access to Data Grid resources in addition to |
|
| ALL_READ, MONITOR |
Has read access to Data Grid resources in addition to |
|
| MONITOR |
Can view statistics via JMX and the |
9.3. How Security Authorization Works Copiar o linkLink copiado para a área de transferência!
Data Grid authorization secures your installation by restricting user access.
User applications or clients must belong to a role that is assigned with sufficient permissions before they can perform operations on Cache Managers or caches.
For example, you configure authorization on a specific cache instance so that invoking Cache.get() requires an identity to be assigned a role with read permission while Cache.put() requires a role with write permission.
In this scenario, if a user application or client with the io role attempts to write an entry, Data Grid denies the request and throws a security exception. If a user application or client with the writer role sends a write request, Data Grid validates authorization and issues a token for subsequent operations.
Identities
Identities are security Principals of type java.security.Principal. Subjects, implemented with the javax.security.auth.Subject class, represent a group of security Principals. In other words, a Subject represents a user and all groups to which it belongs.
Identities to roles
Data Grid uses role mappers so that security principals correspond to roles, which you assign one or more permissions.
The following image illustrates how security principals correspond to roles:
9.3.1. Permissions Copiar o linkLink copiado para a área de transferência!
Authorization roles have different permissions with varying levels of access to Data Grid. Permissions let you restrict user access to both Cache Managers and caches.
9.3.1.1. Cache Manager permissions Copiar o linkLink copiado para a área de transferência!
| Permission | Function | Description |
|---|---|---|
| CONFIGURATION |
| Defines new cache configurations. |
| LISTEN |
| Registers listeners against a Cache Manager. |
| LIFECYCLE |
| Stops the Cache Manager. |
| CREATE |
| Create and remove container resources such as caches, counters, schemas, and scripts. |
| MONITOR |
|
Allows access to JMX statistics and the |
| ALL | - | Includes all Cache Manager permissions. |
9.3.1.2. Cache permissions Copiar o linkLink copiado para a área de transferência!
| Permission | Function | Description |
|---|---|---|
| READ |
| Retrieves entries from a cache. |
| WRITE |
| Writes, replaces, removes, evicts data in a cache. |
| EXEC |
| Allows code execution against a cache. |
| LISTEN |
| Registers listeners against a cache. |
| BULK_READ |
| Executes bulk retrieve operations. |
| BULK_WRITE |
| Executes bulk write operations. |
| LIFECYCLE |
| Starts and stops a cache. |
| ADMIN |
| Allows access to underlying components and internal structures. |
| MONITOR |
|
Allows access to JMX statistics and the |
| ALL | - | Includes all cache permissions. |
| ALL_READ | - | Combines the READ and BULK_READ permissions. |
| ALL_WRITE | - | Combines the WRITE and BULK_WRITE permissions. |
Reference
9.3.2. Role Mappers Copiar o linkLink copiado para a área de transferência!
Data Grid includes a PrincipalRoleMapper API that maps security Principals in a Subject to authorization roles that you can assign to users.
9.3.2.1. Cluster role mappers Copiar o linkLink copiado para a área de transferência!
ClusterRoleMapper uses a persistent replicated cache to dynamically store principal-to-role mappings for the default roles and permissions.
By default uses the Principal name as the role name and implements org.infinispan.security.MutableRoleMapper which exposes methods to change role mappings at runtime.
-
Java class:
org.infinispan.security.mappers.ClusterRoleMapper -
Declarative configuration:
<cluster-role-mapper />
9.3.2.2. Identity role mappers Copiar o linkLink copiado para a área de transferência!
IdentityRoleMapper uses the Principal name as the role name.
-
Java class:
org.infinispan.security.mappers.IdentityRoleMapper -
Declarative configuration:
<identity-role-mapper />
9.3.2.3. CommonName role mappers Copiar o linkLink copiado para a área de transferência!
CommonNameRoleMapper uses the Common Name (CN) as the role name if the Principal name is a Distinguished Name (DN).
For example this DN, cn=managers,ou=people,dc=example,dc=com, maps to the managers role.
-
Java class:
org.infinispan.security.mappers.CommonRoleMapper -
Declarative configuration:
<common-name-role-mapper />
9.3.2.4. Custom role mappers Copiar o linkLink copiado para a área de transferência!
Custom role mappers are implementations of org.infinispan.security.PrincipalRoleMapper.
-
Declarative configuration:
<custom-role-mapper class="my.custom.RoleMapper" />
9.4. Access Control List (ACL) Cache Copiar o linkLink copiado para a área de transferência!
Data Grid caches roles that you grant to users internally for optimal performance. Whenever you grant or deny roles to users, Data Grid flushes the ACL cache to ensure user permissions are applied correctly.
If necessary, you can disable the ACL cache or configure it with the cache-size and cache-timeout attributes.
<security cache-size="1000" cache-timeout="300000"> <authorization /> </security>
<security cache-size="1000" cache-timeout="300000">
<authorization />
</security>
Reference
9.5. Customizing Roles and Permissions Copiar o linkLink copiado para a área de transferência!
You can customize authorization settings in your Data Grid configuration to use role mappers with different combinations of roles and permissions.
Procedure
-
Open your
infinispan.xmlconfiguration for editing. -
Configure authorization for the
cache-containerby declaring a role mapper and a set of roles and permissions. - Configure authorization for caches to restrict access based on user roles.
The following configuration example shows how to configure security authorization with roles and permissions:
9.6. Disabling Security Authorization Copiar o linkLink copiado para a área de transferência!
In local development environments you can disable authorization so that users do not need roles and permissions. Disabling security authorization means that any user can access data and interact with Data Grid resources.
Procedure
-
Open your
infinispan.xmlconfiguration for editing. -
Remove any
authorizationelements from thesecurityconfiguration for thecache-containerand each cache configuration.
9.7. Configuring Authorization with Client Certificates Copiar o linkLink copiado para a área de transferência!
Enabling client certificate authentication means you do not need to specify Data Grid user credentials in client configuration, which means you must associate roles with the Common Name (CN) field in the client certificate(s).
Prerequisites
- Provide clients with a Java keystore that contains either their public certificates or part of the certificate chain, typically a public CA certificate.
- Configure Data Grid Server to perform client certificate authentication.
Procedure
-
Enable the
common-name-role-mapperin the security authorization configuration. Assign the Common Name (
CN) from the client certificate a role with the appropriate permissions.Copy to Clipboard Copied! Toggle word wrap Toggle overflow