Search in sources :

Example 1 with JMXResource

use of org.apache.cassandra.auth.JMXResource in project cassandra by apache.

the class InvalidateJmxPermissionsCacheTest method setup.

@BeforeClass
public static void setup() throws Exception {
    CQLTester.setUpClass();
    CQLTester.requireAuthentication();
    IRoleManager roleManager = DatabaseDescriptor.getRoleManager();
    roleManager.createRole(AuthenticatedUser.SYSTEM_USER, ROLE_A, AuthTestUtils.getLoginRoleOptions());
    roleManager.createRole(AuthenticatedUser.SYSTEM_USER, ROLE_B, AuthTestUtils.getLoginRoleOptions());
    JMXResource rootJmxResource = JMXResource.root();
    Set<Permission> jmxPermissions = rootJmxResource.applicablePermissions();
    IAuthorizer authorizer = DatabaseDescriptor.getAuthorizer();
    authorizer.grant(AuthenticatedUser.SYSTEM_USER, jmxPermissions, rootJmxResource, ROLE_A);
    authorizer.grant(AuthenticatedUser.SYSTEM_USER, jmxPermissions, rootJmxResource, ROLE_B);
    AuthCacheService.initializeAndRegisterCaches();
    startJMXServer();
}
Also used : IRoleManager(org.apache.cassandra.auth.IRoleManager) IAuthorizer(org.apache.cassandra.auth.IAuthorizer) Permission(org.apache.cassandra.auth.Permission) JMXResource(org.apache.cassandra.auth.JMXResource) BeforeClass(org.junit.BeforeClass)

Aggregations

IAuthorizer (org.apache.cassandra.auth.IAuthorizer)1 IRoleManager (org.apache.cassandra.auth.IRoleManager)1 JMXResource (org.apache.cassandra.auth.JMXResource)1 Permission (org.apache.cassandra.auth.Permission)1 BeforeClass (org.junit.BeforeClass)1