request_context = new Request_Context(); $this->request_context->fill_with_global_arrays( $_GET, $_POST, $_SERVER, $_COOKIE, $_REQUEST ); $this->router = new Router(); $this->time = new Time(); $this->view_renderer = new View_Renderer( $this->time ); $this->view_renderer->init(); $this->user = new User( wp_get_current_user()->ID ); $this->options = new Option(); $this->totp_qr_generator = new QR_Generator( $this->get_options() ); $this->totp_format_validator = new Format_Validator(); $this->totp_login_validator = new TOTP_Login_Validator( $this->totp_format_validator ); $this->base32_alphabet = new Base32_Alphabet(); $this->totp_secret_generator = new Secret_Generator( $this->base32_alphabet ); $this->cookie = Cookie::create(); $this->step_token = Step_Token::create(); $this->step_token_validator = Step_Token_Validator::create(); $this->error_factory = new Error_Factory(); $this->hash_generator = new Hash_Generator( new RandomGenerator() ); $this->rate_plugin_prompt = new Rate_Plugin_Prompt( $this->time, $this->user ); $migration_executor = new Migration_Executor( new Migration_List( $this ) ); $this->updater = new Updater( $this->options, $migration_executor ); } /** * @return View_Renderer */ public function get_view_renderer() { return $this->view_renderer; } /** * @param string $totp_secret * * @return Code_Generator */ public function get_totp_code_generator( $totp_secret ) { return new Code_Generator( $totp_secret, $this->get_time(), $this->totp_format_validator, new Single_Code_Generator( Code_Generator::KEY_REGENERATION ), new Base32_Decoder( $this->base32_alphabet ) ); } /** * @param string $totp_secret * * @return Code_Validator */ public function get_totp_code_validator( $totp_secret ) { return new Code_Validator( $this->get_totp_code_generator( $totp_secret ), $this->totp_format_validator ); } /** * @return TOTP_Login_Validator */ public function get_totp_login_validator() { return $this->totp_login_validator; } /** * @return QR_Generator */ public function get_totp_qr_generator() { return $this->totp_qr_generator; } /** * @return Secret_Generator */ public function get_totp_secret_generator() { return $this->totp_secret_generator; } /** * @return User */ public function get_user() { return $this->user; } /** * @return Option */ public function get_options() { return $this->options; } /** * @return Request */ public function get_request() { return $this->request; } /** * @return Cookie */ public function get_cookie() { return $this->cookie; } /** * @param User $user * * @return Trusted_Device_Cookie_Manager */ public function get_trusted_device_cookie_manager( $user ) { return new Trusted_Device_Cookie_Manager( $this, $user ); } /** * @param User $user * * @return Trusted_Device_Manager */ public function get_trusted_device_manager( $user ) { return new Trusted_Device_Manager( $this, $user ); } /** * @return Step_Token */ public function get_step_token() { return $this->step_token; } /** * @return Step_Token_Validator */ public function get_step_token_validator() { return $this->step_token_validator; } /** * @return Time */ public function get_time() { return $this->time; } /** * @return Error_Factory */ public function get_error_factory() { return $this->error_factory; } /** * @return Hash_Generator */ public function get_hash_generator() { return $this->hash_generator; } /** * @return Rate_Plugin_Prompt */ public function get_rate_plugin_prompt() { return $this->rate_plugin_prompt; } /** * @return Updater */ public function get_updater() { return $this->updater; } abstract public function run(); }