/**
  * Hook the client into WP
  *
  * @param \OpenID_Connect_Generic_Client $client
  * @param \WP_Option_Settings $settings
  * @param \WP_Option_Logger $logger
  *
  * @return \OpenID_Connect_Generic_Client_Wrapper
  */
 public static function register(OpenID_Connect_Generic_Client $client, WP_Option_Settings $settings, WP_Option_Logger $logger)
 {
     $client_wrapper = new self($client, $settings, $logger);
     // remove cookies on logout
     add_action('wp_logout', array($client_wrapper, 'wp_logout'));
     // verify legitimacy of user token on admin pages
     add_action('admin_init', array($client_wrapper, 'check_user_token'));
     // alter the requests according to settings
     add_filter('openid-connect-generic-alter-request', array($client_wrapper, 'alter_request'), 10, 3);
     add_filter('http_request_timeout', array($client_wrapper, 'alter_http_request_timeout'));
     if (is_admin()) {
         // use the ajax url to handle processing authorization without any html output
         // this callback will occur when then IDP returns with an authenticated value
         add_action('wp_ajax_openid-connect-authorize', array($client_wrapper, 'authentication_request_callback'));
         add_action('wp_ajax_nopriv_openid-connect-authorize', array($client_wrapper, 'authentication_request_callback'));
     }
     // verify token for any logged in user
     if (is_user_logged_in()) {
         $client_wrapper->check_user_token();
     }
     return $client_wrapper;
 }