@@ -74,7 +74,8 @@ void TestAutoRefreshingTokenValidRequest(
7474 std::function<authentication::TokenResponse (
7575 const authentication::AutoRefreshingToken& auto_token)>
7676 func) {
77- auto token_response = func (token_endpoint.RequestAutoRefreshingToken ());
77+ auto token_response =
78+ func (authentication::AutoRefreshingToken (token_endpoint, {}));
7879 ASSERT_TRUE (token_response);
7980 EXPECT_GT (token_response.GetResult ().GetAccessToken ().length (), 42u );
8081 EXPECT_GT (token_response.GetResult ().GetExpiryTime (), time (nullptr ));
@@ -90,7 +91,8 @@ void TestAutoRefreshingTokenInvalidRequest(
9091 olp::client::OlpClientSettingsFactory::CreateDefaultTaskScheduler ();
9192 settings.network_request_handler = network;
9293 auto bad_token_endpoint = authentication::TokenEndpoint (settings);
93- auto token_response = func (bad_token_endpoint.RequestAutoRefreshingToken ());
94+ auto token_response =
95+ func (authentication::AutoRefreshingToken (bad_token_endpoint, {}));
9496 ASSERT_FALSE (token_response);
9597 EXPECT_EQ (token_response.GetError ().GetHttpStatusCode (),
9698 olp::http::HttpStatusCode::UNAUTHORIZED);
@@ -102,7 +104,7 @@ void TestAutoRefreshingTokenReuseToken(
102104 std::function<authentication::TokenResponse (
103105 const authentication::AutoRefreshingToken& auto_token)>
104106 func) {
105- auto auto_token = token_endpoint. RequestAutoRefreshingToken ( );
107+ auto auto_token = authentication::AutoRefreshingToken (token_endpoint, {} );
106108 auto token_response_one = func (auto_token);
107109 auto token_response_two = func (auto_token);
108110 EXPECT_EQ (token_response_one.GetResult ().GetAccessToken (),
@@ -117,7 +119,7 @@ void TestAutoRefreshingTokenForceRefresh(
117119 const authentication::AutoRefreshingToken& auto_token,
118120 const std::chrono::seconds minimum_validity)>
119121 func) {
120- auto auto_token = token_endpoint. RequestAutoRefreshingToken ( );
122+ auto auto_token = authentication::AutoRefreshingToken (token_endpoint, {} );
121123 auto token_response_one = func (auto_token, std::chrono::minutes (5 ));
122124 auto token_response_two = func (auto_token, authentication::kForceRefresh );
123125
@@ -130,8 +132,8 @@ void TestAutoRefreshingTokenExpiresInRefresh(
130132 std::function<authentication::TokenResponse (
131133 const authentication::AutoRefreshingToken& auto_token)>
132134 func) {
133- auto auto_token = token_endpoint. RequestAutoRefreshingToken (
134- authentication::TokenRequest{std::chrono::seconds (302 )});
135+ auto auto_token = authentication::AutoRefreshingToken (
136+ token_endpoint, authentication::TokenRequest{std::chrono::seconds (302 )});
135137 auto token_response_one = func (auto_token);
136138 std::this_thread::sleep_for (std::chrono::seconds (4 ));
137139 auto token_response_two = func (auto_token);
@@ -147,8 +149,8 @@ void TestAutoRefreshingTokenExpiresDoNotRefresh(
147149 std::function<authentication::TokenResponse (
148150 const authentication::AutoRefreshingToken& auto_token)>
149151 func) {
150- auto auto_token = token_endpoint. RequestAutoRefreshingToken (
151- authentication::TokenRequest{std::chrono::seconds (305 )});
152+ auto auto_token = authentication::AutoRefreshingToken (
153+ token_endpoint, authentication::TokenRequest{std::chrono::seconds (305 )});
152154 auto token_response_one = func (auto_token);
153155 std::this_thread::sleep_for (std::chrono::seconds (2 ));
154156 auto token_response_two = func (auto_token);
@@ -165,7 +167,8 @@ void TestAutoRefreshingTokenExpiresDoRefresh(
165167 const authentication::AutoRefreshingToken& auto_token,
166168 const std::chrono::seconds minimum_validity)>
167169 func) {
168- auto auto_token = token_endpoint.RequestAutoRefreshingToken (
170+ auto auto_token = authentication::AutoRefreshingToken (
171+ token_endpoint,
169172 authentication::TokenRequest{std::chrono::seconds (1 )}); // 1 second
170173 auto token_response_one =
171174 func (auto_token, std::chrono::seconds (1 )); // 1 sec validity window,
@@ -189,8 +192,8 @@ void TestAutoRefreshingTokenExpiresInAnHour(
189192 const authentication::AutoRefreshingToken& auto_token,
190193 const std::chrono::seconds minimum_validity)>
191194 func) {
192- auto auto_token = token_endpoint. RequestAutoRefreshingToken (
193- authentication::TokenRequest{std::chrono::hours (1 )});
195+ auto auto_token = authentication::AutoRefreshingToken (
196+ token_endpoint, authentication::TokenRequest{std::chrono::hours (1 )});
194197 auto token_response_one = func (auto_token, std::chrono::seconds (1 ));
195198 std::this_thread::sleep_for (std::chrono::seconds (2 ));
196199 auto token_response_two = func (auto_token, std::chrono::seconds (1 ));
@@ -207,8 +210,8 @@ void TestAutoRefreshingTokenExpiresInASecond(
207210 const authentication::AutoRefreshingToken& auto_token,
208211 const std::chrono::seconds minimum_validity)>
209212 func) {
210- auto auto_token = token_endpoint. RequestAutoRefreshingToken (
211- authentication::TokenRequest{std::chrono::seconds (1 )});
213+ auto auto_token = authentication::AutoRefreshingToken (
214+ token_endpoint, authentication::TokenRequest{std::chrono::seconds (1 )});
212215 auto token_response_one = func (auto_token, std::chrono::seconds (1 ));
213216 std::this_thread::sleep_for (std::chrono::seconds (2 ));
214217 auto token_response_two = func (auto_token, std::chrono::seconds (1 ));
@@ -224,7 +227,7 @@ void TestAutoRefreshingTokenMultiThread(
224227 std::function<authentication::TokenResponse (
225228 const authentication::AutoRefreshingToken& auto_token)>
226229 func) {
227- auto auto_token = token_endpoint. RequestAutoRefreshingToken ( );
230+ auto auto_token = authentication::AutoRefreshingToken (token_endpoint, {} );
228231
229232 std::thread threads[5 ];
230233 auto token_responses = std::vector<authentication::TokenResponse>();
0 commit comments