Search in sources :

Example 1 with AuthSchemaChangeListener

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

the class StorageService method doAuthSetup.

private void doAuthSetup() {
    maybeAddOrUpdateKeyspace(AuthKeyspace.metadata());
    DatabaseDescriptor.getRoleManager().setup();
    DatabaseDescriptor.getAuthenticator().setup();
    DatabaseDescriptor.getAuthorizer().setup();
    Schema.instance.registerListener(new AuthSchemaChangeListener());
    authSetupComplete = true;
}
Also used : AuthSchemaChangeListener(org.apache.cassandra.auth.AuthSchemaChangeListener)

Example 2 with AuthSchemaChangeListener

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

the class StorageService method doAuthSetup.

@VisibleForTesting
public void doAuthSetup(boolean setUpSchema) {
    if (!authSetupCalled.getAndSet(true)) {
        if (setUpSchema) {
            Optional<Mutation> mutation = evolveSystemKeyspace(AuthKeyspace.metadata(), AuthKeyspace.GENERATION);
            mutation.ifPresent(value -> FBUtilities.waitOnFuture(MigrationManager.announceWithoutPush(Collections.singleton(value))));
        }
        DatabaseDescriptor.getRoleManager().setup();
        DatabaseDescriptor.getAuthenticator().setup();
        DatabaseDescriptor.getAuthorizer().setup();
        DatabaseDescriptor.getNetworkAuthorizer().setup();
        AuthCacheService.initializeAndRegisterCaches();
        Schema.instance.registerListener(new AuthSchemaChangeListener());
        authSetupComplete = true;
    }
}
Also used : AuthSchemaChangeListener(org.apache.cassandra.auth.AuthSchemaChangeListener) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 3 with AuthSchemaChangeListener

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

the class CQLTester method requireAuthentication.

protected static void requireAuthentication() {
    DatabaseDescriptor.setAuthenticator(new AuthTestUtils.LocalPasswordAuthenticator());
    DatabaseDescriptor.setAuthorizer(new AuthTestUtils.LocalCassandraAuthorizer());
    DatabaseDescriptor.setNetworkAuthorizer(new AuthTestUtils.LocalCassandraNetworkAuthorizer());
    // The CassandraRoleManager constructor set the supported and alterable options based on
    // DatabaseDescriptor authenticator type so it needs to be created only after the authenticator is set.
    IRoleManager roleManager = new AuthTestUtils.LocalCassandraRoleManager() {

        public void setup() {
            loadRoleStatement();
            QueryProcessor.executeInternal(createDefaultRoleQuery());
        }
    };
    DatabaseDescriptor.setRoleManager(roleManager);
    MigrationManager.announceNewKeyspace(AuthKeyspace.metadata(), true);
    DatabaseDescriptor.getRoleManager().setup();
    DatabaseDescriptor.getAuthenticator().setup();
    DatabaseDescriptor.getAuthorizer().setup();
    DatabaseDescriptor.getNetworkAuthorizer().setup();
    Schema.instance.registerListener(new AuthSchemaChangeListener());
    AuthCacheService.initializeAndRegisterCaches();
}
Also used : AuthSchemaChangeListener(org.apache.cassandra.auth.AuthSchemaChangeListener) IRoleManager(org.apache.cassandra.auth.IRoleManager) AuthTestUtils(org.apache.cassandra.auth.AuthTestUtils)

Example 4 with AuthSchemaChangeListener

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

the class SchemaLoader method setupAuth.

public static void setupAuth(IRoleManager roleManager, IAuthenticator authenticator, IAuthorizer authorizer, INetworkAuthorizer networkAuthorizer) {
    DatabaseDescriptor.setRoleManager(roleManager);
    DatabaseDescriptor.setAuthenticator(authenticator);
    DatabaseDescriptor.setAuthorizer(authorizer);
    DatabaseDescriptor.setNetworkAuthorizer(networkAuthorizer);
    MigrationManager.announceNewKeyspace(AuthKeyspace.metadata(), true);
    DatabaseDescriptor.getRoleManager().setup();
    DatabaseDescriptor.getAuthenticator().setup();
    DatabaseDescriptor.getAuthorizer().setup();
    DatabaseDescriptor.getNetworkAuthorizer().setup();
    Schema.instance.registerListener(new AuthSchemaChangeListener());
}
Also used : AuthSchemaChangeListener(org.apache.cassandra.auth.AuthSchemaChangeListener)

Aggregations

AuthSchemaChangeListener (org.apache.cassandra.auth.AuthSchemaChangeListener)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 AuthTestUtils (org.apache.cassandra.auth.AuthTestUtils)1 IRoleManager (org.apache.cassandra.auth.IRoleManager)1