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;
}
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;
}
}
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();
}
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());
}
Aggregations