OAuth2Filter::OAuth2Filter(FilterConfigSharedPtr config,
                           std::unique_ptr<OAuth2Client>&& oauth_client, TimeSource& time_source)
    : validator_(std::make_shared<OAuth2CookieValidator>(time_source, config->cookieNames())),
      oauth_client_(std::move(oauth_client)), config_(std::move(config)),
      time_source_(time_source) {

  oauth_client_->setCallbacks(*this);
}
OAuth2Filter::OAuth2Filter(FilterConfigSharedPtr config,
                           std::unique_ptr<OAuth2Client>&& oauth_client, TimeSource& time_source)
    : validator_(std::make_shared<OAuth2CookieValidator>(time_source, config->cookieNames())),
      oauth_client_(std::move(oauth_client)), config_(std::move(config)),
      time_source_(time_source) {

  oauth_client_->setCallbacks(*this);
}