public static void setup ( ) { if ( DatabaseDescriptor . getAuthenticator ( ) instanceof AllowAllAuthenticator ) return ; setupAuthKeyspace ( ) ; setupTable ( USERS_CF , USERS_CF_SCHEMA ) ; DatabaseDescriptor . getAuthenticator ( ) . setup ( ) ; DatabaseDescriptor . getAuthorizer ( ) . setup ( ) ; // register a custom MigrationListener for permissions cleanup after dropped keyspaces/cfs. MigrationManager . instance . register ( new AuthMigrationListener ( ) ) ; // the delay is here to give the node some time to see its peers - to reduce // "Skipped default superuser setup: some nodes were not ready" log spam. // It's the only reason for the delay. ScheduledExecutors . nonPeriodicTasks . schedule ( new Runnable ( ) { public void run ( ) { setupDefaultSuperuser ( ) ; } } , SUPERUSER_SETUP_DELAY , TimeUnit . MILLISECONDS ) ; try { String query = String . format ( "SELECT * FROM %s.%s WHERE name = ?" , AUTH_KS , USERS_CF ) ; selectUserStatement = ( SelectStatement ) QueryProcessor . parseStatement ( query ) . prepare ( ) . statement ; } catch ( RequestValidationException e ) { throw new AssertionError ( e ) ; // not supposed to happen } }
Sets up Authenticator and Authorizer .